Skip to content

Commit 1eb279d

Browse files
committed
[PowerPC][Power10] Add Vector Multiply/Mod/Divide Instruction Definitions and MC Tests
This patch adds the td definitions and asm/disasm tests for the following instructions: - Vector Multiply Low Doubleword: vmulld - Vector Modulus Word/Doubleword: vmodsw, vmoduw, vmodsd, vmodud - Vector Divide Word/Doubleword: vdivsw, vdivuw, vdivsd, vdivud - Vector Multiply High Word/Doubleword: vmulhsw, vmulhsd, vmulhuw, vmulhud - Vector Divide Extended Word/Doubleword: vdivesw, vdiveuw, vdivesd, vdiveud Differential Revision: https://reviews.llvm.org/D82929
1 parent 7915444 commit 1eb279d

File tree

3 files changed

+136
-1
lines changed

3 files changed

+136
-1
lines changed

llvm/lib/Target/PowerPC/PPCInstrPrefix.td

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,40 @@ let Predicates = [IsISA3_1] in {
972972
"vclrrb $vD, $vA, $rB", IIC_VecGeneral,
973973
[(set v16i8:$vD,
974974
(int_ppc_altivec_vclrrb v16i8:$vA, i32:$rB))]>;
975-
975+
def VMULLD : VXForm_1<457, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
976+
"vmulld $vD, $vA, $vB", IIC_VecGeneral, []>;
977+
def VMULHSW : VXForm_1<905, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
978+
"vmulhsw $vD, $vA, $vB", IIC_VecGeneral, []>;
979+
def VMULHUW : VXForm_1<649, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
980+
"vmulhuw $vD, $vA, $vB", IIC_VecGeneral, []>;
981+
def VMULHSD : VXForm_1<969, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
982+
"vmulhsd $vD, $vA, $vB", IIC_VecGeneral, []>;
983+
def VMULHUD : VXForm_1<713, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
984+
"vmulhud $vD, $vA, $vB", IIC_VecGeneral, []>;
985+
def VMODSW : VXForm_1<1931, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
986+
"vmodsw $vD, $vA, $vB", IIC_VecGeneral, []>;
987+
def VMODUW : VXForm_1<1675, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
988+
"vmoduw $vD, $vA, $vB", IIC_VecGeneral, []>;
989+
def VMODSD : VXForm_1<1995, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
990+
"vmodsd $vD, $vA, $vB", IIC_VecGeneral, []>;
991+
def VMODUD : VXForm_1<1739, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
992+
"vmodud $vD, $vA, $vB", IIC_VecGeneral, []>;
993+
def VDIVSW : VXForm_1<395, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
994+
"vdivsw $vD, $vA, $vB", IIC_VecGeneral, []>;
995+
def VDIVUW : VXForm_1<139, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
996+
"vdivuw $vD, $vA, $vB", IIC_VecGeneral, []>;
997+
def VDIVSD : VXForm_1<459, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
998+
"vdivsd $vD, $vA, $vB", IIC_VecGeneral, []>;
999+
def VDIVUD : VXForm_1<203, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
1000+
"vdivud $vD, $vA, $vB", IIC_VecGeneral, []>;
1001+
def VDIVESW : VXForm_1<907, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
1002+
"vdivesw $vD, $vA, $vB", IIC_VecGeneral, []>;
1003+
def VDIVEUW : VXForm_1<651, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
1004+
"vdiveuw $vD, $vA, $vB", IIC_VecGeneral, []>;
1005+
def VDIVESD : VXForm_1<971, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
1006+
"vdivesd $vD, $vA, $vB", IIC_VecGeneral, []>;
1007+
def VDIVEUD : VXForm_1<715, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
1008+
"vdiveud $vD, $vA, $vB", IIC_VecGeneral, []>;
9761009
def XVTLSBB : XX2_BF3_XO5_XB6_XO9<60, 2, 475, (outs crrc:$BF), (ins vsrc:$XB),
9771010
"xvtlsbb $BF, $XB", IIC_VecGeneral, []>;
9781011

llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,57 @@
231231
# CHECK: vsrdbi 2, 3, 4, 5
232232
0x10 0x43 0x23 0x56
233233

234+
# CHECK: vmulld 1, 2, 3
235+
0x10 0x22 0x19 0xc9
236+
237+
# CHECK: vmodsw 21, 11, 10
238+
0x12 0xab 0x57 0x8b
239+
240+
# CHECK: vmoduw 21, 11, 10
241+
0x12 0xab 0x56 0x8b
242+
243+
# CHECK: vmodsd 21, 11, 10
244+
0x12 0xab 0x57 0xcb
245+
246+
# CHECK: vmodud 21, 11, 10
247+
0x12 0xab 0x56 0xcb
248+
249+
# CHECK: vdivsw 21, 11, 10
250+
0x12 0xab 0x51 0x8b
251+
252+
# CHECK: vdivuw 21, 11, 10
253+
0x12 0xab 0x50 0x8b
254+
255+
# CHECK: vdivsd 21, 11, 10
256+
0x12 0xab 0x51 0xcb
257+
258+
# CHECK: vdivud 21, 11, 10
259+
0x12 0xab 0x50 0xcb
260+
261+
# CHECK: vmulhsw 1, 2, 3
262+
0x10 0x22 0x1b 0x89
263+
264+
# CHECK: vmulhuw 1, 2, 3
265+
0x10 0x22 0x1a 0x89
266+
267+
# CHECK: vmulhsd 1, 2, 3
268+
0x10 0x22 0x1b 0xc9
269+
270+
# CHECK: vmulhud 1, 2, 3
271+
0x10 0x22 0x1a 0xc9
272+
273+
# CHECK: vdivesw 21, 11, 10
274+
0x12 0xab 0x53 0x8b
275+
276+
# CHECK: vdiveuw 21, 11, 10
277+
0x12 0xab 0x52 0x8b
278+
279+
# CHECK: vdivesd 21, 11, 10
280+
0x12 0xab 0x53 0xcb
281+
282+
# CHECK: vdiveud 21, 11, 10
283+
0x12 0xab 0x52 0xcb
284+
234285
# CHECK: vinsw 2, 3, 12
235286
0x10 0x4c 0x18 0xcf
236287

llvm/test/MC/PowerPC/ppc64-encoding-ISA31.s

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,57 @@
357357
# CHECK-BE: vsrdbi 2, 3, 4, 5 # encoding: [0x10,0x43,0x23,0x56]
358358
# CHECK-LE: vsrdbi 2, 3, 4, 5 # encoding: [0x56,0x23,0x43,0x10]
359359
vsrdbi 2, 3, 4, 5
360+
# CHECK-BE: vmulld 1, 2, 3 # encoding: [0x10,0x22,0x19,0xc9]
361+
# CHECK-LE: vmulld 1, 2, 3 # encoding: [0xc9,0x19,0x22,0x10]
362+
vmulld 1, 2, 3
363+
# CHECK-BE: vmulhsw 1, 2, 3 # encoding: [0x10,0x22,0x1b,0x89]
364+
# CHECK-LE: vmulhsw 1, 2, 3 # encoding: [0x89,0x1b,0x22,0x10]
365+
vmulhsw 1, 2, 3
366+
# CHECK-BE: vmulhuw 1, 2, 3 # encoding: [0x10,0x22,0x1a,0x89]
367+
# CHECK-LE: vmulhuw 1, 2, 3 # encoding: [0x89,0x1a,0x22,0x10]
368+
vmulhuw 1, 2, 3
369+
# CHECK-BE: vmulhsd 1, 2, 3 # encoding: [0x10,0x22,0x1b,0xc9]
370+
# CHECK-LE: vmulhsd 1, 2, 3 # encoding: [0xc9,0x1b,0x22,0x10]
371+
vmulhsd 1, 2, 3
372+
# CHECK-BE: vmulhud 1, 2, 3 # encoding: [0x10,0x22,0x1a,0xc9]
373+
# CHECK-LE: vmulhud 1, 2, 3 # encoding: [0xc9,0x1a,0x22,0x10]
374+
vmulhud 1, 2, 3
375+
# CHECK-BE: vmodsw 21, 11, 10 # encoding: [0x12,0xab,0x57,0x8b]
376+
# CHECK-LE: vmodsw 21, 11, 10 # encoding: [0x8b,0x57,0xab,0x12]
377+
vmodsw 21, 11, 10
378+
# CHECK-BE: vmoduw 21, 11, 10 # encoding: [0x12,0xab,0x56,0x8b]
379+
# CHECK-LE: vmoduw 21, 11, 10 # encoding: [0x8b,0x56,0xab,0x12]
380+
vmoduw 21, 11, 10
381+
# CHECK-BE: vmodsd 21, 11, 10 # encoding: [0x12,0xab,0x57,0xcb]
382+
# CHECK-LE: vmodsd 21, 11, 10 # encoding: [0xcb,0x57,0xab,0x12]
383+
vmodsd 21, 11, 10
384+
# CHECK-BE: vmodud 21, 11, 10 # encoding: [0x12,0xab,0x56,0xcb]
385+
# CHECK-LE: vmodud 21, 11, 10 # encoding: [0xcb,0x56,0xab,0x12]
386+
vmodud 21, 11, 10
387+
# CHECK-BE: vdivsw 21, 11, 10 # encoding: [0x12,0xab,0x51,0x8b]
388+
# CHECK-LE: vdivsw 21, 11, 10 # encoding: [0x8b,0x51,0xab,0x12]
389+
vdivsw 21, 11, 10
390+
# CHECK-BE: vdivuw 21, 11, 10 # encoding: [0x12,0xab,0x50,0x8b]
391+
# CHECK-LE: vdivuw 21, 11, 10 # encoding: [0x8b,0x50,0xab,0x12]
392+
vdivuw 21, 11, 10
393+
# CHECK-BE: vdivsd 21, 11, 10 # encoding: [0x12,0xab,0x51,0xcb]
394+
# CHECK-LE: vdivsd 21, 11, 10 # encoding: [0xcb,0x51,0xab,0x12]
395+
vdivsd 21, 11, 10
396+
# CHECK-BE: vdivud 21, 11, 10 # encoding: [0x12,0xab,0x50,0xcb]
397+
# CHECK-LE: vdivud 21, 11, 10 # encoding: [0xcb,0x50,0xab,0x12]
398+
vdivud 21, 11, 10
399+
# CHECK-BE: vdivesw 21, 11, 10 # encoding: [0x12,0xab,0x53,0x8b]
400+
# CHECK-LE: vdivesw 21, 11, 10 # encoding: [0x8b,0x53,0xab,0x12]
401+
vdivesw 21, 11, 10
402+
# CHECK-BE: vdiveuw 21, 11, 10 # encoding: [0x12,0xab,0x52,0x8b]
403+
# CHECK-LE: vdiveuw 21, 11, 10 # encoding: [0x8b,0x52,0xab,0x12]
404+
vdiveuw 21, 11, 10
405+
# CHECK-BE: vdivesd 21, 11, 10 # encoding: [0x12,0xab,0x53,0xcb]
406+
# CHECK-LE: vdivesd 21, 11, 10 # encoding: [0xcb,0x53,0xab,0x12]
407+
vdivesd 21, 11, 10
408+
# CHECK-BE: vdiveud 21, 11, 10 # encoding: [0x12,0xab,0x52,0xcb]
409+
# CHECK-LE: vdiveud 21, 11, 10 # encoding: [0xcb,0x52,0xab,0x12]
410+
vdiveud 21, 11, 10
360411
# CHECK-BE: vinsw 2, 3, 12 # encoding: [0x10,0x4c,0x18,0xcf]
361412
# CHECK-LE: vinsw 2, 3, 12 # encoding: [0xcf,0x18,0x4c,0x10]
362413
vinsw 2, 3, 12

0 commit comments

Comments
 (0)