From 0d63fd34766900164f0e4e87f9b48283cf6b5fc3 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Tue, 14 Mar 2017 13:50:10 +0000 Subject: [PATCH] [ARM] Diagnose ARM MOVT without :lower16: or :upper16: expression This instruction was missing from the list of opcodes that we check, so we were hitting an llvm_unreachable in ARMMCCodeEmitter.cpp for the ARM MOVT instruction, rather than the diagnostic that is emitted for the other MOVW/MOVT instructions. Differential revision: https://reviews.llvm.org/D30936 llvm-svn: 297739 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 1 + test/MC/ARM/diagnostics.s | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index f20ee1b91ac..1a6f8e763e2 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -6682,6 +6682,7 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst, break; } case ARM::MOVi16: + case ARM::MOVTi16: case ARM::t2MOVi16: case ARM::t2MOVTi16: { diff --git a/test/MC/ARM/diagnostics.s b/test/MC/ARM/diagnostics.s index a1dd95f7d7f..549b13b7d42 100644 --- a/test/MC/ARM/diagnostics.s +++ b/test/MC/ARM/diagnostics.s @@ -491,9 +491,12 @@ foo2: mov r0, foo2 movw r0, foo2 + movt r0, foo2 @ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16 @ CHECK-ERRORS: ^ @ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16 +@ CHECK-ERRORS: ^ +@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16 @ CHECK-ERRORS: ^ str r0, [r0, #4]!