================ @@ -400,6 +404,22 @@ RISCVMCCodeEmitter::getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, return getImmOpValue(MI, OpNo, Fixups, STI); } +uint64_t +RISCVMCCodeEmitter::getImmOpValueZibimm(const MCInst &MI, unsigned OpNo, + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const { + const MCOperand &MO = MI.getOperand(OpNo); + + if (MO.isImm()) { + uint64_t Res = MO.getImm(); + if (Res >= 1 && Res <= 31) ---------------- topperc wrote:
You only need to check for the -1 case. For any other value you can just return Res. The creator of the MCInst is required to make sure that the only possible values are -1, 1-31. https://github.com/llvm/llvm-project/pull/127463 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits