@@ -469,6 +469,13 @@ class QCIRVInstRR<bits<5> funct5, DAGOperand InTyRs1, string opcodestr>
469469 : RVInstR<{0b00, funct5}, 0b011, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
470470 (ins InTyRs1:$rs1, GPRNoX0:$rs2), opcodestr, "$rd, $rs1, $rs2">;
471471
472+ class QCIRVInstRRTied<bits<5> funct5, DAGOperand InTyRs1, string opcodestr>
473+ : RVInstR<{0b00, funct5}, 0b011, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb),
474+ (ins GPRNoX0:$rd, InTyRs1:$rs1, GPRNoX0:$rs2), opcodestr,
475+ "$rd, $rs1, $rs2"> {
476+ let Constraints = "$rd = $rd_wb";
477+ }
478+
472479class QCIBitManipRII<bits<3> funct3, bits<2> funct2,
473480 DAGOperand InTyRs1, string opcodestr>
474481 : RVInstIBase<funct3, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
@@ -482,11 +489,26 @@ class QCIBitManipRII<bits<3> funct3, bits<2> funct2,
482489 let Inst{24-20} = shamt;
483490}
484491
492+ class QCIBitManipRIITied<bits<3> funct3, bits<2> funct2,
493+ DAGOperand InTyRs1, string opcodestr>
494+ : RVInstIBase<funct3, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb), (ins GPRNoX0:$rd,
495+ InTyRs1:$rs1, uimm5_plus1:$width, uimm5:$shamt),
496+ opcodestr, "$rd, $rs1, $width, $shamt"> {
497+ let Constraints = "$rd = $rd_wb";
498+ bits<5> shamt;
499+ bits<5> width;
500+
501+ let Inst{31-30} = funct2;
502+ let Inst{29-25} = width;
503+ let Inst{24-20} = shamt;
504+ }
505+
485506class QCIRVInstRI<bits<1> funct1, DAGOperand InTyImm11,
486507 string opcodestr>
487- : RVInstIBase<0b000, OPC_CUSTOM_0, (outs GPRNoX0:$rd ),
488- (ins GPRNoX0:$rs1, InTyImm11:$imm11), opcodestr,
508+ : RVInstIBase<0b000, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb ),
509+ (ins GPRNoX0:$rd, GPRNoX0:$ rs1, InTyImm11:$imm11), opcodestr,
489510 "$rd, $rs1, $imm11"> {
511+ let Constraints = "$rd = $rd_wb";
490512 bits<11> imm11;
491513
492514 let Inst{31-31} = funct1;
@@ -870,12 +892,12 @@ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
870892 let Inst{29-25} = width;
871893 let Inst{24-20} = shamt;
872894 }
873- def QC_INSB : QCIBitManipRII <0b001, 0b01, GPR, "qc.insb">;
874- def QC_INSBH : QCIBitManipRII <0b001, 0b10, GPR, "qc.insbh">;
875- def QC_INSBR : QCIRVInstRR <0b00000, GPR, "qc.insbr">;
876- def QC_INSBHR : QCIRVInstRR <0b00001, GPR, "qc.insbhr">;
877- def QC_INSBPR : QCIRVInstRR <0b00010, GPR, "qc.insbpr">;
878- def QC_INSBPRH : QCIRVInstRR <0b00011, GPR, "qc.insbprh">;
895+ def QC_INSB : QCIBitManipRIITied <0b001, 0b01, GPR, "qc.insb">;
896+ def QC_INSBH : QCIBitManipRIITied <0b001, 0b10, GPR, "qc.insbh">;
897+ def QC_INSBR : QCIRVInstRRTied <0b00000, GPR, "qc.insbr">;
898+ def QC_INSBHR : QCIRVInstRRTied <0b00001, GPR, "qc.insbhr">;
899+ def QC_INSBPR : QCIRVInstRRTied <0b00010, GPR, "qc.insbpr">;
900+ def QC_INSBPRH : QCIRVInstRRTied <0b00011, GPR, "qc.insbprh">;
879901 def QC_EXTU : QCIBitManipRII<0b010, 0b00, GPRNoX0, "qc.extu">;
880902 def QC_EXTDU : QCIBitManipRII<0b010, 0b10, GPRNoX31, "qc.extdu">;
881903 def QC_EXTDUR : QCIRVInstRR<0b00100, GPRNoX31, "qc.extdur">;
0 commit comments