[llvm] 39b64ad - Revert "foo"
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 10:57:55 PDT 2023
Author: Craig Topper
Date: 2023-03-27T10:57:45-07:00
New Revision: 39b64ad6dbc413a0e45cd92089c43efc9dc9c49b
URL: https://github.com/llvm/llvm-project/commit/39b64ad6dbc413a0e45cd92089c43efc9dc9c49b
DIFF: https://github.com/llvm/llvm-project/commit/39b64ad6dbc413a0e45cd92089c43efc9dc9c49b.diff
LOG: Revert "foo"
This reverts commit 4fde20b8a62ed3d850e4e770ae640039ca1a9ed8.
I failed to squash this
Added:
Modified:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/test/MC/RISCV/insn-invalid.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 108ecf806c6f0..07728c7c2d130 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -1505,7 +1505,7 @@ RISCVAsmParser::parseInsnDirectiveOpcode(OperandVector &Operands) {
auto *CE = dyn_cast<MCConstantExpr>(Res);
if (CE) {
int64_t Imm = CE->getValue();
- if (isUInt<7>(Imm)) {
+ if (isUInt<7>(Imm) && (Imm & 3) == 3) {
Operands.push_back(RISCVOperand::createImm(Res, S, E, isRV64()));
return MatchOperand_Success;
}
@@ -1534,8 +1534,8 @@ RISCVAsmParser::parseInsnDirectiveOpcode(OperandVector &Operands) {
break;
}
- Error(S, "opcode must be a valid opcode name or an immediate in the range "
- "[0, 127]");
+ Error(S, "opcode must be in the range [0, 127] and the lower 2 bits must be "
+ "0x3");
return MatchOperand_ParseFail;
}
diff --git a/llvm/test/MC/RISCV/insn-invalid.s b/llvm/test/MC/RISCV/insn-invalid.s
index 82fdd7b579eaf..ab41f07ef567f 100644
--- a/llvm/test/MC/RISCV/insn-invalid.s
+++ b/llvm/test/MC/RISCV/insn-invalid.s
@@ -14,7 +14,8 @@
.insn q 0x13, 0, a0, a1, 13, 14 # CHECK: :[[@LINE]]:7: error: invalid instruction format
# Invalid immediate
-.insn i 0x99, 0, a0, 4(a1) # CHECK: :[[@LINE]]:10: error: opcode must be in the range [0, 127]
+.insn i 0x99, 0, a0, 4(a1) # CHECK: :[[@LINE]]:10: error: opcode must be in the range [0, 127] and the lower 2 bits must be 0x3
+.insn i 0, 0, a0, 4(a1) # CHECK: :[[@LINE]]:10: error: opcode must be in the range [0, 127] and the lower 2 bits must be 0x3
.insn r 0x33, 8, 0, a0, a1, a2 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 7]
.insn r4 0x43, 0, 4, fa0, fa1, fa2, fa3 # CHECK: :[[@LINE]]:21: error: immediate must be an integer in the range [0, 3]
More information about the llvm-commits
mailing list