Skip to content

Commit

Permalink
Revert "foo"
Browse files Browse the repository at this point in the history
This reverts commit 4fde20b.

I failed to squash this
  • Loading branch information
topperc committed Mar 27, 2023
1 parent ca70cee commit 39b64ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion llvm/test/MC/RISCV/insn-invalid.s
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 39b64ad

Please sign in to comment.