@@ -512,11 +512,13 @@ def CVrrAsmOperand : AsmOperandClass {
512
512
let DiagnosticType = "InvalidRegReg";
513
513
}
514
514
515
- def CVrr : Operand<OtherVT> {
515
+ def CVrr : Operand<i32>,
516
+ ComplexPattern<i32, 2, "SelectAddrRegReg",[]> {
516
517
let ParserMatchClass = CVrrAsmOperand;
517
518
let EncoderMethod = "getRegReg";
518
519
let DecoderMethod = "decodeRegReg";
519
520
let PrintMethod = "printRegReg";
521
+ let MIOperandInfo = (ops GPR:$base, GPR:$offset);
520
522
}
521
523
522
524
class CVLoad_ri_inc<bits<3> funct3, string opcodestr>
@@ -659,6 +661,47 @@ let Predicates = [HasVendorXCVelw, IsRV32], hasSideEffects = 0,
659
661
def CV_ELW : CVLoad_ri<0b011, "cv.elw">;
660
662
}
661
663
664
+ //===----------------------------------------------------------------------===//
665
+ // Patterns for load & store operations
666
+ //===----------------------------------------------------------------------===//
667
+ class CVLdrrPat<PatFrag LoadOp, RVInst Inst>
668
+ : Pat<(XLenVT (LoadOp CVrr:$regreg)),
669
+ (Inst CVrr:$regreg)>;
670
+
671
+ class CVStriPat<PatFrag StoreOp, RVInst Inst>
672
+ : Pat<(StoreOp (XLenVT GPR:$rs2), GPR:$rs1, simm12:$imm12),
673
+ (Inst GPR:$rs2, GPR:$rs1, simm12:$imm12)>;
674
+
675
+ class CVStrriPat<PatFrag StoreOp, RVInst Inst>
676
+ : Pat<(StoreOp (XLenVT GPR:$rs2), GPR:$rs1, GPR:$rs3),
677
+ (Inst GPR:$rs2, GPR:$rs1, GPR:$rs3)>;
678
+
679
+ class CVStrrPat<PatFrag StoreOp, RVInst Inst>
680
+ : Pat<(StoreOp (XLenVT GPR:$rs2), CVrr:$regreg),
681
+ (Inst GPR:$rs2, CVrr:$regreg)>;
682
+
683
+ let Predicates = [HasVendorXCVmem, IsRV32], AddedComplexity = 1 in {
684
+ def : CVLdrrPat<sextloadi8, CV_LB_rr>;
685
+ def : CVLdrrPat<zextloadi8, CV_LBU_rr>;
686
+ def : CVLdrrPat<extloadi8, CV_LBU_rr>;
687
+ def : CVLdrrPat<sextloadi16, CV_LH_rr>;
688
+ def : CVLdrrPat<zextloadi16, CV_LHU_rr>;
689
+ def : CVLdrrPat<extloadi16, CV_LHU_rr>;
690
+ def : CVLdrrPat<load, CV_LW_rr>;
691
+
692
+ def : CVStriPat<post_truncsti8, CV_SB_ri_inc>;
693
+ def : CVStriPat<post_truncsti16, CV_SH_ri_inc>;
694
+ def : CVStriPat<post_store, CV_SW_ri_inc>;
695
+
696
+ def : CVStrriPat<post_truncsti8, CV_SB_rr_inc>;
697
+ def : CVStrriPat<post_truncsti16, CV_SH_ri_inc>;
698
+ def : CVStrriPat<post_store, CV_SW_rr_inc>;
699
+
700
+ def : CVStrrPat<truncstorei8, CV_SB_rr>;
701
+ def : CVStrrPat<truncstorei16, CV_SH_rr>;
702
+ def : CVStrrPat<store, CV_SW_rr>;
703
+ }
704
+
662
705
def cv_tuimm2 : TImmLeaf<XLenVT, [{return isUInt<2>(Imm);}]>;
663
706
def cv_tuimm5 : TImmLeaf<XLenVT, [{return isUInt<5>(Imm);}]>;
664
707
def cv_uimm10 : ImmLeaf<XLenVT, [{return isUInt<10>(Imm);}]>;
0 commit comments