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=thumbv7m < %s 2> %t
6 @ RUN: FileCheck --check-prefix=CHECK-ERRORS-V7M < %t %s
7 @ RUN: not llvm-mc -triple=thumbv8 < %s 2> %t
8 @ RUN: FileCheck --check-prefix=CHECK-ERRORS-V8 < %t %s
10 @ Check for various assembly diagnostic messages on invalid input.
12 @ ADD instruction w/o 'S' suffix.
14 @ CHECK-ERRORS: error: invalid instruction
15 @ CHECK-ERRORS: add r1, r2, r3
18 @ Instructions which require v6+ for both registers to be low regs.
21 @ CHECK-ERRORS: error: instruction variant requires Thumb2
22 @ CHECK-ERRORS: add r2, r3
24 @ CHECK-ERRORS-V5: error: instruction variant requires ARMv6 or later
25 @ CHECK-ERRORS-V5: mov r2, r3
29 @ Out of range immediates for ASR instruction.
31 @ CHECK-ERRORS: error: invalid operand for instruction
32 @ CHECK-ERRORS: asrs r2, r3, #33
35 @ Out of range immediates for BKPT instruction.
38 error: invalid operand for instruction
41 error: invalid operand for instruction
45 @ Out of range immediates for v8 HLT instruction.
48 @CHECK-ERRORS: error: instruction requires: armv8 arm-mode
49 @CHECK-ERRORS: hlt #64
51 @CHECK-ERRORS-V8: error: instruction requires: arm-mode
52 @CHECK-ERRORS-V8: hlt #64
54 @CHECK-ERRORS: error: invalid operand for instruction
55 @CHECK-ERRORS: hlt #-1
58 @ Invalid writeback and register lists for LDM
62 ldm r2!, {r2, r3, r4, r10}
63 ldmdb r2!, {r2, r3, r4}
66 ldmia r0!, {r2-r3, sp}
67 ldmfd r2, {r1, r3-r6, sp}
68 ldmfd r2!, {r1, r3-r6, sp}
69 ldmdb r1, {r2, r3, sp}
70 ldmdb r1!, {r2, r3, sp}
72 @ CHECK-ERRORS: error: registers must be in range r0-r7
73 @ CHECK-ERRORS: ldm r2!, {r5, r8}
75 @ CHECK-ERRORS: error: writeback operator '!' expected
76 @ CHECK-ERRORS: ldm r2, {r5, r7}
78 @ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
79 @ CHECK-ERRORS: ldm r2!, {r2, r3, r4}
81 @ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
82 @ CHECK-ERRORS-V8: ldm r2!, {r2, r3, r4, r10}
84 @ CHECK-ERRORS-V8: error: writeback register not allowed in register list
85 @ CHECK-ERRORS-V8: ldmdb r2!, {r2, r3, r4}
87 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
88 @ CHECK-ERRORS-V7M: ldm r0, {r2, sp}
90 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
91 @ CHECK-ERRORS-V7M: ldmia r0, {r2-r3, sp}
93 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
94 @ CHECK-ERRORS-V7M: ldmia r0!, {r2-r3, sp}
96 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
97 @ CHECK-ERRORS-V7M: ldmfd r2, {r1, r3-r6, sp}
99 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
100 @ CHECK-ERRORS-V7M: ldmfd r2!, {r1, r3-r6, sp}
101 @ CHECK-ERRORS-V7M: ^
102 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
103 @ CHECK-ERRORS-V7M: ldmdb r1, {r2, r3, sp}
104 @ CHECK-ERRORS-V7M: ^
105 @ CHECK-ERRORS-V7M: error: SP not allowed in register list
106 @ CHECK-ERRORS-V7M: ldmdb r1!, {r2, r3, sp}
107 @ CHECK-ERRORS-V7M: ^
108 @ CHECK-ERRORS-V7M: error: LR not allowed in the list, when PC is in the register list
109 @ CHECK-ERRORS-V7M: ldm r2, {r5, lr, pc}
110 @ CHECK-ERRORS-V7M: ^
112 @ Invalid writeback and register lists for PUSH/POP
118 @ CHECK-ERRORS: error: registers must be in range r0-r7 or pc
119 @ CHECK-ERRORS: pop {r1, r2, r10}
121 @ CHECK-ERRORS-V7M: error: LR not allowed in the list, when PC is in the register list
122 @ CHECK-ERRORS-V7M: pop {r1, r2, lr, pc}
123 @ CHECK-ERRORS-V7M: ^
124 @ CHECK-ERRORS: error: registers must be in range r0-r7 or lr
125 @ CHECK-ERRORS: push {r8, r9}
127 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
128 @ CHECK-ERRORS-V7M: push {r8, r9, sp}
129 @ CHECK-ERRORS-V7M: ^
130 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
131 @ CHECK-ERRORS-V7M: push {r8, r9, pc}
132 @ CHECK-ERRORS-V7M: ^
135 @ Invalid writeback and register lists for STM
141 stmia r4!, {r0-r3, sp}
142 stmdb r1, {r2, r3, sp}
143 stmdb r1!, {r2, r3, sp}
144 stmia r4, {r2, sp, pc}
145 stmdb r1!, {r2, r3, pc}
146 @ CHECK-ERRORS: error: instruction requires: thumb2
147 @ CHECK-ERRORS: stm r1, {r2, r6}
149 @ CHECK-ERRORS: error: registers must be in range r0-r7
150 @ CHECK-ERRORS: stm r1!, {r2, r9}
152 @ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
153 @ CHECK-ERRORS-V8: stm r2!, {r2, r9}
155 @ CHECK-ERRORS-V8: error: writeback register not allowed in register list
156 @ CHECK-ERRORS-V8: stmdb r2!, {r0, r2}
158 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
159 @ CHECK-ERRORS-V7M: stm r1!, {r2, sp}
160 @ CHECK-ERRORS-V7M: ^
161 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
162 @ CHECK-ERRORS-V7M: stmia r4!, {r0-r3, sp}
163 @ CHECK-ERRORS-V7M: ^
164 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
165 @ CHECK-ERRORS-V7M: stmdb r1, {r2, r3, sp}
166 @ CHECK-ERRORS-V7M: ^
167 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
168 @ CHECK-ERRORS-V7M: stmdb r1!, {r2, r3, sp}
169 @ CHECK-ERRORS-V7M: ^
170 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
171 @ CHECK-ERRORS-V7M: stmia r4, {r2, sp, pc}
172 @ CHECK-ERRORS-V7M: ^
173 @ CHECK-ERRORS-V7M: error: SP, PC not allowed in register list
174 @ CHECK-ERRORS-V7M: stmdb r1!, {r2, r3, pc}
175 @ CHECK-ERRORS-V7M: ^
177 @ Out of range immediates for LSL instruction.
180 @ CHECK-ERRORS: error: invalid operand for instruction
181 @ CHECK-ERRORS: lsls r4, r5, #-1
183 @ CHECK-ERRORS: error: invalid operand for instruction
184 @ CHECK-ERRORS: lsls r4, r5, #32
187 @ Mismatched source/destination operands for MUL instruction.
189 @ CHECK-ERRORS: error: destination register must match source register
190 @ CHECK-ERRORS: muls r1, r2, r3
194 @ Out of range immediates for STR instruction.
198 @ CHECK-ERRORS: error: instruction requires: thumb2
199 @ CHECK-ERRORS: str r2, [r7, #-1]
201 @ CHECK-ERRORS: error: instruction requires: thumb2
202 @ CHECK-ERRORS: str r5, [r1, #3]
204 @ CHECK-ERRORS: error: instruction requires: thumb2
205 @ CHECK-ERRORS: str r3, [r7, #128]
208 @ Out of range immediate for SVC instruction.
211 @ CHECK-ERRORS: error: invalid operand for instruction
212 @ CHECK-ERRORS: svc #-1
214 @ CHECK-ERRORS: error: instruction requires: arm-mode
215 @ CHECK-ERRORS: svc #256
219 @ Out of range immediate for ADD SP instructions
224 @ CHECK-ERRORS: error: instruction requires: thumb2
225 @ CHECK-ERRORS: add sp, #-1
227 @ CHECK-ERRORS: error: instruction requires: thumb2
228 @ CHECK-ERRORS: add sp, #3
230 @ CHECK-ERRORS: error: instruction requires: thumb2
231 @ CHECK-ERRORS: add sp, sp, #512
233 @ CHECK-ERRORS: error: instruction requires: thumb2
234 @ CHECK-ERRORS: add r2, sp, #1024
238 @ CHECK-ERRORS: error: source register must be the same as destination
239 @ CHECK-ERRORS: add r2, sp, ip
243 @------------------------------------------------------------------------------
244 @ B/Bcc - out of range immediates for Thumb1 branches
245 @------------------------------------------------------------------------------
254 @ CHECK-ERRORS: error: branch target out of range
255 @ CHECK-ERRORS: error: branch target out of range
256 @ CHECK-ERRORS: error: branch target out of range
257 @ CHECK-ERRORS: error: branch target out of range
258 @ CHECK-ERRORS: error: branch target out of range
259 @ CHECK-ERRORS: error: branch target out of range
261 @------------------------------------------------------------------------------
262 @ WFE/WFI/YIELD - are not supported pre v6T2
263 @------------------------------------------------------------------------------
268 @ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
271 @ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
274 @ CHECK-ERRORS: error: instruction requires: armv6m or armv6t2
275 @ CHECK-ERRORS: yield
278 @------------------------------------------------------------------------------
279 @ PLDW required mp-extensions
280 @------------------------------------------------------------------------------
282 @ CHECK-ERRORS: error: instruction requires: mp-extensions
284 @------------------------------------------------------------------------------
285 @ LDR(lit) - invalid offsets
286 @------------------------------------------------------------------------------
289 @ CHECK-ERRORS: error: instruction requires: thumb2
291 @------------------------------------------------------------------------------
292 @ STC2{L}/LDC2{L} - requires thumb2
293 @------------------------------------------------------------------------------
294 stc2 p0, c8, [r1, #4]
295 stc2l p6, c2, [r7, #4]
296 ldc2 p0, c8, [r1, #4]
297 ldc2l p6, c2, [r7, #4]
298 @ CHECK-ERRORS: error: invalid operand for instruction
299 @ CHECK-ERRORS: error: invalid operand for instruction
300 @ CHECK-ERRORS: error: invalid operand for instruction
301 @ CHECK-ERRORS: error: invalid operand for instruction