1@ RUN: not llvm-mc -triple=armv7-apple-darwin < %s 2> %t
2@ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V7 < %t %s
3@ RUN: not llvm-mc -triple=armv8 < %s 2> %t
4@ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V8 < %t %s
5
6@ Check for various assembly diagnostic messages on invalid input.
7
8@ 's' bit on an instruction that can't accept it.
9        mlss r1, r2, r3, r4
10@ CHECK-ERRORS: error: instruction 'mls' can not set flags,
11@ CHECK-ERRORS: but 's' suffix specified
12
13
14        @ Out of range shift immediate values.
15        adc r1, r2, r3, lsl #invalid
16        adc r4, r5, r6, lsl #-1
17        adc r4, r5, r6, lsl #32
18        adc r4, r5, r6, lsr #-1
19        adc r4, r5, r6, lsr #33
20        adc r4, r5, r6, asr #-1
21        adc r4, r5, r6, asr #33
22        adc r4, r5, r6, ror #-1
23        adc r4, r5, r6, ror #32
24
25@ CHECK-ERRORS: error: invalid immediate shift value
26@ CHECK-ERRORS:         adc r1, r2, r3, lsl #invalid
27@ CHECK-ERRORS:                              ^
28@ CHECK-ERRORS: error: immediate shift value out of range
29@ CHECK-ERRORS:         adc r4, r5, r6, lsl #-1
30@ CHECK-ERRORS:                              ^
31@ CHECK-ERRORS: error: immediate shift value out of range
32@ CHECK-ERRORS:         adc r4, r5, r6, lsl #32
33@ CHECK-ERRORS:                              ^
34@ CHECK-ERRORS: error: immediate shift value out of range
35@ CHECK-ERRORS:         adc r4, r5, r6, lsr #-1
36@ CHECK-ERRORS:                              ^
37@ CHECK-ERRORS: error: immediate shift value out of range
38@ CHECK-ERRORS:         adc r4, r5, r6, lsr #33
39@ CHECK-ERRORS:                              ^
40@ CHECK-ERRORS: error: immediate shift value out of range
41@ CHECK-ERRORS:         adc r4, r5, r6, asr #-1
42@ CHECK-ERRORS:                              ^
43@ CHECK-ERRORS: error: immediate shift value out of range
44@ CHECK-ERRORS:         adc r4, r5, r6, asr #33
45@ CHECK-ERRORS:                              ^
46@ CHECK-ERRORS: error: immediate shift value out of range
47@ CHECK-ERRORS:         adc r4, r5, r6, ror #-1
48@ CHECK-ERRORS:                              ^
49@ CHECK-ERRORS: error: immediate shift value out of range
50@ CHECK-ERRORS:         adc r4, r5, r6, ror #32
51
52        @ Out of range shift immediate values for load/store.
53        str r1, [r2, r3, lsl #invalid]
54        ldr r4, [r5], r6, lsl #-1
55        pld r4, [r5, r6, lsl #32]
56        str r4, [r5], r6, lsr #-1
57        ldr r4, [r5, r6, lsr #33]
58        pld r4, [r5, r6, asr #-1]
59        str r4, [r5, r6, asr #33]
60        ldr r4, [r5, r6, ror #-1]
61        pld r4, [r5, r6, ror #32]
62        pld r4, [r5, r6, rrx #0]
63        ldr r4, [r5, r6, not_a_shift]
64
65@ CHECK-ERRORS: error: shift amount must be an immediate
66@ CHECK-ERRORS:         str r1, [r2, r3, lsl #invalid]
67@ CHECK-ERRORS:                              ^
68@ CHECK-ERRORS: error: immediate shift value out of range
69@ CHECK-ERRORS:         ldr r4, [r5], r6, lsl #-1
70@ CHECK-ERRORS:                              ^
71@ CHECK-ERRORS: error: immediate shift value out of range
72@ CHECK-ERRORS:         pld r4, [r5, r6, lsl #32]
73@ CHECK-ERRORS:                              ^
74@ CHECK-ERRORS: error: immediate shift value out of range
75@ CHECK-ERRORS:         str r4, [r5], r6, lsr #-1
76@ CHECK-ERRORS:                              ^
77@ CHECK-ERRORS: error: immediate shift value out of range
78@ CHECK-ERRORS:         ldr r4, [r5, r6, lsr #33]
79@ CHECK-ERRORS:                              ^
80@ CHECK-ERRORS: error: immediate shift value out of range
81@ CHECK-ERRORS:         pld r4, [r5, r6, asr #-1]
82@ CHECK-ERRORS:                              ^
83@ CHECK-ERRORS: error: immediate shift value out of range
84@ CHECK-ERRORS:         str r4, [r5, r6, asr #33]
85@ CHECK-ERRORS:                              ^
86@ CHECK-ERRORS: error: immediate shift value out of range
87@ CHECK-ERRORS:         ldr r4, [r5, r6, ror #-1]
88@ CHECK-ERRORS:                              ^
89@ CHECK-ERRORS: error: immediate shift value out of range
90@ CHECK-ERRORS:         pld r4, [r5, r6, ror #32]
91@ CHECK-ERRORS: error: ']' expected
92@ CHECK-ERRORS:         pld r4, [r5, r6, rrx #0]
93@ CHECK-ERRORS: error: illegal shift operator
94@ CHECK-ERRORS:         ldr r4, [r5, r6, not_a_shift]
95
96        @ Out of range 16-bit immediate on BKPT
97        bkpt #65536
98
99@ CHECK-ERRORS: error: invalid instruction, any one of the following would fix this:
100@ CHECK-ERRORS: note: operand must be an immediate in the range [0,65535]
101@ CHECK-ERRORS: note: too many operands for instruction
102@ CHECK-ERRORS:         bkpt #65536
103@ CHECK-ERRORS:              ^
104
105        @ Out of range immediates for v8 HLT instruction.
106        hlt #65536
107        hlt #-1
108@CHECK-ERRORS-V7: error: invalid instruction
109@CHECK-ERRORS-V8: error: operand must be an immediate in the range [0,65535]
110@CHECK-ERRORS:         hlt #65536
111@CHECK-ERRORS:              ^
112@CHECK-ERRORS-V7: error: invalid instruction
113@CHECK-ERRORS-V8: error: operand must be an immediate in the range [0,65535]
114@CHECK-ERRORS:         hlt #-1
115@CHECK-ERRORS:             ^
116
117        @ Illegal condition code for v8 HLT instruction.
118        hlteq #2
119        hltlt #23
120@CHECK-ERRORS: error: instruction 'hlt' is not predicable, but condition code specified
121@CHECK-ERRORS:        hlteq #2
122@CHECK-ERRORS:        ^
123@CHECK-ERRORS: error: instruction 'hlt' is not predicable, but condition code specified
124@CHECK-ERRORS:        hltlt #23
125@CHECK-ERRORS:        ^
126
127        @ Out of range 4 and 3 bit immediates on CDP[2]
128
129        @ Out of range immediates for CDP/CDP2
130        cdp  p7, #2, c1, c1, c1, #8
131        cdp  p7, #1, c1, c1, c1, #8
132        cdp2  p7, #2, c1, c1, c1, #8
133        cdp2  p7, #1, c1, c1, c1, #8
134
135@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,7]
136@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,7]
137@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,7]
138@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,7]
139@ CHECK-ERRORS-V8: error: invalid instruction
140@ CHECK-ERRORS-V8: error: invalid instruction
141@ CHECK-ERRORS-V8: error: invalid instruction
142@ CHECK-ERRORS-V8: error: invalid instruction
143
144        @ Out of range immediates for DBG
145        dbg #-1
146        dbg #16
147
148@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,15]
149@ CHECK-ERRORS-V7: error: operand must be an immediate in the range [0,15]
150@ CHECK-ERRORS-V8: error: operand must be an immediate in the range [0,15]
151@ CHECK-ERRORS-V8: error: operand must be an immediate in the range [0,15]
152@  Double-check that we're synced up with the right diagnostics.
153@ CHECK-ERRORS: dbg #16
154@ CHECK-ERRORS:     ^
155
156        @ Out of range immediate for MCR/MCR2/MCRR/MCRR2
157        mcr  p7, #8, r5, c1, c1, #4
158        mcr  p7, #2, r5, c1, c1, #8
159        mcr2  p7, #8, r5, c1, c1, #4
160        mcr2  p7, #1, r5, c1, c1, #8
161        mcrr  p7, #16, r5, r4, c1
162        mcrr2  p7, #16, r5, r4, c1
163@ CHECK-ERRORS: operand must be an immediate in the range [0,7]
164@ CHECK-ERRORS: operand must be an immediate in the range [0,7]
165@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,7]
166@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,7]
167@ CHECK-ERRORS-V8: invalid instruction
168@ CHECK-ERRORS-V8: too many operands for instruction
169@ CHECK-ERRORS: operand must be an immediate in the range [0,15]
170@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,15]
171@ CHECK-ERRORS-V8: invalid instruction
172
173        @ p10 and p11 are reserved for NEON
174        mcr p10, #2, r5, c1, c1, #4
175        mcrr p11, #8, r5, r4, c1
176@ CHECK-ERRORS: error: invalid operand for instruction
177@ CHECK-ERRORS: error: invalid operand for instruction
178
179        @ Out of range immediate for MOV
180        movw r9, 0x10000
181@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
182@ CHECK-ERRORS:        movw r9, 0x10000
183@ CHECK-ERRORS:                 ^
184
185        @ Invalid 's' bit usage for MOVW
186        movs r6, #0xffff
187        movwseq r9, #0xffff
188@ CHECK-ERRORS: error: invalid instruction, any one of the following would fix this:
189@ CHECK-ERRORS-NEXT: movs r6, #0xffff
190@ CHECK-ERRORS: note: invalid operand for instruction
191@ CHECK-ERRORS: note: operand must be a register in range [r0, r15]
192@ CHECK-ERRORS: error: instruction 'movw' can not set flags, but 's' suffix specified
193@ CHECK-ERRORS-NEXT: movwseq r9, #0xffff
194
195        @ Out of range immediate for MOVT
196        movt r9, 0x10000
197@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffff] or a relocatable expression
198@ CHECK-ERRORS:        movt r9, 0x10000
199@ CHECK-ERRORS:                 ^
200
201        @ Out of range immediates for MRC/MRC2/MRRC/MRRC2
202        mrc  p14, #8, r1, c1, c2, #4
203        mrc  p14, #1, r1, c1, c2, #8
204        mrc2  p14, #8, r1, c1, c2, #4
205        mrc2  p14, #0, r1, c1, c2, #9
206        mrrc  p7, #16, r5, r4, c1
207        mrrc2  p7, #17, r5, r4, c1
208@ CHECK-ERRORS: operand must be an immediate in the range [0,7]
209@ CHECK-ERRORS: operand must be an immediate in the range [0,7]
210@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,7]
211@ CHECK-ERRORS-V8: invalid instruction
212@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,7]
213@ CHECK-ERRORS-V8: too many operands for instruction
214@ CHECK-ERRORS: operand must be an immediate in the range [0,15]
215@ CHECK-ERRORS-V7: operand must be an immediate in the range [0,15]
216@ CHECK-ERRORS-V8: invalid instruction
217
218        @ Shifter operand validation for PKH instructions.
219        pkhbt r2, r2, r3, lsl #-1
220        pkhbt r2, r2, r3, lsl #32
221        pkhtb r2, r2, r3, asr #0
222        pkhtb r2, r2, r3, asr #33
223        pkhbt r2, r2, r3, asr #3
224        pkhtb r2, r2, r3, lsl #3
225
226@ CHECK-ERRORS: error: immediate value out of range
227@ CHECK-ERRORS:         pkhbt r2, r2, r3, lsl #-1
228@ CHECK-ERRORS:                                ^
229@ CHECK-ERRORS: error: immediate value out of range
230@ CHECK-ERRORS:         pkhbt r2, r2, r3, lsl #32
231@ CHECK-ERRORS:                                ^
232@ CHECK-ERRORS: error: immediate value out of range
233@ CHECK-ERRORS:         pkhtb r2, r2, r3, asr #0
234@ CHECK-ERRORS:                                ^
235@ CHECK-ERRORS: error: immediate value out of range
236@ CHECK-ERRORS:         pkhtb r2, r2, r3, asr #33
237@ CHECK-ERRORS:                                ^
238@ CHECK-ERRORS: error: lsl operand expected.
239@ CHECK-ERRORS:         pkhbt r2, r2, r3, asr #3
240@ CHECK-ERRORS:                           ^
241@ CHECK-ERRORS: error: asr operand expected.
242@ CHECK-ERRORS:         pkhtb r2, r2, r3, lsl #3
243@ CHECK-ERRORS:                           ^
244
245
246        @ bad values for SETEND
247        setendne be
248        setend me
249        setend 1
250
251@ CHECK-ERRORS: error: instruction 'setend' is not predicable, but condition code specified
252@ CHECK-ERRORS:         setendne be
253@ CHECK-ERRORS:         ^
254@ CHECK-ERRORS: error: 'be' or 'le' operand expected
255@ CHECK-ERRORS:         setend me
256@ CHECK-ERRORS:                  ^
257@ CHECK-ERRORS: error: 'be' or 'le' operand expected
258@ CHECK-ERRORS:         setend 1
259@ CHECK-ERRORS:                ^
260
261
262        @ Out of range immediates and bad shift types for SSAT
263	ssat	r8, #0, r10, lsl #8
264	ssat	r8, #33, r10, lsl #8
265	ssat	r8, #1, r10, lsl #-1
266	ssat	r8, #1, r10, lsl #32
267	ssat	r8, #1, r10, asr #0
268	ssat	r8, #1, r10, asr #33
269        ssat    r8, #1, r10, lsr #5
270        ssat    r8, #1, r10, lsl fred
271        ssat    r8, #1, r10, lsl #fred
272
273@ CHECK-ERRORS: error: operand must be an immediate in the range [1,32]
274@ CHECK-ERRORS: 	ssat	r8, #0, r10, lsl #8
275@ CHECK-ERRORS: 	    	    ^
276@ CHECK-ERRORS: error: operand must be an immediate in the range [1,32]
277@ CHECK-ERRORS: 	ssat	r8, #33, r10, lsl #8
278@ CHECK-ERRORS: 	    	    ^
279@ CHECK-ERRORS: error: 'lsr' shift amount must be in range [0,31]
280@ CHECK-ERRORS: 	ssat	r8, #1, r10, lsl #-1
281@ CHECK-ERRORS: 	    	                  ^
282@ CHECK-ERRORS: error: 'lsr' shift amount must be in range [0,31]
283@ CHECK-ERRORS: 	ssat	r8, #1, r10, lsl #32
284@ CHECK-ERRORS: 	    	                  ^
285@ CHECK-ERRORS: error: 'asr' shift amount must be in range [1,32]
286@ CHECK-ERRORS: 	ssat	r8, #1, r10, asr #0
287@ CHECK-ERRORS: 	    	                  ^
288@ CHECK-ERRORS: error: 'asr' shift amount must be in range [1,32]
289@ CHECK-ERRORS: 	ssat	r8, #1, r10, asr #33
290@ CHECK-ERRORS: 	    	                  ^
291@ CHECK-ERRORS: error: shift operator 'asr' or 'lsl' expected
292@ CHECK-ERRORS:         ssat    r8, #1, r10, lsr #5
293@ CHECK-ERRORS:                              ^
294@ CHECK-ERRORS: error: '#' expected
295@ CHECK-ERRORS:         ssat    r8, #1, r10, lsl fred
296@ CHECK-ERRORS:                                  ^
297@ CHECK-ERRORS: error: shift amount must be an immediate
298@ CHECK-ERRORS:         ssat    r8, #1, r10, lsl #fred
299@ CHECK-ERRORS:                                   ^
300
301        @ Out of range immediates for SSAT16
302	ssat16	r2, #0, r7
303	ssat16	r3, #17, r5
304
305@ CHECK-ERRORS: error: operand must be an immediate in the range [1,16]
306@ CHECK-ERRORS: 	ssat16	r2, #0, r7
307@ CHECK-ERRORS: 	      	    ^
308@ CHECK-ERRORS: error: operand must be an immediate in the range [1,16]
309@ CHECK-ERRORS: 	ssat16	r3, #17, r5
310@ CHECK-ERRORS: 	      	    ^
311
312
313        @ Out of order STM registers
314        stmda sp!, {r5, r2}
315
316@ CHECK-ERRORS: warning: register list not in ascending order
317@ CHECK-ERRORS:         stmda     sp!, {r5, r2}
318@ CHECK-ERRORS:                            ^
319
320
321        @ Out of range immediate on SVC
322        svc #0x1000000
323@ CHECK-ERRORS: error: operand must be an immediate in the range [0,0xffffff]
324@ CHECK-ERRORS:   svc #0x1000000
325@ CHECK-ERRORS:       ^
326
327
328        @ Out of order Rt/Rt2 operands for ldrexd/strexd
329        ldrexd  r4, r3, [r8]
330        strexd  r6, r5, r3, [r8]
331
332@ CHECK-ERRORS: error: destination operands must be sequential
333@ CHECK-ERRORS:         ldrexd  r4, r3, [r8]
334@ CHECK-ERRORS:                     ^
335@ CHECK-ERRORS: error: source operands must be sequential
336@ CHECK-ERRORS:         strexd  r6, r5, r3, [r8]
337@ CHECK-ERRORS:                         ^
338
339        @ Illegal rotate operators for extend instructions
340        sxtb r8, r3, #8
341        sxtb r8, r3, ror 24
342        sxtb r8, r3, ror #8 -
343        sxtab r3, r8, r3, ror #(fred - wilma)
344        sxtab r7, r8, r3, ror #25
345        sxtah r9, r3, r3, ror #-8
346        sxtb16ge r2, r3, lsr #24
347
348@ CHECK-ERRORS: error: invalid operand for instruction
349@ CHECK-ERRORS:         sxtb r8, r3, #8
350@ CHECK-ERRORS:                      ^
351@ CHECK-ERRORS: error: '#' expected
352@ CHECK-ERRORS:         sxtb r8, r3, ror 24
353@ CHECK-ERRORS:                          ^
354@ CHECK-ERRORS: error: unknown token in expression
355@ CHECK-ERRORS:         sxtb r8, r3, ror #8 -
356@ CHECK-ERRORS:                              ^
357@ CHECK-ERRORS: error: malformed rotate expression
358@ CHECK-ERRORS:         sxtb r8, r3, ror #8 -
359@ CHECK-ERRORS:                           ^
360@ CHECK-ERRORS: error: rotate amount must be an immediate
361@ CHECK-ERRORS:         sxtab r3, r8, r3, ror #(fred - wilma)
362@ CHECK-ERRORS:                                ^
363@ CHECK-ERRORS: error: 'ror' rotate amount must be 8, 16, or 24
364@ CHECK-ERRORS:         sxtab r7, r8, r3, ror #25
365@ CHECK-ERRORS:                                ^
366@ CHECK-ERRORS: error: 'ror' rotate amount must be 8, 16, or 24
367@ CHECK-ERRORS:         sxtah r9, r3, r3, ror #-8
368@ CHECK-ERRORS:                                ^
369@ CHECK-ERRORS: error: operand must be a register in range [r0, r14]
370@ CHECK-ERRORS:         sxtb16ge r2, r3, lsr #24
371@ CHECK-ERRORS:                          ^
372
373        @ Out of range width for SBFX/UBFX
374        sbfx r4, r5, #31, #2
375        ubfxgt r4, r5, #16, #17
376
377@ CHECK-ERRORS: error: bitfield width must be in range [1,32-lsb]
378@ CHECK-ERRORS:         sbfx r4, r5, #31, #2
379@ CHECK-ERRORS:                           ^
380@ CHECK-ERRORS: error: bitfield width must be in range [1,32-lsb]
381@ CHECK-ERRORS:         ubfxgt r4, r5, #16, #17
382@ CHECK-ERRORS:                             ^
383
384        @ Using pc for SBFX/UBFX
385        sbfx pc, r2, #1, #3
386        sbfx sp, pc, #4, #5
387        ubfx pc, r0, #0, #31
388        ubfx r14, pc, #1, #2
389@ CHECK-ERRORS: error: operand must be a register in range [r0, r14]
390@ CHECK-ERRORS:         sbfx pc, r2, #1, #3
391@ CHECK-ERRORS:              ^
392@ CHECK-ERRORS: error: operand must be a register in range [r0, r14]
393@ CHECK-ERRORS:         sbfx sp, pc, #4, #5
394@ CHECK-ERRORS:                  ^
395@ CHECK-ERRORS: error: operand must be a register in range [r0, r14]
396@ CHECK-ERRORS:         ubfx pc, r0, #0, #31
397@ CHECK-ERRORS:              ^
398@ CHECK-ERRORS: error: operand must be a register in range [r0, r14]
399@ CHECK-ERRORS:         ubfx r14, pc, #1, #2
400@ CHECK-ERRORS:                   ^
401
402        @ Out of order Rt/Rt2 operands for ldrd/strd
403        ldrd  r4, r3, [r8]
404        ldrd  r4, r3, [r8, #8]!
405        ldrd  r4, r3, [r8], #8
406        strd  r4, r3, [r8]
407        strd  r4, r3, [r8, #8]!
408        strd  r4, r3, [r8], #8
409@ CHECK-ERRORS: error: destination operands must be sequential
410@ CHECK-ERRORS:         ldrd  r4, r3, [r8]
411@ CHECK-ERRORS:                   ^
412@ CHECK-ERRORS: error: destination operands must be sequential
413@ CHECK-ERRORS:         ldrd  r4, r3, [r8, #8]!
414@ CHECK-ERRORS:                   ^
415@ CHECK-ERRORS: error: destination operands must be sequential
416@ CHECK-ERRORS:         ldrd  r4, r3, [r8], #8
417@ CHECK-ERRORS:                   ^
418@ CHECK-ERRORS: error: source operands must be sequential
419@ CHECK-ERRORS:         strd  r4, r3, [r8]
420@ CHECK-ERRORS:                   ^
421@ CHECK-ERRORS: error: source operands must be sequential
422@ CHECK-ERRORS:         strd  r4, r3, [r8, #8]!
423@ CHECK-ERRORS:                   ^
424@ CHECK-ERRORS: error: source operands must be sequential
425@ CHECK-ERRORS:         strd  r4, r3, [r8], #8
426@ CHECK-ERRORS:                   ^
427
428        @ Odd first register for ldrd/strd
429        ldrd  r5, r6, [r8]
430        strd  r5, r6, [r8]
431@ CHECK-ERRORS: error: Rt must be even-numbered
432@ CHECK-ERRORS:         ldrd  r5, r6, [r8]
433@ CHECK-ERRORS:                   ^
434@ CHECK-ERRORS: error: Rt must be even-numbered
435@ CHECK-ERRORS:         strd  r5, r6, [r8]
436@ CHECK-ERRORS:                   ^
437
438        @ Post-increment with base equal to source
439        ldrd  r6, r7, [r6]!
440        ldrd  r6, r7, [r7]!
441        strd  r6, r7, [r6]!
442        strd  r6, r7, [r7]!
443@ CHECK-ERRORS: error: base register needs to be different from destination registers
444@ CHECK-ERRORS:         ldrd  r6, r7, [r6]!
445@ CHECK-ERRORS:                   ^
446@ CHECK-ERRORS: error: base register needs to be different from destination registers
447@ CHECK-ERRORS:         ldrd  r6, r7, [r7]!
448@ CHECK-ERRORS:                   ^
449@ CHECK-ERRORS: error: source register and base register can't be identical
450@ CHECK-ERRORS:         strd  r6, r7, [r6]!
451@ CHECK-ERRORS:                   ^
452@ CHECK-ERRORS: error: source register and base register can't be identical
453@ CHECK-ERRORS:         strd  r6, r7, [r7]!
454@ CHECK-ERRORS:                   ^
455
456        @ Paired load/store of pc
457        ldrd  lr, pc, [r6]!
458        strd  lr, pc, [r6]!
459@ CHECK-ERRORS: error: Rt can't be R14
460@ CHECK-ERRORS:         ldrd  lr, pc, [r6]!
461@ CHECK-ERRORS:                   ^
462@ CHECK-ERRORS: error: Rt can't be R14
463@ CHECK-ERRORS:         strd  lr, pc, [r6]!
464@ CHECK-ERRORS:                   ^
465
466
467        @ Bad register lists for VFP.
468        vpush {s0, s3}
469@ CHECK-ERRORS: error: non-contiguous register range
470@ CHECK-ERRORS:         vpush {s0, s3}
471@ CHECK-ERRORS:                    ^
472
473        @ Out of range coprocessor option immediate.
474        ldc2 p2, c8, [r1], { 256 }
475        ldc2 p2, c8, [r1], { -1 }
476
477@ CHECK-ERRORS-V7: error: coprocessor option must be an immediate in range [0, 255]
478@ CHECK-ERRORS-V7:         ldc2 p2, c8, [r1], { 256 }
479@ CHECK-ERRORS-V7:                              ^
480@ CHECK-ERRORS-V8: error: register expected
481@ CHECK-ERRORS-V7: error: coprocessor option must be an immediate in range [0, 255]
482@ CHECK-ERRORS-V7:         ldc2 p2, c8, [r1], { -1 }
483@ CHECK-ERRORS-V7:                              ^
484@ CHECK-ERRORS-V8: error: register expected
485
486        @ Bad CPS instruction format.
487        cps f,#1
488@ CHECK-ERRORS: error: invalid operand for instruction
489@ CHECK-ERRORS:         cps f,#1
490@ CHECK-ERRORS:               ^
491
492        @ Bad operands for msr
493        msr #0, #0
494        msr foo, #0
495@ CHECK-ERRORS: error: invalid operand for instruction
496@ CHECK-ERRORS:         msr #0, #0
497@ CHECK-ERRORS:             ^
498@ CHECK-ERRORS: error: invalid operand for instruction
499@ CHECK-ERRORS:         msr foo, #0
500@ CHECK-ERRORS:             ^
501
502        isb #-1
503        isb #16
504@ CHECK-ERRORS: error: immediate value out of range
505@ CHECK-ERRORS: error: immediate value out of range
506
507        nop.n
508@ CHECK-ERRORS: error: instruction with .n (narrow) qualifier not allowed in arm mode
509
510	dmbeq #5
511	dsble #15
512	isblo #7
513@ CHECK-ERRORS: error: instruction 'dmb' is not predicable, but condition code specified
514@ CHECK-ERRORS: error: instruction 'dsb' is not predicable, but condition code specified
515@ CHECK-ERRORS: error: instruction 'isb' is not predicable, but condition code specified
516
517	dmblt
518	dsbne
519	isbeq
520@ CHECK-ERRORS: error: instruction 'dmb' is not predicable, but condition code specified
521@ CHECK-ERRORS: error: instruction 'dsb' is not predicable, but condition code specified
522@ CHECK-ERRORS: error: instruction 'isb' is not predicable, but condition code specified
523
524        mcr2le  p7, #1, r5, c1, c1, #4
525        mcrr2ne p7, #15, r5, r4, c1
526        mrc2lo  p14, #0, r1, c1, c2, #4
527        mrrc2lo  p7, #1, r5, r4, c1
528        cdp2hi   p10, #0, c6, c12, c0, #7
529@ CHECK-ERRORS: error: instruction 'mcr2' is not predicable, but condition code specified
530@ CHECK-ERRORS: error: instruction 'mcrr2' is not predicable, but condition code specified
531@ CHECK-ERRORS: error: instruction 'mrc2' is not predicable, but condition code specified
532@ CHECK-ERRORS: error: instruction 'mrrc2' is not predicable, but condition code specified
533@ CHECK-ERRORS: error: instruction 'cdp2' is not predicable, but condition code specified
534
535        bkpteq #7
536@ CHECK-ERRORS: error: instruction 'bkpt' is not predicable, but condition code specified
537
538        ldm r2!, {r2, r3}
539        ldmdb r2!, {r2, r3}
540        ldmda r2!, {r2, r3}
541        popeq {sp}
542@ CHECK-ERRORS: error: writeback register not allowed in register list
543@ CHECK-ERRORS: error: writeback register not allowed in register list
544@ CHECK-ERRORS: error: writeback register not allowed in register list
545@ CHECK-ERRORS: error: writeback register not allowed in register list
546
547        vrintz.f32.f32 s0, s1
548        vrintr.f32 s0, s1
549        vrintx.f64.f64 d2, d5
550        vrintz.f64 d10, d9
551        vrinta.f32.f32 s6, s7
552        vrintn.f32 s8, s9
553        vrintp.f64.f64 d10, d11
554        vrintm.f64 d12, d13
555@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
556@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
557@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
558@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
559@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
560@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
561@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
562@ CHECK-ERRORS-V7: error: instruction requires: FPARMv8
563
564        stm sp!, {r0, pc}^
565        ldm sp!, {r0}^
566@ CHECK-ERRORS: error: system STM cannot have writeback register
567@ CHECK-ERRORS: error: writeback register only allowed on system LDM if PC in register-list
568
569foo2:
570        mov r0, foo2
571        movw r0, foo2
572        movt r0, foo2
573@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
574@ CHECK-ERRORS:                 ^
575@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
576@ CHECK-ERRORS:                  ^
577@ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
578@ CHECK-ERRORS:                  ^
579
580        str r0, [r0, #4]!
581        str r0, [r0, r1]!
582        str r0, [r0], #4
583        str r0, [r0], r1
584        strh r0, [r0, #2]!
585        strh r0, [r0, r1]!
586        strh r0, [r0], #2
587        strh r0, [r0], r1
588        strb r0, [r0, #1]!
589        strb r0, [r0, r1]!
590        strb r0, [r0], #1
591        strb r0, [r0], r1
592@ CHECK-ERRORS: error: source register and base register can't be identical
593@ CHECK-ERRORS: str r0, [r0, #4]!
594@ CHECK-ERRORS:         ^
595@ CHECK-ERRORS: error: source register and base register can't be identical
596@ CHECK-ERRORS: str r0, [r0, r1]!
597@ CHECK-ERRORS:         ^
598@ CHECK-ERRORS: error: source register and base register can't be identical
599@ CHECK-ERRORS: str r0, [r0], #4
600@ CHECK-ERRORS:         ^
601@ CHECK-ERRORS: error: source register and base register can't be identical
602@ CHECK-ERRORS: str r0, [r0], r1
603@ CHECK-ERRORS:         ^
604@ CHECK-ERRORS: error: source register and base register can't be identical
605@ CHECK-ERRORS: strh r0, [r0, #2]!
606@ CHECK-ERRORS:          ^
607@ CHECK-ERRORS: error: source register and base register can't be identical
608@ CHECK-ERRORS: strh r0, [r0, r1]!
609@ CHECK-ERRORS:          ^
610@ CHECK-ERRORS: error: source register and base register can't be identical
611@ CHECK-ERRORS: strh r0, [r0], #2
612@ CHECK-ERRORS:          ^
613@ CHECK-ERRORS: error: source register and base register can't be identical
614@ CHECK-ERRORS: strh r0, [r0], r1
615@ CHECK-ERRORS:          ^
616@ CHECK-ERRORS: error: source register and base register can't be identical
617@ CHECK-ERRORS: strb r0, [r0, #1]!
618@ CHECK-ERRORS:          ^
619@ CHECK-ERRORS: error: source register and base register can't be identical
620@ CHECK-ERRORS: strb r0, [r0, r1]!
621@ CHECK-ERRORS:          ^
622@ CHECK-ERRORS: error: source register and base register can't be identical
623@ CHECK-ERRORS: strb r0, [r0], #1
624@ CHECK-ERRORS:          ^
625@ CHECK-ERRORS: error: source register and base register can't be identical
626@ CHECK-ERRORS: strb r0, [r0], r1
627@ CHECK-ERRORS:          ^
628
629        ldr r0, [r0, #4]!
630        ldr r0, [r0, r1]!
631        ldr r0, [r0], #4
632        ldr r0, [r0], r1
633        ldrh r0, [r0, #2]!
634        ldrh r0, [r0, r1]!
635        ldrh r0, [r0], #2
636        ldrh r0, [r0], r1
637        ldrsh r0, [r0, #2]!
638        ldrsh r0, [r0, r1]!
639        ldrsh r0, [r0], #2
640        ldrsh r0, [r0], r1
641        ldrb r0, [r0, #1]!
642        ldrb r0, [r0, r1]!
643        ldrb r0, [r0], #1
644        ldrb r0, [r0], r1
645        ldrsb r0, [r0, #1]!
646        ldrsb r0, [r0, r1]!
647        ldrsb r0, [r0], #1
648        ldrsb r0, [r0], r1
649@ CHECK-ERRORS: error: destination register and base register can't be identical
650@ CHECK-ERRORS: ldr r0, [r0, #4]!
651@ CHECK-ERRORS:         ^
652@ CHECK-ERRORS: error: destination register and base register can't be identical
653@ CHECK-ERRORS: ldr r0, [r0, r1]!
654@ CHECK-ERRORS:         ^
655@ CHECK-ERRORS: error: destination register and base register can't be identical
656@ CHECK-ERRORS: ldr r0, [r0], #4
657@ CHECK-ERRORS:         ^
658@ CHECK-ERRORS: error: destination register and base register can't be identical
659@ CHECK-ERRORS: ldr r0, [r0], r1
660@ CHECK-ERRORS:         ^
661@ CHECK-ERRORS: error: destination register and base register can't be identical
662@ CHECK-ERRORS: ldrh r0, [r0, #2]!
663@ CHECK-ERRORS:          ^
664@ CHECK-ERRORS: error: destination register and base register can't be identical
665@ CHECK-ERRORS: ldrh r0, [r0, r1]!
666@ CHECK-ERRORS:          ^
667@ CHECK-ERRORS: error: destination register and base register can't be identical
668@ CHECK-ERRORS: ldrh r0, [r0], #2
669@ CHECK-ERRORS:          ^
670@ CHECK-ERRORS: error: destination register and base register can't be identical
671@ CHECK-ERRORS: ldrh r0, [r0], r1
672@ CHECK-ERRORS:          ^
673@ CHECK-ERRORS: error: destination register and base register can't be identical
674@ CHECK-ERRORS: ldrsh r0, [r0, #2]!
675@ CHECK-ERRORS:           ^
676@ CHECK-ERRORS: error: destination register and base register can't be identical
677@ CHECK-ERRORS: ldrsh r0, [r0, r1]!
678@ CHECK-ERRORS:           ^
679@ CHECK-ERRORS: error: destination register and base register can't be identical
680@ CHECK-ERRORS: ldrsh r0, [r0], #2
681@ CHECK-ERRORS:           ^
682@ CHECK-ERRORS: error: destination register and base register can't be identical
683@ CHECK-ERRORS: ldrsh r0, [r0], r1
684@ CHECK-ERRORS:           ^
685@ CHECK-ERRORS: error: destination register and base register can't be identical
686@ CHECK-ERRORS: ldrb r0, [r0, #1]!
687@ CHECK-ERRORS:          ^
688@ CHECK-ERRORS: error: destination register and base register can't be identical
689@ CHECK-ERRORS: ldrb r0, [r0, r1]!
690@ CHECK-ERRORS:          ^
691@ CHECK-ERRORS: error: destination register and base register can't be identical
692@ CHECK-ERRORS: ldrb r0, [r0], #1
693@ CHECK-ERRORS:          ^
694@ CHECK-ERRORS: error: destination register and base register can't be identical
695@ CHECK-ERRORS: ldrb r0, [r0], r1
696@ CHECK-ERRORS:          ^
697@ CHECK-ERRORS: error: destination register and base register can't be identical
698@ CHECK-ERRORS: ldrsb r0, [r0, #1]!
699@ CHECK-ERRORS:           ^
700@ CHECK-ERRORS: error: destination register and base register can't be identical
701@ CHECK-ERRORS: ldrsb r0, [r0, r1]!
702@ CHECK-ERRORS:           ^
703@ CHECK-ERRORS: error: destination register and base register can't be identical
704@ CHECK-ERRORS: ldrsb r0, [r0], #1
705@ CHECK-ERRORS:           ^
706@ CHECK-ERRORS: error: destination register and base register can't be identical
707@ CHECK-ERRORS: ldrsb r0, [r0], r1
708@ CHECK-ERRORS:           ^
709
710        @ Out of range modified immediate values
711        mov  r5, #-256, #6
712        mov  r6, #42, #7
713        mvn  r5, #256, #6
714        mvn  r6, #42, #298
715        cmp  r5, #65535, #6
716        cmp  r6, #42, #31
717        cmn  r5, #-1, #6
718        cmn  r6, #42, #32
719	msr  APSR_nzcvq, #-128, #2
720	msr  apsr_nzcvqg, #0, #1
721        adc  r7, r8, #-256, #2
722        adc  r7, r8, #128, #1
723        sbc  r7, r8, #-256, #2
724        sbc  r7, r8, #128, #1
725        add  r7, r8, #-2149, #0
726        add  r7, r8, #100, #1
727        sub  r7, r8, #-2149, #0
728        sub  r7, r8, #100, #1
729        and  r7, r8, #-2149, #0
730        and  r7, r8, #100, #1
731        orr  r7, r8, #-2149, #0
732        orr  r7, r8, #100, #1
733        eor  r7, r8, #-2149, #0
734        eor  r7, r8, #100, #1
735        bic  r7, r8, #-2149, #0
736        bic  r7, r8, #100, #1
737        rsb  r7, r8, #-2149, #0
738        rsb  r7, r8, #100, #1
739        adds r7, r8, #-2149, #0
740        adds r7, r8, #100, #1
741        subs r7, r8, #-2149, #0
742        subs r7, r8, #100, #1
743        rsbs r7, r8, #-2149, #0
744        rsbs r7, r8, #100, #1
745        rsc r7, r8, #-2149, #0
746        rsc r7, r8, #100, #1
747        TST r7, #-2149, #0
748        TST r7, #100, #1
749        TEQ r7, #-2149, #0
750        TEQ r7, #100, #1
751@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
752@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
753@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
754@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
755@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
756@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
757@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
758@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
759@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
760@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
761@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
762@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
763@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
764@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
765@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
766@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
767@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
768@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
769@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
770@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
771@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
772@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
773@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
774@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
775@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
776@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
777@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
778@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
779@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
780@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
781@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
782@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
783@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
784@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
785@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
786@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
787@ CHECK-ERRORS: error: immediate operand must a number in the range [0, 255]
788@ CHECK-ERRORS: error: immediate operand must an even number in the range [0, 30]
789
790        @ Generic error for too few operands
791        adds
792        adds r0
793@ CHECK-ERRORS: error: too few operands for instruction
794@ CHECK-ERRORS: error: too few operands for instruction
795
796        @ Using pc for MVN
797	mvn pc, r6, lsl r7
798@ CHECK-ERRORS: error: invalid instruction, any one of the following would fix this:
799@ CHECK-ERRORS: note: operand must be a register in range [r0, r14]
800@ CHECK-ERRORS:         mvn pc, r6, lsl r7
801@ CHECK-ERRORS:             ^
802