xref: /aosp_15_r20/external/llvm/test/MC/ARM/thumb2-diagnostics.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker@ RUN: not llvm-mc -triple=thumbv7-apple-darwin < %s 2> %t
2*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V7 < %t %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@ RUN: not llvm-mc -triple=thumbv8-apple-darwin < %s 2> %t
5*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V8 < %t %s
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@ Ill-formed IT block instructions.
8*9880d681SAndroid Build Coastguard Worker        itet eq
9*9880d681SAndroid Build Coastguard Worker        addle r0, r1, r2
10*9880d681SAndroid Build Coastguard Worker        nop
11*9880d681SAndroid Build Coastguard Worker        it le
12*9880d681SAndroid Build Coastguard Worker        iteeee gt
13*9880d681SAndroid Build Coastguard Worker        ittfe le
14*9880d681SAndroid Build Coastguard Worker        nopeq
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: incorrect condition in IT block; got 'le', but expected 'eq'
17*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         addle r0, r1, r2
18*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:            ^
19*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: incorrect condition in IT block; got 'al', but expected 'ne'
20*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         nop
21*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:            ^
22*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instructions in IT block must be predicable
23*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         it le
24*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         ^
25*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: too many conditions on IT instruction
26*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         iteeee gt
27*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:           ^
28*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: illegal IT block condition mask 'tfe'
29*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         ittfe le
30*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:           ^
31*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: predicated instructions must be in IT block
32*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         nopeq
33*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:         ^
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker        @ Out of range immediates for MRC/MRC2/MRRC/MRRC2
36*9880d681SAndroid Build Coastguard Worker        mrc  p14, #8, r1, c1, c2, #4
37*9880d681SAndroid Build Coastguard Worker        mrc  p14, #1, r1, c1, c2, #8
38*9880d681SAndroid Build Coastguard Worker        mrc2  p14, #8, r1, c1, c2, #4
39*9880d681SAndroid Build Coastguard Worker        mrc2  p14, #0, r1, c1, c2, #9
40*9880d681SAndroid Build Coastguard Worker        mrrc  p7, #16, r5, r4, c1
41*9880d681SAndroid Build Coastguard Worker        mrrc2  p7, #17, r5, r4, c1
42*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
43*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
44*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
45*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
46*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate operand must be in the range [0,15]
47*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS-V7: error: immediate operand must be in the range [0,15]
48*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS-V8: error: invalid operand for instruction
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker        isb  #-1
51*9880d681SAndroid Build Coastguard Worker        isb  #16
52*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate value out of range
53*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate value out of range
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker        itt eq
56*9880d681SAndroid Build Coastguard Worker        bkpteq #1
57*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction 'bkpt' is not predicable, but condition code specified
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker        nopeq
60*9880d681SAndroid Build Coastguard Worker        nopeq
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Worker@ out of range operands for Thumb2 targets
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Worker        beq.w  #-1048578
65*9880d681SAndroid Build Coastguard Worker        bne.w  #1048576
66*9880d681SAndroid Build Coastguard Worker        blt.w  #1013411
67*9880d681SAndroid Build Coastguard Worker        b.w    #-16777218
68*9880d681SAndroid Build Coastguard Worker        b.w    #16777216
69*9880d681SAndroid Build Coastguard Worker        b.w    #1592313
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
72*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
73*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
74*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
75*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
76*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: branch target out of range
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Workerfoo2:
79*9880d681SAndroid Build Coastguard Worker        mov r0, foo2
80*9880d681SAndroid Build Coastguard Worker        movw r0, foo2
81*9880d681SAndroid Build Coastguard Worker        movt r0, foo2
82*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
83*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:                 ^
84*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
85*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:                  ^
86*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
87*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS:                  ^
88*9880d681SAndroid Build Coastguard Worker
89*9880d681SAndroid Build Coastguard Worker        and sp, r1, #80008000
90*9880d681SAndroid Build Coastguard Worker        and pc, r1, #80008000
91*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
92*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard Worker        ssat r0, #1, r0, asr #32
95*9880d681SAndroid Build Coastguard Worker        usat r0, #1, r0, asr #32
96*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode
97*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode
98*9880d681SAndroid Build Coastguard Worker
99*9880d681SAndroid Build Coastguard Worker        @ PC is not valid as shifted-rGPR
100*9880d681SAndroid Build Coastguard Worker        sbc.w r2, r7, pc, lsr #16
101*9880d681SAndroid Build Coastguard Worker        and.w r2, r7, pc, lsr #16
102*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
103*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Worker
106*9880d681SAndroid Build Coastguard Worker        @ PC is not valid as base of load
107*9880d681SAndroid Build Coastguard Worker        ldr r0, [pc, r0]
108*9880d681SAndroid Build Coastguard Worker        ldrb r1, [pc, r2]
109*9880d681SAndroid Build Coastguard Worker        ldrh r3, [pc, r3]
110*9880d681SAndroid Build Coastguard Worker        pld r4, [pc, r5]
111*9880d681SAndroid Build Coastguard Worker        str r6, [pc, r7]
112*9880d681SAndroid Build Coastguard Worker        strb r7 [pc, r8]
113*9880d681SAndroid Build Coastguard Worker        strh r9, [pc, r10]
114*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction requires: arm-mode
115*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction requires: arm-mode
116*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction requires: arm-mode
117*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: invalid operand for instruction
118*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction requires: arm-mode
119*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: immediate value expected for vector index
120*9880d681SAndroid Build Coastguard Worker@ CHECK-ERRORS: error: instruction requires: arm-mode
121