1*d97f17a9SSimon Tatham// RUN: not llvm-mc --triple thumbv6m %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THUMB1 2*d97f17a9SSimon Tatham// RUN: not llvm-mc --triple thumbv7m %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THUMB2 3*d97f17a9SSimon Tatham 4*d97f17a9SSimon Tatham// This test checks reporting of errors of the form "you should have 5*d97f17a9SSimon Tatham// used :lower16: in this immediate field", during initial reading of 6*d97f17a9SSimon Tatham// the source file. 7*d97f17a9SSimon Tatham// 8*d97f17a9SSimon Tatham// For errors that are reported at object-file output time, see 9*d97f17a9SSimon Tatham// lower-upper-errors-2.s. 10*d97f17a9SSimon Tatham 11*d97f17a9SSimon Tatham// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb movs requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15: 12*d97f17a9SSimon Tathammovs r0, #foo 13*d97f17a9SSimon Tatham 14*d97f17a9SSimon Tatham// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb adds requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15: 15*d97f17a9SSimon Tathamadds r0, #foo 16*d97f17a9SSimon Tatham 17*d97f17a9SSimon Tatham// THUMB2: :[[@LINE+1]]:10: error: immediate expression for mov requires :lower16: or :upper16 18*d97f17a9SSimon Tathammovw r0, #foo 19*d97f17a9SSimon Tatham 20*d97f17a9SSimon Tatham// THUMB2: :[[@LINE+1]]:10: error: immediate expression for mov requires :lower16: or :upper16 21*d97f17a9SSimon Tathammovt r0, #foo 22*d97f17a9SSimon Tatham 23*d97f17a9SSimon Tatham// With a Thumb2 wide add instruction available, this case isn't an error 24*d97f17a9SSimon Tatham// while reading the source file. It only causes a problem when an object 25*d97f17a9SSimon Tatham// file is output, and it turns out there's no suitable relocation to ask 26*d97f17a9SSimon Tatham// for the value of an external symbol to be turned into a Thumb shifted 27*d97f17a9SSimon Tatham// immediate field. And in this case the other errors in this source file 28*d97f17a9SSimon Tatham// cause assembly to terminate before reaching the object-file output stage 29*d97f17a9SSimon Tatham// (even if a test run had had -filetype=obj). 30*d97f17a9SSimon Tatham 31*d97f17a9SSimon Tatham// THUMB1: :[[@LINE+2]]:14: error: Immediate expression for Thumb adds requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15: 32*d97f17a9SSimon Tatham// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error: 33*d97f17a9SSimon Tathamadds r0, r0, #foo 34*d97f17a9SSimon Tatham 35*d97f17a9SSimon Tatham// Similarly for this version, which _must_ be the wide encoding due 36*d97f17a9SSimon Tatham// to the use of a high register and the lack of flag-setting. 37*d97f17a9SSimon Tatham 38*d97f17a9SSimon Tatham// THUMB1: :[[@LINE+2]]:1: error: invalid instruction 39*d97f17a9SSimon Tatham// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error: 40*d97f17a9SSimon Tathamadd r9, r0, #foo 41*d97f17a9SSimon Tatham 42*d97f17a9SSimon Tatham// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb movs requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15: 43*d97f17a9SSimon Tathammovs r0, :lower16:#foo 44*d97f17a9SSimon Tatham 45*d97f17a9SSimon Tatham// This is invalid in either architecture: in Thumb1 it can't use a 46*d97f17a9SSimon Tatham// high register, and in Thumb2 it can't use :upper8_15:. But the 47*d97f17a9SSimon Tatham// Thumb2 case won't cause an error until output. 48*d97f17a9SSimon Tatham 49*d97f17a9SSimon Tatham// THUMB1: :[[@LINE+2]]:1: error: invalid instruction 50*d97f17a9SSimon Tatham// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error: 51*d97f17a9SSimon Tathammovs r11, :upper8_15:#foo 52