[PATCH] D98136: [RISCV][RFC] Initially support the K-extension instructions on the LLVM MC layer

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 09:17:17 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:724
+    bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
+    return IsConstantImm && Imm>= INT64_C(0) && Imm <= INT64_C(10) &&
+           VK == RISCVMCExpr::VK_RISCV_None;
----------------
Space after the first "Imm"


================
Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:1199
+  case Match_InvalidRconArg: {
+    return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 4) - 6);
+  }
----------------
Just write 10. I don't think subtracting 6 from 16 makes this very readability. The other places, the name of the error has the number of bits in its name, so using that bit width(or 1 less than it) in the creation of the constants makes sense.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98136/new/

https://reviews.llvm.org/D98136



More information about the llvm-commits mailing list