Skip to content

Commit 33a93a4

Browse files
committed
[RISCV] Add SDNode patterns for vwsll.[vv,vx,vi]
This reuses the patterns introduced to help lower vnsr[a,l].vx in D155698. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D155936
1 parent ce8f094 commit 33a93a4

File tree

3 files changed

+749
-0
lines changed

3 files changed

+749
-0
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,11 @@ multiclass VPseudoBinaryW_VX<LMULInfo m> {
21662166
"@earlyclobber $rd">;
21672167
}
21682168

2169+
multiclass VPseudoBinaryW_VI<Operand ImmType, LMULInfo m> {
2170+
defm "_VI" : VPseudoBinary<m.wvrclass, m.vrclass, ImmType, m,
2171+
"@earlyclobber $rd">;
2172+
}
2173+
21692174
multiclass VPseudoBinaryW_VF<LMULInfo m, FPR_Info f> {
21702175
defm "_V" # f.FX : VPseudoBinary<m.wvrclass, m.vrclass,
21712176
f.fprclass, m,
@@ -2745,6 +2750,12 @@ multiclass VPseudoVWALU_VV_VX {
27452750
}
27462751
}
27472752

2753+
multiclass VPseudoVWALU_VV_VX_VI<Operand ImmType> : VPseudoVWALU_VV_VX {
2754+
foreach m = MxListW in {
2755+
defm "" : VPseudoBinaryW_VI<ImmType, m>;
2756+
}
2757+
}
2758+
27482759
multiclass VPseudoVWMUL_VV_VX {
27492760
foreach m = MxListW in {
27502761
defvar mx = m.MX;

llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ defm PseudoVCPOP : VPseudoUnaryV_V;
214214
defm PseudoVROL : VPseudoVALU_VV_VX;
215215
defm PseudoVROR : VPseudoVALU_VV_VX_VI<uimm6>;
216216

217+
defm PseudoVWSLL : VPseudoVWALU_VV_VX_VI<uimm5>;
218+
217219
//===----------------------------------------------------------------------===//
218220
// SDNode patterns
219221
//===----------------------------------------------------------------------===//
@@ -288,6 +290,35 @@ foreach vti = AllIntegerVectors in {
288290
}
289291
defm : VPatBinarySDNode_VV_VX_VI<rotr, "PseudoVROR", uimm6>;
290292

293+
foreach vtiToWti = AllWidenableIntVectors in {
294+
defvar vti = vtiToWti.Vti;
295+
defvar wti = vtiToWti.Wti;
296+
let Predicates = !listconcat([HasStdExtZvbb],
297+
GetVTypePredicates<vti>.Predicates,
298+
GetVTypePredicates<wti>.Predicates) in {
299+
def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
300+
(wti.Vector (ext_oneuse (vti.Vector vti.RegClass:$rs1)))),
301+
(!cast<Instruction>("PseudoVWSLL_VV_"#vti.LMul.MX)
302+
(wti.Vector (IMPLICIT_DEF)),
303+
vti.RegClass:$rs2, vti.RegClass:$rs1,
304+
vti.AVL, vti.Log2SEW, TA_MA)>;
305+
306+
def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
307+
(wti.Vector (Low8BitsSplatPat (XLenVT GPR:$rs1)))),
308+
(!cast<Instruction>("PseudoVWSLL_VX_"#vti.LMul.MX)
309+
(wti.Vector (IMPLICIT_DEF)),
310+
vti.RegClass:$rs2, GPR:$rs1,
311+
vti.AVL, vti.Log2SEW, TA_MA)>;
312+
313+
def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
314+
(wti.Vector (SplatPat_uimm5 uimm5:$rs1))),
315+
(!cast<Instruction>("PseudoVWSLL_VI_"#vti.LMul.MX)
316+
(wti.Vector (IMPLICIT_DEF)),
317+
vti.RegClass:$rs2, uimm5:$rs1,
318+
vti.AVL, vti.Log2SEW, TA_MA)>;
319+
}
320+
}
321+
291322
//===----------------------------------------------------------------------===//
292323
// VL patterns
293324
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)