[PATCH] D31879: [ARM] Add diag string for movw/movt immediates in assembly
Oliver Stannard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 11:07:42 PDT 2017
olista01 created this revision.
Herald added a subscriber: aemerson.
This adds diagnostics for invalid immediate operands to the MOVW and MOVT instructions (ARM and Thumb).
This depends on https://reviews.llvm.org/D31607 (and it's dependencies), which added the mechanism to table-generate these diagnostic messages.
Repository:
rL LLVM
https://reviews.llvm.org/D31879
Files:
lib/Target/ARM/ARMInstrInfo.td
test/MC/ARM/diagnostics.s
test/MC/ARM/thumb2-diagnostics.s
Index: test/MC/ARM/thumb2-diagnostics.s
===================================================================
--- test/MC/ARM/thumb2-diagnostics.s
+++ test/MC/ARM/thumb2-diagnostics.s
@@ -81,13 +81,17 @@
mov r0, foo2
movw r0, foo2
movt r0, foo2
+ movt r0, #0x10000
+ movt r0, #0x10000
@ CHECK-ERRORS: error: invalid instruction, multiple near-miss encodings found
@ CHECK-ERRORS: instruction requires: arm-mode
@ CHECK-ERRORS: note: for one encoding: immediate operand must be in the range [256,65535]
@ CHECK-ERRORS: immediate expression for mov requires :lower16: or :upper16
@ CHECK-ERRORS: ^
@ CHECK-ERRORS: immediate expression for mov requires :lower16: or :upper16
@ CHECK-ERRORS: ^
+@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
+@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
and sp, r1, #80008000
and pc, r1, #80008000
Index: test/MC/ARM/diagnostics.s
===================================================================
--- test/MC/ARM/diagnostics.s
+++ test/MC/ARM/diagnostics.s
@@ -173,7 +173,7 @@
@ Out of range immediate for MOV
movw r9, 0x10000
-@ CHECK-ERRORS: error: invalid operand for instruction
+@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
@ CHECK-ERRORS: movw r9, 0x10000
@ CHECK-ERRORS: ^
@@ -185,7 +185,7 @@
@ Out of range immediate for MOVT
movt r9, 0x10000
-@ CHECK-ERRORS: error: invalid operand for instruction
+@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
@ CHECK-ERRORS: movt r9, 0x10000
@ CHECK-ERRORS: ^
Index: lib/Target/ARM/ARMInstrInfo.td
===================================================================
--- lib/Target/ARM/ARMInstrInfo.td
+++ lib/Target/ARM/ARMInstrInfo.td
@@ -806,6 +806,7 @@
def Imm0_65535ExprAsmOperand: AsmOperandClass {
let Name = "Imm0_65535Expr";
let RenderMethod = "addImmOperands";
+ let DiagnosticString = "operand must be an immediate in the range [0,0xffff] or a relocatable expression";
}
def imm0_65535_expr : Operand<i32> {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31879.94659.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/0f1a4b2e/attachment.bin>
More information about the llvm-commits
mailing list