[PATCH] D144105: [RISCV][NFC] Add missing immediate operand types.
Dmitry via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 16 03:09:19 PST 2023
dybv-sc updated this revision to Diff 497949.
dybv-sc added a comment.
Rebased
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144105/new/
https://reviews.llvm.org/D144105
Files:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoC.td
Index: llvm/lib/Target/RISCV/RISCVInstrInfoC.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfoC.td
+++ llvm/lib/Target/RISCV/RISCVInstrInfoC.td
@@ -93,6 +93,8 @@
let ParserMatchClass = CLUIImmAsmOperand;
let EncoderMethod = "getImmOpValue";
let DecoderMethod = "decodeCLUIImmOperand";
+ let OperandType = "OPERAND_CLUI_IMM";
+ let OperandNamespace = "RISCVOp";
let MCOperandPredicate = [{
int64_t Imm;
if (MCOp.evaluateAsConstantImm(Imm))
@@ -173,6 +175,8 @@
let ParserMatchClass = UImmAsmOperand<9, "Lsb000">;
let EncoderMethod = "getImmOpValue";
let DecoderMethod = "decodeUImmOperand<9>";
+ let OperandType = "OPERAND_UIMM9_LSB000";
+ let OperandNamespace = "RISCVOp";
let MCOperandPredicate = [{
int64_t Imm;
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -189,6 +193,8 @@
let ParserMatchClass = UImmAsmOperand<10, "Lsb00NonZero">;
let EncoderMethod = "getImmOpValue";
let DecoderMethod = "decodeUImmNonZeroOperand<10>";
+ let OperandType = "OPERAND_UIMM10_LSB00_NONZERO";
+ let OperandNamespace = "RISCVOp";
let MCOperandPredicate = [{
int64_t Imm;
if (!MCOp.evaluateAsConstantImm(Imm))
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1635,9 +1635,15 @@
case RISCVOp::OPERAND_UIMM8_LSB000:
Ok = isShiftedUInt<5, 3>(Imm);
break;
+ case RISCVOp::OPERAND_UIMM9_LSB000:
+ Ok = isShiftedUInt<6, 3>(Imm);
+ break;
case RISCVOp::OPERAND_SIMM10_LSB0000_NONZERO:
Ok = isShiftedInt<6, 4>(Imm) && (Imm != 0);
break;
+ case RISCVOp::OPERAND_UIMM10_LSB00_NONZERO:
+ Ok = isShiftedUInt<8, 2>(Imm) && (Imm != 0);
+ break;
case RISCVOp::OPERAND_ZERO:
Ok = Imm == 0;
break;
@@ -1672,6 +1678,10 @@
Ok = STI.is64Bit() ? isUInt<6>(Imm) : isUInt<5>(Imm);
Ok = Ok && Imm != 0;
break;
+ case RISCVOp::OPERAND_CLUI_IMM:
+ Ok = (isUInt<5>(Imm) && Imm != 0) ||
+ (Imm >= 0xfffe0 && Imm <= 0xfffff);
+ break;
case RISCVOp::OPERAND_RVKRNUM:
Ok = Imm >= 0 && Imm <= 10;
break;
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -247,6 +247,8 @@
OPERAND_UIMM7_LSB00,
OPERAND_UIMM8_LSB00,
OPERAND_UIMM8_LSB000,
+ OPERAND_UIMM9_LSB000,
+ OPERAND_UIMM10_LSB00_NONZERO,
OPERAND_UIMM12,
OPERAND_ZERO,
OPERAND_SIMM5,
@@ -259,6 +261,7 @@
OPERAND_UIMM20,
OPERAND_UIMMLOG2XLEN,
OPERAND_UIMMLOG2XLEN_NONZERO,
+ OPERAND_CLUI_IMM,
OPERAND_VTYPEI10,
OPERAND_VTYPEI11,
OPERAND_RVKRNUM,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144105.497949.patch
Type: text/x-patch
Size: 3010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230216/9d40d209/attachment.bin>
More information about the llvm-commits
mailing list