Skip to content

Commit

Permalink
[RISCV] Add SDNode patterns for vwsll.[vv,vx,vi]
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lukel97 committed Jul 26, 2023
1 parent ce8f094 commit 33a93a4
Show file tree
Hide file tree
Showing 3 changed files with 749 additions and 0 deletions.
11 changes: 11 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,11 @@ multiclass VPseudoBinaryW_VX<LMULInfo m> {
"@earlyclobber $rd">;
}

multiclass VPseudoBinaryW_VI<Operand ImmType, LMULInfo m> {
defm "_VI" : VPseudoBinary<m.wvrclass, m.vrclass, ImmType, m,
"@earlyclobber $rd">;
}

multiclass VPseudoBinaryW_VF<LMULInfo m, FPR_Info f> {
defm "_V" # f.FX : VPseudoBinary<m.wvrclass, m.vrclass,
f.fprclass, m,
Expand Down Expand Up @@ -2745,6 +2750,12 @@ multiclass VPseudoVWALU_VV_VX {
}
}

multiclass VPseudoVWALU_VV_VX_VI<Operand ImmType> : VPseudoVWALU_VV_VX {
foreach m = MxListW in {
defm "" : VPseudoBinaryW_VI<ImmType, m>;
}
}

multiclass VPseudoVWMUL_VV_VX {
foreach m = MxListW in {
defvar mx = m.MX;
Expand Down
31 changes: 31 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ defm PseudoVCPOP : VPseudoUnaryV_V;
defm PseudoVROL : VPseudoVALU_VV_VX;
defm PseudoVROR : VPseudoVALU_VV_VX_VI<uimm6>;

defm PseudoVWSLL : VPseudoVWALU_VV_VX_VI<uimm5>;

//===----------------------------------------------------------------------===//
// SDNode patterns
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -288,6 +290,35 @@ foreach vti = AllIntegerVectors in {
}
defm : VPatBinarySDNode_VV_VX_VI<rotr, "PseudoVROR", uimm6>;

foreach vtiToWti = AllWidenableIntVectors in {
defvar vti = vtiToWti.Vti;
defvar wti = vtiToWti.Wti;
let Predicates = !listconcat([HasStdExtZvbb],
GetVTypePredicates<vti>.Predicates,
GetVTypePredicates<wti>.Predicates) in {
def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
(wti.Vector (ext_oneuse (vti.Vector vti.RegClass:$rs1)))),
(!cast<Instruction>("PseudoVWSLL_VV_"#vti.LMul.MX)
(wti.Vector (IMPLICIT_DEF)),
vti.RegClass:$rs2, vti.RegClass:$rs1,
vti.AVL, vti.Log2SEW, TA_MA)>;

def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
(wti.Vector (Low8BitsSplatPat (XLenVT GPR:$rs1)))),
(!cast<Instruction>("PseudoVWSLL_VX_"#vti.LMul.MX)
(wti.Vector (IMPLICIT_DEF)),
vti.RegClass:$rs2, GPR:$rs1,
vti.AVL, vti.Log2SEW, TA_MA)>;

def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs2))),
(wti.Vector (SplatPat_uimm5 uimm5:$rs1))),
(!cast<Instruction>("PseudoVWSLL_VI_"#vti.LMul.MX)
(wti.Vector (IMPLICIT_DEF)),
vti.RegClass:$rs2, uimm5:$rs1,
vti.AVL, vti.Log2SEW, TA_MA)>;
}
}

//===----------------------------------------------------------------------===//
// VL patterns
//===----------------------------------------------------------------------===//
Expand Down

0 comments on commit 33a93a4

Please sign in to comment.