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