• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@ RUN: not llvm-mc -triple=thumbv6-apple-darwin < %s 2> %t
2@ RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s
3@ RUN: not llvm-mc -triple=thumbv5-apple-darwin < %s 2> %t
4@ RUN: FileCheck --check-prefix=CHECK-ERRORS-V5 < %t %s
5@ RUN: not llvm-mc -triple=thumbv8 < %s 2> %t
6@ RUN: FileCheck --check-prefix=CHECK-ERRORS-V8 < %t %s
7
8@ Check for various assembly diagnostic messages on invalid input.
9
10@ ADD instruction w/o 'S' suffix.
11        add r1, r2, r3
12@ CHECK-ERRORS: error: invalid instruction
13@ CHECK-ERRORS:         add r1, r2, r3
14@ CHECK-ERRORS:         ^
15
16@ Instructions which require v6+ for both registers to be low regs.
17        add r2, r3
18        mov r2, r3
19@ CHECK-ERRORS: error: instruction variant requires Thumb2
20@ CHECK-ERRORS:         add r2, r3
21@ CHECK-ERRORS:         ^
22@ CHECK-ERRORS-V5: error: instruction variant requires ARMv6 or later
23@ CHECK-ERRORS-V5:         mov r2, r3
24@ CHECK-ERRORS-V5:         ^
25
26
27@ Out of range immediates for ASR instruction.
28        asrs r2, r3, #33
29@ CHECK-ERRORS: error: invalid operand for instruction
30@ CHECK-ERRORS:         asrs r2, r3, #33
31@ CHECK-ERRORS:                      ^
32
33@ Out of range immediates for BKPT instruction.
34        bkpt #256
35        bkpt #-1
36error: invalid operand for instruction
37        bkpt #256
38             ^
39error: invalid operand for instruction
40        bkpt #-1
41             ^
42
43@ Out of range immediates for v8 HLT instruction.
44        hlt #64
45        hlt #-1
46@CHECK-ERRORS: error: instruction requires: armv8 arm-mode
47@CHECK-ERRORS:        hlt #64
48@CHECK-ERRORS:        ^
49@CHECK-ERRORS-V8: error: instruction requires: arm-mode
50@CHECK-ERRORS-V8:         hlt #64
51@CHECK-ERRORS-V8:              ^
52@CHECK-ERRORS: error: invalid operand for instruction
53@CHECK-ERRORS:         hlt #-1
54@CHECK-ERRORS:              ^
55
56@ Invalid writeback and register lists for LDM
57        ldm r2!, {r5, r8}
58        ldm r2, {r5, r7}
59        ldm r2!, {r2, r3, r4}
60        ldm r2!, {r2, r3, r4, r10}
61        ldmdb r2!, {r2, r3, r4}
62@ CHECK-ERRORS: error: registers must be in range r0-r7
63@ CHECK-ERRORS:         ldm r2!, {r5, r8}
64@ CHECK-ERRORS:                  ^
65@ CHECK-ERRORS: error: writeback operator '!' expected
66@ CHECK-ERRORS:         ldm r2, {r5, r7}
67@ CHECK-ERRORS:             ^
68@ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
69@ CHECK-ERRORS:         ldm r2!, {r2, r3, r4}
70@ CHECK-ERRORS:               ^
71@ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
72@ CHECK-ERRORS-V8:         ldm r2!, {r2, r3, r4, r10}
73@ CHECK-ERRORS-V8:               ^
74@ CHECK-ERRORS-V8: error: writeback register not allowed in register list
75@ CHECK-ERRORS-V8:         ldmdb r2!, {r2, r3, r4}
76@ CHECK-ERRORS-V8:                 ^
77
78@ Invalid writeback and register lists for PUSH/POP
79        pop {r1, r2, r10}
80        push {r8, r9}
81@ CHECK-ERRORS: error: registers must be in range r0-r7 or pc
82@ CHECK-ERRORS:         pop {r1, r2, r10}
83@ CHECK-ERRORS:             ^
84@ CHECK-ERRORS: error: registers must be in range r0-r7 or lr
85@ CHECK-ERRORS:         push {r8, r9}
86@ CHECK-ERRORS:              ^
87
88
89@ Invalid writeback and register lists for STM
90        stm r1, {r2, r6}
91        stm r1!, {r2, r9}
92        stm r2!, {r2, r9}
93        stmdb r2!, {r0, r2}
94@ CHECK-ERRORS: error: instruction requires: thumb2
95@ CHECK-ERRORS:         stm r1, {r2, r6}
96@ CHECK-ERRORS:         ^
97@ CHECK-ERRORS: error: registers must be in range r0-r7
98@ CHECK-ERRORS:         stm r1!, {r2, r9}
99@ CHECK-ERRORS:                  ^
100@ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
101@ CHECK-ERRORS-V8:         stm r2!, {r2, r9}
102@ CHECK-ERRORS-V8:                  ^
103@ CHECK-ERRORS-V8: error: writeback register not allowed in register list
104@ CHECK-ERRORS-V8:         stmdb r2!, {r0, r2}
105@ CHECK-ERRORS-V8:                  ^
106
107@ Out of range immediates for LSL instruction.
108        lsls r4, r5, #-1
109        lsls r4, r5, #32
110@ CHECK-ERRORS: error: invalid operand for instruction
111@ CHECK-ERRORS:         lsls r4, r5, #-1
112@ CHECK-ERRORS:                      ^
113@ CHECK-ERRORS: error: invalid operand for instruction
114@ CHECK-ERRORS:         lsls r4, r5, #32
115@ CHECK-ERRORS:                      ^
116
117@ Mismatched source/destination operands for MUL instruction.
118        muls r1, r2, r3
119@ CHECK-ERRORS: error: destination register must match source register
120@ CHECK-ERRORS:         muls r1, r2, r3
121@ CHECK-ERRORS:              ^
122
123
124@ Out of range immediates for STR instruction.
125        str r2, [r7, #-1]
126        str r5, [r1, #3]
127        str r3, [r7, #128]
128@ CHECK-ERRORS: error: instruction requires: thumb2
129@ CHECK-ERRORS:         str r2, [r7, #-1]
130@ CHECK-ERRORS:         ^
131@ CHECK-ERRORS: error: instruction requires: thumb2
132@ CHECK-ERRORS:         str r5, [r1, #3]
133@ CHECK-ERRORS:         ^
134@ CHECK-ERRORS: error: instruction requires: thumb2
135@ CHECK-ERRORS:         str r3, [r7, #128]
136@ CHECK-ERRORS:         ^
137
138@ Out of range immediate for SVC instruction.
139        svc #-1
140        svc #256
141@ CHECK-ERRORS: error: invalid operand for instruction
142@ CHECK-ERRORS:         svc #-1
143@ CHECK-ERRORS:             ^
144@ CHECK-ERRORS: error: instruction requires: arm-mode
145@ CHECK-ERRORS:         svc #256
146@ CHECK-ERRORS:         ^
147
148
149@ Out of range immediate for ADD SP instructions
150        add sp, #-1
151        add sp, #3
152        add sp, sp, #512
153        add r2, sp, #1024
154@ CHECK-ERRORS: error: instruction requires: thumb2
155@ CHECK-ERRORS:         add sp, #-1
156@ CHECK-ERRORS:                 ^
157@ CHECK-ERRORS: error: instruction requires: thumb2
158@ CHECK-ERRORS:         add sp, #3
159@ CHECK-ERRORS:                 ^
160@ CHECK-ERRORS: error: instruction requires: thumb2
161@ CHECK-ERRORS:         add sp, sp, #512
162@ CHECK-ERRORS:                     ^
163@ CHECK-ERRORS: error: instruction requires: arm-mode
164@ CHECK-ERRORS:         add r2, sp, #1024
165@ CHECK-ERRORS:         ^
166
167        add r2, sp, ip
168@ CHECK-ERRORS: error: source register must be the same as destination
169@ CHECK-ERRORS:         add r2, sp, ip
170@ CHECK-ERRORS:                     ^
171
172
173@------------------------------------------------------------------------------
174@ B/Bcc - out of range immediates for Thumb1 branches
175@------------------------------------------------------------------------------
176
177        beq    #-258
178        bne    #256
179        bgt    #13
180        b      #-1048578
181        b      #1048576
182        b      #10323
183
184@ CHECK-ERRORS: error: branch target out of range
185@ CHECK-ERRORS: error: branch target out of range
186@ CHECK-ERRORS: error: branch target out of range
187@ CHECK-ERRORS: error: branch target out of range
188@ CHECK-ERRORS: error: branch target out of range
189@ CHECK-ERRORS: error: branch target out of range
190
191@------------------------------------------------------------------------------
192@ WFE/WFI/YIELD - are not supported pre v6T2
193@------------------------------------------------------------------------------
194        wfe
195        wfi
196        yield
197
198@ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
199@ CHECK-ERRORS: wfe
200@ CHECK-ERRORS: ^
201@ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
202@ CHECK-ERRORS: wfi
203@ CHECK-ERRORS: ^
204@ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
205@ CHECK-ERRORS: yield
206@ CHECK-ERRORS: ^
207
208@------------------------------------------------------------------------------
209@ PLDW required mp-extensions
210@------------------------------------------------------------------------------
211        pldw [r0, #4]
212@ CHECK-ERRORS: error: instruction requires: mp-extensions
213
214@------------------------------------------------------------------------------
215@ LDR(lit) - invalid offsets
216@------------------------------------------------------------------------------
217
218        ldr r4, [pc, #-12]
219@ CHECK-ERRORS: error: instruction requires: thumb2
220
221