1818// Operand and SDNode transformation definitions.
1919//===----------------------------------------------------------------------===//
2020
21- def simm10 : RISCVSImmOp<10>, TImmLeaf <XLenVT, "return isInt<10>(Imm);">;
21+ def simm10 : RISCVSImmOp<10>, ImmLeaf <XLenVT, "return isInt<10>(Imm);">;
2222
2323def SImm8UnsignedAsmOperand : SImmAsmOperand<8, "Unsigned"> {
2424 let RenderMethod = "addSImm8UnsignedOperands";
2525}
2626
2727// A 8-bit signed immediate allowing range [-128, 255]
2828// but represented as [-128, 127].
29- def simm8_unsigned : RISCVOp, TImmLeaf <XLenVT, "return isInt<8>(Imm);"> {
29+ def simm8_unsigned : RISCVOp, ImmLeaf <XLenVT, "return isInt<8>(Imm);"> {
3030 let ParserMatchClass = SImm8UnsignedAsmOperand;
3131 let EncoderMethod = "getImmOpValue";
3232 let DecoderMethod = "decodeSImmOperand<8>";
@@ -1463,10 +1463,6 @@ let Predicates = [HasStdExtP, IsRV32] in {
14631463
14641464def riscv_absw : RVSDNode<"ABSW", SDTIntUnaryOp>;
14651465
1466- def SDT_RISCVPLI : SDTypeProfile<1, 1, [SDTCisVec<0>,
1467- SDTCisInt<0>,
1468- SDTCisInt<1>]>;
1469- def riscv_pli : RVSDNode<"PLI", SDT_RISCVPLI>;
14701466def SDT_RISCVPASUB : SDTypeProfile<1, 2, [SDTCisVec<0>,
14711467 SDTCisInt<0>,
14721468 SDTCisSameAs<0, 1>,
@@ -1519,10 +1515,13 @@ let Predicates = [HasStdExtP] in {
15191515
15201516
15211517 // 8-bit PLI SD node pattern
1522- def: Pat<(XLenVecI8VT (riscv_pli simm8_unsigned:$imm8)), (PLI_B simm8_unsigned:$imm8)>;
1518+ def: Pat<(XLenVecI8VT (splat_vector simm8_unsigned:$imm8)), (PLI_B simm8_unsigned:$imm8)>;
15231519 // 16-bit PLI SD node pattern
1524- def: Pat<(XLenVecI16VT (riscv_pli simm10:$imm10)), (PLI_H simm10:$imm10)>;
1520+ def: Pat<(XLenVecI16VT (splat_vector simm10:$imm10)), (PLI_H simm10:$imm10)>;
15251521
1522+ // // splat pattern
1523+ def: Pat<(XLenVecI8VT (splat_vector (XLenVT GPR:$rs2))), (PADD_BS (XLenVT X0), GPR:$rs2)>;
1524+ def: Pat<(XLenVecI16VT (splat_vector (XLenVT GPR:$rs2))), (PADD_HS (XLenVT X0), GPR:$rs2)>;
15261525} // Predicates = [HasStdExtP]
15271526
15281527let Predicates = [HasStdExtP, IsRV32] in {
@@ -1537,7 +1536,7 @@ let Predicates = [HasStdExtP, IsRV64] in {
15371536 def : PatGpr<riscv_absw, ABSW>;
15381537
15391538 // 32-bit PLI SD node pattern
1540- def: Pat<(v2i32 (riscv_pli simm10:$imm10)), (PLI_W simm10:$imm10)>;
1539+ def: Pat<(v2i32 (splat_vector simm10:$imm10)), (PLI_W simm10:$imm10)>;
15411540
15421541 // Basic 32-bit arithmetic patterns
15431542 def: Pat<(v2i32 (add GPR:$rs1, GPR:$rs2)), (PADD_W GPR:$rs1, GPR:$rs2)>;
@@ -1557,6 +1556,9 @@ let Predicates = [HasStdExtP, IsRV64] in {
15571556 def: Pat<(v2i32 (riscv_pasub GPR:$rs1, GPR:$rs2)), (PASUB_W GPR:$rs1, GPR:$rs2)>;
15581557 def: Pat<(v2i32 (riscv_pasubu GPR:$rs1, GPR:$rs2)), (PASUBU_W GPR:$rs1, GPR:$rs2)>;
15591558
1559+ // splat pattern
1560+ def: Pat<(v2i32 (splat_vector (XLenVT GPR:$rs2))), (PADD_WS (XLenVT X0), GPR:$rs2)>;
1561+
15601562 // Load/Store patterns
15611563 def : StPat<store, SD, GPR, v8i8>;
15621564 def : StPat<store, SD, GPR, v4i16>;
0 commit comments