Skip to content

Commit ef72c23

Browse files
authored
[PowerPC] Implement vector unpack instructions (#151004)
Implement the set of vector uncompress instructions: * vupkhsntob * vupklsntob * vupkint4tobf16 * vupkint8tobf16 * vupkint4tofp32 * vupkint8tofp32
1 parent 7e1e133 commit ef72c23

File tree

4 files changed

+138
-0
lines changed

4 files changed

+138
-0
lines changed

llvm/lib/Target/PowerPC/PPCInstrFuture.td

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,67 @@ multiclass XOForm_RTAB5_L1r<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
4545
}
4646
}
4747

48+
class VXForm_VRTB5<bits<11> xo, bits<5> R, dag OOL, dag IOL, string asmstr,
49+
list<dag> pattern> : I<4, OOL, IOL, asmstr, NoItinerary> {
50+
bits<5> VRT;
51+
bits<5> VRB;
52+
53+
let Pattern = pattern;
54+
55+
let Inst{6 -10} = VRT;
56+
let Inst{11 -15} = R;
57+
let Inst{16 -20} = VRB;
58+
let Inst{21 -31} = xo;
59+
}
60+
61+
class VXForm_VRTB5_UIM2<bits<11> xo, bits<3> R, dag OOL, dag IOL, string asmstr,
62+
list<dag> pattern>
63+
: I<4, OOL, IOL, asmstr, NoItinerary> {
64+
bits<5> VRT;
65+
bits<5> VRB;
66+
bits<2> UIM;
67+
68+
let Pattern = pattern;
69+
70+
let Inst{6 -10} = VRT;
71+
let Inst{11 -13} = R;
72+
let Inst{14 -15} = UIM;
73+
let Inst{16 -20} = VRB;
74+
let Inst{21 -31} = xo;
75+
}
76+
77+
class VXForm_VRTB5_UIM1<bits<11> xo, bits<4> R, dag OOL, dag IOL, string asmstr,
78+
list<dag> pattern>
79+
: I<4, OOL, IOL, asmstr, NoItinerary> {
80+
bits<5> VRT;
81+
bits<5> VRB;
82+
bits<1> UIM;
83+
84+
let Pattern = pattern;
85+
86+
let Inst{6 -10} = VRT;
87+
let Inst{11 -14} = R;
88+
let Inst{15} = UIM;
89+
let Inst{16 -20} = VRB;
90+
let Inst{21 -31} = xo;
91+
}
92+
93+
class VXForm_VRTB5_UIM3<bits<11> xo, bits<2> R, dag OOL, dag IOL, string asmstr,
94+
list<dag> pattern>
95+
: I<4, OOL, IOL, asmstr, NoItinerary> {
96+
bits<5> VRT;
97+
bits<5> VRB;
98+
bits<3> UIM;
99+
100+
let Pattern = pattern;
101+
102+
let Inst{6 -10} = VRT;
103+
let Inst{11 -12} = R;
104+
let Inst{13 -15} = UIM;
105+
let Inst{16 -20} = VRB;
106+
let Inst{21 -31} = xo;
107+
}
108+
48109
let Predicates = [IsISAFuture] in {
49110
defm SUBFUS : XOForm_RTAB5_L1r<31, 72, (outs g8rc:$RT),
50111
(ins g8rc:$RA, g8rc:$RB, u1imm:$L),
@@ -81,4 +142,21 @@ let Predicates = [HasVSX, IsISAFuture] in {
81142
(ins vsrprc:$XTp, (memr $RA):$addr, g8rc:$RB),
82143
"stxvprll $XTp, $addr, $RB", IIC_LdStLFD, []>;
83144
}
145+
146+
def VUPKHSNTOB : VXForm_VRTB5<387, 0, (outs vrrc:$VRT), (ins vrrc:$VRB),
147+
"vupkhsntob $VRT, $VRB", []>;
148+
def VUPKLSNTOB : VXForm_VRTB5<387, 1, (outs vrrc:$VRT), (ins vrrc:$VRB),
149+
"vupklsntob $VRT, $VRB", []>;
150+
def VUPKINT4TOBF16
151+
: VXForm_VRTB5_UIM2<387, 2, (outs vrrc:$VRT), (ins vrrc:$VRB, u2imm:$UIM),
152+
"vupkint4tobf16 $VRT, $VRB, $UIM", []>;
153+
def VUPKINT8TOBF16
154+
: VXForm_VRTB5_UIM1<387, 1, (outs vrrc:$VRT), (ins vrrc:$VRB, u1imm:$UIM),
155+
"vupkint8tobf16 $VRT, $VRB, $UIM", []>;
156+
def VUPKINT8TOFP32
157+
: VXForm_VRTB5_UIM2<387, 3, (outs vrrc:$VRT), (ins vrrc:$VRB, u2imm:$UIM),
158+
"vupkint8tofp32 $VRT, $VRB, $UIM", []>;
159+
def VUPKINT4TOFP32
160+
: VXForm_VRTB5_UIM3<387, 2, (outs vrrc:$VRT), (ins vrrc:$VRB, u3imm:$UIM),
161+
"vupkint4tofp32 $VRT, $VRB, $UIM", []>;
84162
}

