@@ -633,8 +633,9 @@ let Predicates = [HasVendorXCVmem, IsRV32] in {
633633 def CV_SW_rr : CVStore_rr<0b011, 0b0010110, "cv.sw">;
634634}
635635
636- let Predicates = [HasVendorXCVelw, IsRV32], hasSideEffects = 0 ,
636+ let Predicates = [HasVendorXCVelw, IsRV32], hasSideEffects = 1 ,
637637 mayLoad = 1, mayStore = 0 in {
638+ def PseudoCV_ELW : PseudoLoad<"cv.elw">;
638639 // Event load
639640 def CV_ELW : CVLoad_ri<0b011, "cv.elw">;
640641}
@@ -706,6 +707,12 @@ let Predicates = [HasVendorXCVmem, IsRV32], AddedComplexity = 1 in {
706707 def : CVStrrPat<store, CV_SW_rr>;
707708}
708709
710+ let Predicates = [HasVendorXCVelw, IsRV32] in {
711+ def : Pat<(int_riscv_cv_elw_elw (XLenVT GPR:$rs1)), (PseudoCV_ELW GPR:$rs1)>;
712+ def : Pat<(int_riscv_cv_elw_elw (AddrRegImm (XLenVT GPR:$rs1), simm12_lo:$imm12)),
713+ (CV_ELW GPR:$rs1, simm12_lo:$imm12)>;
714+ }
715+
709716multiclass PatCoreVBitManip<Intrinsic intr> {
710717 def : PatGprGpr<intr, !cast<RVInst>("CV_" # NAME # "R")>;
711718 def : Pat<(intr GPR:$rs1, cv_uimm10:$imm),
0 commit comments