brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · d97432b Raw
52 lines · plain
1// RUN: not llvm-mc --triple thumbv6m %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THUMB12// RUN: not llvm-mc --triple thumbv7m %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THUMB23 4// This test checks reporting of errors of the form "you should have5// used :lower16: in this immediate field", during initial reading of6// the source file.7//8// For errors that are reported at object-file output time, see9// lower-upper-errors-2.s.10 11// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb movs requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15:12movs r0, #foo13 14// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb adds requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15:15adds r0, #foo16 17// THUMB2: :[[@LINE+1]]:10: error: immediate expression for mov requires :lower16: or :upper1618movw r0, #foo19 20// THUMB2: :[[@LINE+1]]:10: error: immediate expression for mov requires :lower16: or :upper1621movt r0, #foo22 23// With a Thumb2 wide add instruction available, this case isn't an error24// while reading the source file. It only causes a problem when an object25// file is output, and it turns out there's no suitable relocation to ask26// for the value of an external symbol to be turned into a Thumb shifted27// immediate field. And in this case the other errors in this source file28// cause assembly to terminate before reaching the object-file output stage29// (even if a test run had had -filetype=obj).30 31// THUMB1: :[[@LINE+2]]:14: error: Immediate expression for Thumb adds requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15:32// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error:33adds r0, r0, #foo34 35// Similarly for this version, which _must_ be the wide encoding due36// to the use of a high register and the lack of flag-setting.37 38// THUMB1: :[[@LINE+2]]:1: error: invalid instruction39// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error:40add r9, r0, #foo41 42// CHECK: :[[@LINE+1]]:10: error: Immediate expression for Thumb movs requires :lower0_7:, :lower8_15:, :upper0_7: or :upper8_15:43movs r0, :lower16:#foo44 45// This is invalid in either architecture: in Thumb1 it can't use a46// high register, and in Thumb2 it can't use :upper8_15:. But the47// Thumb2 case won't cause an error until output.48 49// THUMB1: :[[@LINE+2]]:1: error: invalid instruction50// THUMB2-NOT: :[[@LINE+1]]:{{[0-9]+}}: error:51movs r11, :upper8_15:#foo52