llvm/test/MC/Disassembler/PowerPC/ppc-encoding-ISAFuture.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,21 @@
195195

196196
#CHECK: dmxxsha224256pad 0, 1
197197
0xf0,0x18,0x0e,0x94
198+
199+
#CHECK: vupkhsntob 2, 4
200+
0x10,0x40,0x21,0x83
201+
202+
#CHECK: vupklsntob 2, 4
203+
0x10,0x41,0x21,0x83
204+
205+
#CHECK: vupkint4tobf16 2, 4, 3
206+
0x10,0x4b,0x21,0x83
207+
208+
#CHECK: vupkint8tobf16 1, 3, 1
209+
0x10,0x23,0x19,0x83
210+
211+
#CHECK: vupkint4tofp32 3, 5, 2
212+
0x10,0x72,0x29,0x83
213+
214+
#CHECK: vupkint8tofp32 3, 5, 2
215+
0x10,0x6e,0x29,0x83

llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding-ISAFuture.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,21 @@
189189

190190
#CHECK: dmxxsha224256pad 0, 1
191191
0x94,0x0e,0x18,0xf0
192+
193+
#CHECK: vupkhsntob 2, 4
194+
0x83,0x21,0x40,0x10
195+
196+
#CHECK: vupklsntob 2, 4
197+
0x83,0x21,0x41,0x10
198+
199+
#CHECK: vupkint4tobf16 2, 4, 3
200+
0x83,0x21,0x4b,0x10
201+
202+
#CHECK: vupkint8tobf16 1, 3, 1
203+
0x83,0x19,0x23,0x10
204+
205+
#CHECK: vupkint4tofp32 3, 5, 2
206+
0x83,0x29,0x72,0x10
207+
208+
#CHECK: vupkint8tofp32 3, 5, 2
209+
0x83,0x29,0x6e,0x10

llvm/test/MC/PowerPC/ppc-encoding-ISAFuture.s

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,27 @@
282282
dmxxsha224256pad 0, 1
283283
#CHECK-BE: dmxxsha224256pad 0, 1 # encoding: [0xf0,0x18,0x0e,0x94]
284284
#CHECK-LE: dmxxsha224256pad 0, 1 # encoding: [0x94,0x0e,0x18,0xf0]
285+
286+
vupkhsntob 2, 4
287+
#CHECK-BE: vupkhsntob 2, 4 # encoding: [0x10,0x40,0x21,0x83]
288+
#CHECK-LE: vupkhsntob 2, 4 # encoding: [0x83,0x21,0x40,0x10]
289+
290+
vupklsntob 2, 4
291+
#CHECK-BE: vupklsntob 2, 4 # encoding: [0x10,0x41,0x21,0x83]
292+
#CHECK-LE: vupklsntob 2, 4 # encoding: [0x83,0x21,0x41,0x10]
293+
294+
vupkint4tobf16 2, 4, 3
295+
#CHECK-BE: vupkint4tobf16 2, 4, 3 # encoding: [0x10,0x4b,0x21,0x83]
296+
#CHECK-LE: vupkint4tobf16 2, 4, 3 # encoding: [0x83,0x21,0x4b,0x10]
297+
298+
vupkint8tobf16 1, 3, 1
299+
#CHECK-BE: vupkint8tobf16 1, 3, 1 # encoding: [0x10,0x23,0x19,0x83]
300+
#CHECK-LE: vupkint8tobf16 1, 3, 1 # encoding: [0x83,0x19,0x23,0x10]
301+
302+
vupkint4tofp32 3, 5, 2
303+
#CHECK-BE: vupkint4tofp32 3, 5, 2 # encoding: [0x10,0x72,0x29,0x83]
304+
#CHECK-LE: vupkint4tofp32 3, 5, 2 # encoding: [0x83,0x29,0x72,0x10]
305+
306+
vupkint8tofp32 3, 5, 2
307+
#CHECK-BE: vupkint8tofp32 3, 5, 2 # encoding: [0x10,0x6e,0x29,0x83]
308+
#CHECK-LE: vupkint8tofp32 3, 5, 2 # encoding: [0x83,0x29,0x6e,0x10]

0 commit comments

Comments
 (0)