[llvm] 65d0264 - [MC][ARM] Reject Thumb "ror rX, #0"
Ryan Prichard via llvm-commits
llvm-commits at lists.llvm.org
Wed May 19 15:05:47 PDT 2021
Author: Ryan Prichard
Date: 2021-05-19T15:05:39-07:00
New Revision: 65d0264ba2e5770cceeda7ff8c3509c626cf0109
URL: https://github.com/llvm/llvm-project/commit/65d0264ba2e5770cceeda7ff8c3509c626cf0109
DIFF: https://github.com/llvm/llvm-project/commit/65d0264ba2e5770cceeda7ff8c3509c626cf0109.diff
LOG: [MC][ARM] Reject Thumb "ror rX, #0"
The ROR instruction can only handle immediates between 1 and 31. The
would-be encoding for ROR #0 is actually the RRX instruction.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D102455
Added:
Modified:
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/test/MC/ARM/thumb2-diagnostics.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMInstrThumb2.td b/llvm/lib/Target/ARM/ARMInstrThumb2.td
index d189b8e78987b..5f7cfa371ff10 100644
--- a/llvm/lib/Target/ARM/ARMInstrThumb2.td
+++ b/llvm/lib/Target/ARM/ARMInstrThumb2.td
@@ -2683,7 +2683,7 @@ def : T2Pat<(ARMusat (sra GPRnopc:$Rn, asr_imm:$shft), imm0_31:$pos),
defm t2LSL : T2I_sh_ir<0b00, "lsl", imm1_31, shl>;
defm t2LSR : T2I_sh_ir<0b01, "lsr", imm_sr, srl>;
defm t2ASR : T2I_sh_ir<0b10, "asr", imm_sr, sra>;
-defm t2ROR : T2I_sh_ir<0b11, "ror", imm0_31, rotr>;
+defm t2ROR : T2I_sh_ir<0b11, "ror", imm1_31, rotr>;
// LSL #0 is actually MOV, and has slightly
diff erent permitted registers to
// LSL with non-zero shift
diff --git a/llvm/test/MC/ARM/thumb2-diagnostics.s b/llvm/test/MC/ARM/thumb2-diagnostics.s
index 1154e5a9069a1..45efd3c62120c 100644
--- a/llvm/test/MC/ARM/thumb2-diagnostics.s
+++ b/llvm/test/MC/ARM/thumb2-diagnostics.s
@@ -49,6 +49,12 @@
@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,15]
@ CHECK-ERRORS-V8: invalid instruction
+ @ Out of range immediate for ROR.
+ @ (Assembling this instruction to "mov r1, r1" might also be OK.)
+ ror r1, r1, #0
+@ CHECK-ERRORS: invalid instruction
+@ CHECK-ERRORS: operand must be an immediate in the range [1,31]
+
isb #-1
isb #16
@ CHECK-ERRORS: error: immediate value out of range
More information about the llvm-commits
mailing list