Skip to content

Commit

Permalink
[RISCV] Use vadd.vi for tail undisturbe vsub intrinsic with small imm…
Browse files Browse the repository at this point in the history
…ediate.

Our pattern previously checked for the merge operand being undef.
  • Loading branch information
topperc committed Jun 1, 2024
1 parent 4d4d6eb commit 1af0778
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 6 deletions.
13 changes: 7 additions & 6 deletions llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Original file line number Diff line number Diff line change
Expand Up @@ -6297,15 +6297,16 @@ foreach vti = AllIntegerVectors in {
(XLenVT timm:$policy))>;

// Match VSUB with a small immediate to vadd.vi by negating the immediate.
def : Pat<(vti.Vector (int_riscv_vsub (vti.Vector (undef)),
def : Pat<(vti.Vector (int_riscv_vsub (vti.Vector vti.RegClass:$merge),
(vti.Vector vti.RegClass:$rs1),
(vti.Scalar simm5_plus1:$rs2),
VLOpFrag)),
(!cast<Instruction>("PseudoVADD_VI_"#vti.LMul.MX) (vti.Vector (IMPLICIT_DEF)),
vti.RegClass:$rs1,
(NegImm simm5_plus1:$rs2),
GPR:$vl,
vti.Log2SEW, TA_MA)>;
(!cast<Instruction>("PseudoVADD_VI_"#vti.LMul.MX)
vti.RegClass:$merge,
vti.RegClass:$rs1,
(NegImm simm5_plus1:$rs2),
GPR:$vl,
vti.Log2SEW, TA_MA)>;
def : Pat<(vti.Vector (int_riscv_vsub_mask (vti.Vector vti.RegClass:$merge),
(vti.Vector vti.RegClass:$rs1),
(vti.Scalar simm5_plus1:$rs2),
Expand Down
Loading

0 comments on commit 1af0778

Please sign in to comment.