]> granicus.if.org Git - llvm/commitdiff
[ARM] Add diag string for movw/movt immediates in assembly
authorOliver Stannard <oliver.stannard@arm.com>
Wed, 4 Oct 2017 09:24:54 +0000 (09:24 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Wed, 4 Oct 2017 09:24:54 +0000 (09:24 +0000)
This adds diagnostics for invalid immediate operands to the MOVW and MOVT
instructions (ARM and Thumb).

Differential revision: https://reviews.llvm.org/D31879

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314888 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrInfo.td
test/MC/ARM/diagnostics.s
test/MC/ARM/thumb2-diagnostics.s

index af065441ec7da4fb9019114bda83ab49b1d633b0..c031f6ff7acf87ab720191bef6ad2b9d09ada8e8 100644 (file)
@@ -822,6 +822,7 @@ def imm0_65535_neg : Operand<i32>, ImmLeaf<i32, [{
 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> {
index 0f697e6b3672fe2ee6aab574604d810c6887ccd2..ca080cc947b458b686681cef504df697f89cc12d 100644 (file)
 
         @ 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:                 ^
 
 
         @ 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 32a00a75255f7ff77b2d88740e11e29f8bca10e1..67ce2423569ea3272e44cca402be4cd4033aba38 100644 (file)
 foo2:
         movw r0, foo2
         movt r0, foo2
+        movt r0, #0x10000
+        movt r0, #0x10000
 @ CHECK-ERRORS: error: 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