basic-thumb2-instructions.s revision 0b3ed6de80734c3ac15e1b1f0b5306a1f61f88ce
1@ RUN: llvm-mc -triple=thumbv7-apple-darwin -show-encoding < %s | FileCheck %s
2  .syntax unified
3  .globl _func
4
5@ Check that the assembler can handle the documented syntax from the ARM ARM.
6@ For complex constructs like shifter operands, check more thoroughly for them
7@ once then spot check that following instructions accept the form generally.
8@ This gives us good coverage while keeping the overall size of the test
9@ more reasonable.
10
11
12@ FIXME: Some 3-operand instructions have a 2-operand assembly syntax.
13
14_func:
15@ CHECK: _func
16
17@------------------------------------------------------------------------------
18@ ADC (immediate)
19@------------------------------------------------------------------------------
20        adc r0, r1, #4
21        adcs r0, r1, #0
22        adc r1, r2, #255
23        adc r3, r7, #0x00550055
24        adc r8, r12, #0xaa00aa00
25        adc r9, r7, #0xa5a5a5a5
26        adc r5, r3, #0x87000000
27        adc r4, r2, #0x7f800000
28        adc r4, r2, #0x00000680
29
30@ CHECK: adc	r0, r1, #4              @ encoding: [0x41,0xf1,0x04,0x00]
31@ CHECK: adcs	r0, r1, #0              @ encoding: [0x51,0xf1,0x00,0x00]
32@ CHECK: adc	r1, r2, #255            @ encoding: [0x42,0xf1,0xff,0x01]
33@ CHECK: adc	r3, r7, #5570645        @ encoding: [0x47,0xf1,0x55,0x13]
34@ CHECK: adc	r8, r12, #2852170240    @ encoding: [0x4c,0xf1,0xaa,0x28]
35@ CHECK: adc	r9, r7, #2779096485     @ encoding: [0x47,0xf1,0xa5,0x39]
36@ CHECK: adc	r5, r3, #2264924160     @ encoding: [0x43,0xf1,0x07,0x45]
37@ CHECK: adc	r4, r2, #2139095040     @ encoding: [0x42,0xf1,0xff,0x44]
38@ CHECK: adc	r4, r2, #1664           @ encoding: [0x42,0xf5,0xd0,0x64]
39
40@------------------------------------------------------------------------------
41@ ADC (register)
42@------------------------------------------------------------------------------
43        adc r4, r5, r6
44        adcs r4, r5, r6
45        adc.w r9, r1, r3
46        adcs.w r9, r1, r3
47        adc	r0, r1, r3, ror #4
48        adcs	r0, r1, r3, lsl #7
49        adc.w	r0, r1, r3, lsr #31
50        adcs.w	r0, r1, r3, asr #32
51
52@ CHECK: adc.w	r4, r5, r6              @ encoding: [0x45,0xeb,0x06,0x04]
53@ CHECK: adcs.w	r4, r5, r6              @ encoding: [0x55,0xeb,0x06,0x04]
54@ CHECK: adc.w	r9, r1, r3              @ encoding: [0x41,0xeb,0x03,0x09]
55@ CHECK: adcs.w	r9, r1, r3              @ encoding: [0x51,0xeb,0x03,0x09]
56@ CHECK: adc.w	r0, r1, r3, ror #4      @ encoding: [0x41,0xeb,0x33,0x10]
57@ CHECK: adcs.w	r0, r1, r3, lsl #7      @ encoding: [0x51,0xeb,0xc3,0x10]
58@ CHECK: adc.w	r0, r1, r3, lsr #31     @ encoding: [0x41,0xeb,0xd3,0x70]
59@ CHECK: adcs.w	r0, r1, r3, asr #32     @ encoding: [0x51,0xeb,0x23,0x00]
60
61
62@------------------------------------------------------------------------------
63@ ADD (immediate)
64@------------------------------------------------------------------------------
65        itet eq
66        addeq r1, r2, #4
67        addwne r5, r3, #1023
68        addeq r4, r5, #293
69        add r2, sp, #1024
70        add r2, r8, #0xff00
71        add r2, r3, #257
72        addw r2, r3, #257
73        add r12, r6, #0x100
74        addw r12, r6, #0x100
75        adds r1, r2, #0x1f0
76
77@ CHECK: itet	eq                      @ encoding: [0x0a,0xbf]
78@ CHECK: addeq	r1, r2, #4              @ encoding: [0x11,0x1d]
79@ CHECK: addwne	r5, r3, #1023           @ encoding: [0x03,0xf2,0xff,0x35]
80@ CHECK: addweq	r4, r5, #293            @ encoding: [0x05,0xf2,0x25,0x14]
81@ CHECK: add.w	r2, sp, #1024           @ encoding: [0x0d,0xf5,0x80,0x62]
82@ CHECK: add.w	r2, r8, #65280          @ encoding: [0x08,0xf5,0x7f,0x42]
83@ CHECK: addw	r2, r3, #257            @ encoding: [0x03,0xf2,0x01,0x12]
84@ CHECK: addw	r2, r3, #257            @ encoding: [0x03,0xf2,0x01,0x12]
85@ CHECK: add.w	r12, r6, #256           @ encoding: [0x06,0xf5,0x80,0x7c]
86@ CHECK: addw	r12, r6, #256           @ encoding: [0x06,0xf2,0x00,0x1c]
87@ CHECK: adds.w	r1, r2, #496            @ encoding: [0x12,0xf5,0xf8,0x71]
88
89
90@------------------------------------------------------------------------------
91@ ADD (register)
92@------------------------------------------------------------------------------
93        add r1, r2, r8
94        add r5, r9, r2, asr #32
95        adds r7, r3, r1, lsl #31
96        adds.w r0, r3, r6, lsr #25
97        add.w r4, r8, r1, ror #12
98
99@ CHECK: add.w	r1, r2, r8              @ encoding: [0x02,0xeb,0x08,0x01]
100@ CHECK: add.w	r5, r9, r2, asr #32     @ encoding: [0x09,0xeb,0x22,0x05]
101@ CHECK: adds.w	r7, r3, r1, lsl #31     @ encoding: [0x13,0xeb,0xc1,0x77]
102@ CHECK: adds.w	r0, r3, r6, lsr #25     @ encoding: [0x13,0xeb,0x56,0x60]
103@ CHECK: add.w	r4, r8, r1, ror #12     @ encoding: [0x08,0xeb,0x31,0x34]
104
105
106@------------------------------------------------------------------------------
107@ FIXME: ADR
108@------------------------------------------------------------------------------
109
110        subw r11, pc, #3270
111        adr.w r11, #-826
112
113@ CHECK: subw	r11, pc, #3270          @ encoding: [0xaf,0xf6,0xc6,0x4b]
114@ CHECK: adr.w	r11, #-826              @ encoding: [0xaf,0xf2,0x3a,0x3b]
115
116@------------------------------------------------------------------------------
117@ AND (immediate)
118@------------------------------------------------------------------------------
119        and r2, r5, #0xff000
120        ands r3, r12, #0xf
121        and r1, #0xff
122        and r1, r1, #0xff
123
124@ CHECK: and	r2, r5, #1044480        @ encoding: [0x05,0xf4,0x7f,0x22]
125@ CHECK: ands	r3, r12, #15            @ encoding: [0x1c,0xf0,0x0f,0x03]
126@ CHECK: and	r1, r1, #255            @ encoding: [0x01,0xf0,0xff,0x01]
127@ CHECK: and	r1, r1, #255            @ encoding: [0x01,0xf0,0xff,0x01]
128
129
130@------------------------------------------------------------------------------
131@ AND (register)
132@------------------------------------------------------------------------------
133        and r4, r9, r8
134        and r1, r4, r8, asr #3
135        ands r2, r1, r7, lsl #1
136        ands.w r4, r5, r2, lsr #20
137        and.w r9, r12, r1, ror #17
138
139@ CHECK: and.w	r4, r9, r8              @ encoding: [0x09,0xea,0x08,0x04]
140@ CHECK: and.w	r1, r4, r8, asr #3      @ encoding: [0x04,0xea,0xe8,0x01]
141@ CHECK: ands.w	r2, r1, r7, lsl #1      @ encoding: [0x11,0xea,0x47,0x02]
142@ CHECK: ands.w	r4, r5, r2, lsr #20     @ encoding: [0x15,0xea,0x12,0x54]
143@ CHECK: and.w	r9, r12, r1, ror #17    @ encoding: [0x0c,0xea,0x71,0x49]
144
145@------------------------------------------------------------------------------
146@ ASR (immediate)
147@------------------------------------------------------------------------------
148        asr r2, r3, #12
149        asrs r8, r3, #32
150        asrs.w r2, r3, #1
151        asr r2, r3, #4
152        asrs r2, r12, #15
153
154        asr r3, #19
155        asrs r8, #2
156        asrs.w r7, #5
157        asr.w r12, #21
158
159@ CHECK: asr.w	r2, r3, #12             @ encoding: [0x4f,0xea,0x23,0x32]
160@ CHECK: asrs.w	r8, r3, #32             @ encoding: [0x5f,0xea,0x23,0x08]
161@ CHECK: asrs.w	r2, r3, #1              @ encoding: [0x5f,0xea,0x63,0x02]
162@ CHECK: asr.w	r2, r3, #4              @ encoding: [0x4f,0xea,0x23,0x12]
163@ CHECK: asrs.w	r2, r12, #15            @ encoding: [0x5f,0xea,0xec,0x32]
164
165@ CHECK: asr.w	r3, r3, #19             @ encoding: [0x4f,0xea,0xe3,0x43]
166@ CHECK: asrs.w	r8, r8, #2              @ encoding: [0x5f,0xea,0xa8,0x08]
167@ CHECK: asrs.w	r7, r7, #5              @ encoding: [0x5f,0xea,0x67,0x17]
168@ CHECK: asr.w	r12, r12, #21           @ encoding: [0x4f,0xea,0x6c,0x5c]
169
170
171@------------------------------------------------------------------------------
172@ ASR (register)
173@------------------------------------------------------------------------------
174        asr r3, r4, r2
175        asr.w r1, r2
176        asrs r3, r4, r8
177
178@ CHECK: asr.w	r3, r4, r2              @ encoding: [0x44,0xfa,0x02,0xf3]
179@ CHECK: asr.w	r1, r1, r2              @ encoding: [0x41,0xfa,0x02,0xf1]
180@ CHECK: asrs.w	r3, r4, r8              @ encoding: [0x54,0xfa,0x08,0xf3]
181
182
183@------------------------------------------------------------------------------
184@ B
185@------------------------------------------------------------------------------
186        b.w   _bar
187        beq.w   _bar
188        it eq
189        beq.w _bar
190        bmi.w   #-183396
191
192@ CHECK: b.w	_bar                    @ encoding: [A,0xf0'A',A,0x90'A']
193          @   fixup A - offset: 0, value: _bar, kind: fixup_t2_uncondbranch
194@ CHECK: beq.w	_bar                    @ encoding: [A,0xf0'A',A,0x80'A']
195          @   fixup A - offset: 0, value: _bar, kind: fixup_t2_condbranch
196@ CHECK: it	eq                      @ encoding: [0x08,0xbf]
197@ CHECK: beq.w	_bar                    @ encoding: [A,0xf0'A',A,0x90'A']
198          @   fixup A - offset: 0, value: _bar, kind: fixup_t2_uncondbranch
199@ CHECK: bmi.w   #-183396                @ encoding: [0x13,0xf5,0xce,0xa9]
200
201
202@------------------------------------------------------------------------------
203@ BFC
204@------------------------------------------------------------------------------
205        bfc r5, #3, #17
206        it lo
207        bfccc r5, #3, #17
208
209@ CHECK: bfc	r5, #3, #17             @ encoding: [0x6f,0xf3,0xd3,0x05]
210@ CHECK: it	lo                      @ encoding: [0x38,0xbf]
211@ CHECK: bfclo	r5, #3, #17             @ encoding: [0x6f,0xf3,0xd3,0x05]
212
213
214@------------------------------------------------------------------------------
215@ BFI
216@------------------------------------------------------------------------------
217        bfi r5, r2, #3, #17
218        it ne
219        bfine r5, r2, #3, #17
220
221@ CHECK: bfi	r5, r2, #3, #17         @ encoding: [0x62,0xf3,0xd3,0x05]
222@ CHECK: it	ne                      @ encoding: [0x18,0xbf]
223@ CHECK: bfine	r5, r2, #3, #17         @ encoding: [0x62,0xf3,0xd3,0x05]
224
225
226@------------------------------------------------------------------------------
227@ BIC
228@------------------------------------------------------------------------------
229        bic r10, r1, #0xf
230        bic r12, r3, r6
231        bic r11, r2, r6, lsl #12
232        bic r8, r4, r1, lsr #11
233        bic r7, r5, r7, lsr #15
234        bic r6, r7, r9, asr #32
235        bic r5, r6, r8, ror #1
236
237        @ destination register is optional
238        bic r1, #0xf
239        bic r1, r1
240        bic r4, r2, lsl #31
241        bic r6, r3, lsr #12
242        bic r7, r4, lsr #7
243        bic r8, r5, asr #15
244        bic r12, r6, ror #29
245
246@ CHECK: bic	r10, r1, #15            @ encoding: [0x21,0xf0,0x0f,0x0a]
247@ CHECK: bic.w	r12, r3, r6             @ encoding: [0x23,0xea,0x06,0x0c]
248@ CHECK: bic.w	r11, r2, r6, lsl #12    @ encoding: [0x22,0xea,0x06,0x3b]
249@ CHECK: bic.w	r8, r4, r1, lsr #11     @ encoding: [0x24,0xea,0xd1,0x28]
250@ CHECK: bic.w	r7, r5, r7, lsr #15     @ encoding: [0x25,0xea,0xd7,0x37]
251@ CHECK: bic.w	r6, r7, r9, asr #32     @ encoding: [0x27,0xea,0x29,0x06]
252@ CHECK: bic.w	r5, r6, r8, ror #1      @ encoding: [0x26,0xea,0x78,0x05]
253
254@ CHECK: bic	r1, r1, #15             @ encoding: [0x21,0xf0,0x0f,0x01]
255@ CHECK: bic.w	r1, r1, r1              @ encoding: [0x21,0xea,0x01,0x01]
256@ CHECK: bic.w	r4, r4, r2, lsl #31     @ encoding: [0x24,0xea,0xc2,0x74]
257@ CHECK: bic.w	r6, r6, r3, lsr #12     @ encoding: [0x26,0xea,0x13,0x36]
258@ CHECK: bic.w	r7, r7, r4, lsr #7      @ encoding: [0x27,0xea,0xd4,0x17]
259@ CHECK: bic.w	r8, r8, r5, asr #15     @ encoding: [0x28,0xea,0xe5,0x38]
260@ CHECK: bic.w	r12, r12, r6, ror #29   @ encoding: [0x2c,0xea,0x76,0x7c]
261
262@------------------------------------------------------------------------------
263@ BKPT
264@------------------------------------------------------------------------------
265        it pl
266        bkpt #234
267
268@ CHECK: it pl                      @ encoding: [0x58,0xbf]
269@ CHECK: bkpt #234                    @ encoding: [0xea,0xbe]
270
271@------------------------------------------------------------------------------
272@ BXJ
273@------------------------------------------------------------------------------
274        bxj r5
275        it ne
276        bxjne r7
277
278@ CHECK: bxj	r5                      @ encoding: [0xc5,0xf3,0x00,0x8f]
279@ CHECK: it	ne                      @ encoding: [0x18,0xbf]
280@ CHECK: bxjne	r7                      @ encoding: [0xc7,0xf3,0x00,0x8f]
281
282
283@------------------------------------------------------------------------------
284@ CBZ/CBNZ
285@------------------------------------------------------------------------------
286        cbnz    r7, #6
287        cbnz    r7, #12
288        cbz   r6, _bar
289        cbnz   r6, _bar
290
291@ CHECK: cbnz    r7, #6                  @ encoding: [0x1f,0xb9]
292@ CHECK: cbnz    r7, #12                 @ encoding: [0x37,0xb9]
293@ CHECK: cbz	r6, _bar                @ encoding: [0x06'A',0xb1'A']
294           @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_cb
295@ CHECK: cbnz	r6, _bar                @ encoding: [0x06'A',0xb9'A']
296           @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_cb
297
298
299@------------------------------------------------------------------------------
300@ CDP/CDP2
301@------------------------------------------------------------------------------
302  cdp  p7, #1, c1, c1, c1, #4
303  cdp2  p7, #1, c1, c1, c1, #4
304
305@ CHECK: cdp	p7, #1, c1, c1, c1, #4  @ encoding: [0x11,0xee,0x81,0x17]
306@ CHECK: cdp2	p7, #1, c1, c1, c1, #4  @ encoding: [0x11,0xfe,0x81,0x17]
307
308
309@------------------------------------------------------------------------------
310@ CLREX
311@------------------------------------------------------------------------------
312        clrex
313        it ne
314        clrexne
315
316@ CHECK: clrex                           @ encoding: [0xbf,0xf3,0x2f,0x8f]
317@ CHECK: it	ne                       @ encoding: [0x18,0xbf]
318@ CHECK: clrexne                         @ encoding: [0xbf,0xf3,0x2f,0x8f]
319
320
321@------------------------------------------------------------------------------
322@ CLZ
323@------------------------------------------------------------------------------
324        clz r1, r2
325        it eq
326        clzeq r1, r2
327
328@ CHECK: clz	r1, r2                  @ encoding: [0xb2,0xfa,0x82,0xf1]
329@ CHECK: it	eq                      @ encoding: [0x08,0xbf]
330@ CHECK: clzeq	r1, r2                  @ encoding: [0xb2,0xfa,0x82,0xf1]
331
332
333@------------------------------------------------------------------------------
334@ CMN
335@------------------------------------------------------------------------------
336        cmn r1, #0xf
337        cmn r8, r6
338        cmn r1, r6, lsl #10
339        cmn r1, r6, lsr #10
340        cmn sp, r6, lsr #10
341        cmn r1, r6, asr #10
342        cmn r1, r6, ror #10
343
344@ CHECK: cmn.w	r1, #15                 @ encoding: [0x11,0xf1,0x0f,0x0f]
345@ CHECK: cmn.w	r8, r6                  @ encoding: [0x18,0xeb,0x06,0x0f]
346@ CHECK: cmn.w	r1, r6, lsl #10         @ encoding: [0x11,0xeb,0x86,0x2f]
347@ CHECK: cmn.w	r1, r6, lsr #10         @ encoding: [0x11,0xeb,0x96,0x2f]
348@ CHECK: cmn.w	sp, r6, lsr #10         @ encoding: [0x1d,0xeb,0x96,0x2f]
349@ CHECK: cmn.w	r1, r6, asr #10         @ encoding: [0x11,0xeb,0xa6,0x2f]
350@ CHECK: cmn.w	r1, r6, ror #10         @ encoding: [0x11,0xeb,0xb6,0x2f]
351
352
353@------------------------------------------------------------------------------
354@ CMP
355@------------------------------------------------------------------------------
356        cmp r5, #0xff00
357        cmp.w r4, r12
358        cmp r9, r6, lsl #12
359        cmp r3, r7, lsr #31
360        cmp sp, r6, lsr #1
361        cmp r2, r5, asr #24
362        cmp r1, r4, ror #15
363
364@ CHECK: cmp.w	r5, #65280              @ encoding: [0xb5,0xf5,0x7f,0x4f]
365@ CHECK: cmp.w	r4, r12                 @ encoding: [0xb4,0xeb,0x0c,0x0f]
366@ CHECK: cmp.w	r9, r6, lsl #12         @ encoding: [0xb9,0xeb,0x06,0x3f]
367@ CHECK: cmp.w	r3, r7, lsr #31         @ encoding: [0xb3,0xeb,0xd7,0x7f]
368@ CHECK: cmp.w	sp, r6, lsr #1          @ encoding: [0xbd,0xeb,0x56,0x0f]
369@ CHECK: cmp.w	r2, r5, asr #24         @ encoding: [0xb2,0xeb,0x25,0x6f]
370@ CHECK: cmp.w	r1, r4, ror #15         @ encoding: [0xb1,0xeb,0xf4,0x3f]
371
372
373@------------------------------------------------------------------------------
374@ DBG
375@------------------------------------------------------------------------------
376        dbg #5
377        dbg #0
378        dbg #15
379
380@ CHECK: dbg	#5                      @ encoding: [0xaf,0xf3,0xf5,0x80]
381@ CHECK: dbg	#0                      @ encoding: [0xaf,0xf3,0xf0,0x80]
382@ CHECK: dbg	#15                     @ encoding: [0xaf,0xf3,0xff,0x80]
383
384
385@------------------------------------------------------------------------------
386@ DMB
387@------------------------------------------------------------------------------
388        dmb sy
389        dmb st
390        dmb sh
391        dmb ish
392        dmb shst
393        dmb ishst
394        dmb un
395        dmb nsh
396        dmb unst
397        dmb nshst
398        dmb osh
399        dmb oshst
400        dmb
401
402@ CHECK: dmb	sy                      @ encoding: [0xbf,0xf3,0x5f,0x8f]
403@ CHECK: dmb	st                      @ encoding: [0xbf,0xf3,0x5e,0x8f]
404@ CHECK: dmb	ish                     @ encoding: [0xbf,0xf3,0x5b,0x8f]
405@ CHECK: dmb	ish                     @ encoding: [0xbf,0xf3,0x5b,0x8f]
406@ CHECK: dmb	ishst                   @ encoding: [0xbf,0xf3,0x5a,0x8f]
407@ CHECK: dmb	ishst                   @ encoding: [0xbf,0xf3,0x5a,0x8f]
408@ CHECK: dmb	nsh                     @ encoding: [0xbf,0xf3,0x57,0x8f]
409@ CHECK: dmb	nsh                     @ encoding: [0xbf,0xf3,0x57,0x8f]
410@ CHECK: dmb	nshst                   @ encoding: [0xbf,0xf3,0x56,0x8f]
411@ CHECK: dmb	nshst                   @ encoding: [0xbf,0xf3,0x56,0x8f]
412@ CHECK: dmb	osh                     @ encoding: [0xbf,0xf3,0x53,0x8f]
413@ CHECK: dmb	oshst                   @ encoding: [0xbf,0xf3,0x52,0x8f]
414@ CHECK: dmb	sy                      @ encoding: [0xbf,0xf3,0x5f,0x8f]
415
416
417@------------------------------------------------------------------------------
418@ DSB
419@------------------------------------------------------------------------------
420        dsb sy
421        dsb st
422        dsb sh
423        dsb ish
424        dsb shst
425        dsb ishst
426        dsb un
427        dsb nsh
428        dsb unst
429        dsb nshst
430        dsb osh
431        dsb oshst
432        dsb
433
434@ CHECK: dsb	sy                      @ encoding: [0xbf,0xf3,0x4f,0x8f]
435@ CHECK: dsb	st                      @ encoding: [0xbf,0xf3,0x4e,0x8f]
436@ CHECK: dsb	ish                     @ encoding: [0xbf,0xf3,0x4b,0x8f]
437@ CHECK: dsb	ish                     @ encoding: [0xbf,0xf3,0x4b,0x8f]
438@ CHECK: dsb	ishst                   @ encoding: [0xbf,0xf3,0x4a,0x8f]
439@ CHECK: dsb	ishst                   @ encoding: [0xbf,0xf3,0x4a,0x8f]
440@ CHECK: dsb	nsh                     @ encoding: [0xbf,0xf3,0x47,0x8f]
441@ CHECK: dsb	nsh                     @ encoding: [0xbf,0xf3,0x47,0x8f]
442@ CHECK: dsb	nshst                   @ encoding: [0xbf,0xf3,0x46,0x8f]
443@ CHECK: dsb	nshst                   @ encoding: [0xbf,0xf3,0x46,0x8f]
444@ CHECK: dsb	osh                     @ encoding: [0xbf,0xf3,0x43,0x8f]
445@ CHECK: dsb	oshst                   @ encoding: [0xbf,0xf3,0x42,0x8f]
446@ CHECK: dsb	sy                      @ encoding: [0xbf,0xf3,0x4f,0x8f]
447
448
449@------------------------------------------------------------------------------
450@ EOR
451@------------------------------------------------------------------------------
452        eor r4, r5, #0xf000
453        eor r4, r5, r6
454        eor r4, r5, r6, lsl #5
455        eor r4, r5, r6, lsr #5
456        eor r4, r5, r6, lsr #5
457        eor r4, r5, r6, asr #5
458        eor r4, r5, r6, ror #5
459
460@ CHECK: eor	r4, r5, #61440          @ encoding: [0x85,0xf4,0x70,0x44]
461@ CHECK: eor.w	r4, r5, r6              @ encoding: [0x85,0xea,0x06,0x04]
462@ CHECK: eor.w	r4, r5, r6, lsl #5      @ encoding: [0x85,0xea,0x46,0x14]
463@ CHECK: eor.w	r4, r5, r6, lsr #5      @ encoding: [0x85,0xea,0x56,0x14]
464@ CHECK: eor.w	r4, r5, r6, lsr #5      @ encoding: [0x85,0xea,0x56,0x14]
465@ CHECK: eor.w	r4, r5, r6, asr #5      @ encoding: [0x85,0xea,0x66,0x14]
466@ CHECK: eor.w	r4, r5, r6, ror #5      @ encoding: [0x85,0xea,0x76,0x14]
467
468
469@------------------------------------------------------------------------------
470@ ISB
471@------------------------------------------------------------------------------
472        isb sy
473        isb
474
475@ CHECK: isb	sy                      @ encoding: [0xbf,0xf3,0x6f,0x8f]
476@ CHECK: isb	sy                      @ encoding: [0xbf,0xf3,0x6f,0x8f]
477
478
479@------------------------------------------------------------------------------
480@ LDMIA
481@------------------------------------------------------------------------------
482        ldmia.w r4, {r4, r5, r8, r9}
483        ldmia.w r4, {r5, r6}
484        ldmia.w r5!, {r3, r8}
485        ldm.w r4, {r4, r5, r8, r9}
486        ldm.w r4, {r5, r6}
487        ldm.w r5!, {r3, r8}
488        ldm.w r5!, {r1, r2}
489        ldm.w r2, {r1, r2}
490
491        ldmia r4, {r4, r5, r8, r9}
492        ldmia r4, {r5, r6}
493        ldmia r5!, {r3, r8}
494        ldm r4, {r4, r5, r8, r9}
495        ldm r4, {r5, r6}
496        ldm r5!, {r3, r8}
497        ldmfd r5!, {r3, r8}
498
499@ CHECK: ldm.w	r4, {r4, r5, r8, r9}    @ encoding: [0x94,0xe8,0x30,0x03]
500@ CHECK: ldm.w	r4, {r5, r6}            @ encoding: [0x94,0xe8,0x60,0x00]
501@ CHECK: ldm.w	r5!, {r3, r8}           @ encoding: [0xb5,0xe8,0x08,0x01]
502@ CHECK: ldm.w	r4, {r4, r5, r8, r9}    @ encoding: [0x94,0xe8,0x30,0x03]
503@ CHECK: ldm.w	r4, {r5, r6}            @ encoding: [0x94,0xe8,0x60,0x00]
504@ CHECK: ldm.w	r5!, {r3, r8}           @ encoding: [0xb5,0xe8,0x08,0x01]
505@ CHECK: ldm.w	r5!, {r1, r2}           @ encoding: [0xb5,0xe8,0x06,0x00]
506@ CHECK: ldm.w	r2, {r1, r2}            @ encoding: [0x92,0xe8,0x06,0x00]
507
508@ CHECK: ldm.w	r4, {r4, r5, r8, r9}    @ encoding: [0x94,0xe8,0x30,0x03]
509@ CHECK: ldm.w	r4, {r5, r6}            @ encoding: [0x94,0xe8,0x60,0x00]
510@ CHECK: ldm.w	r5!, {r3, r8}           @ encoding: [0xb5,0xe8,0x08,0x01]
511@ CHECK: ldm.w	r4, {r4, r5, r8, r9}    @ encoding: [0x94,0xe8,0x30,0x03]
512@ CHECK: ldm.w	r4, {r5, r6}            @ encoding: [0x94,0xe8,0x60,0x00]
513@ CHECK: ldm.w	r5!, {r3, r8}           @ encoding: [0xb5,0xe8,0x08,0x01]
514@ CHECK: ldm.w	r5!, {r3, r8}           @ encoding: [0xb5,0xe8,0x08,0x01]
515
516
517@------------------------------------------------------------------------------
518@ LDMDB
519@------------------------------------------------------------------------------
520        ldmdb r4, {r4, r5, r8, r9}
521        ldmdb r4, {r5, r6}
522        ldmdb r5!, {r3, r8}
523        ldmea r5!, {r3, r8}
524
525@ CHECK: ldmdb	r4, {r4, r5, r8, r9}    @ encoding: [0x14,0xe9,0x30,0x03]
526@ CHECK: ldmdb	r4, {r5, r6}            @ encoding: [0x14,0xe9,0x60,0x00]
527@ CHECK: ldmdb	r5!, {r3, r8}           @ encoding: [0x35,0xe9,0x08,0x01]
528@ CHECK: ldmdb	r5!, {r3, r8}           @ encoding: [0x35,0xe9,0x08,0x01]
529
530
531@------------------------------------------------------------------------------
532@ LDR(immediate)
533@------------------------------------------------------------------------------
534        ldr r5, [r5, #-4]
535        ldr r5, [r6, #32]
536        ldr r5, [r6, #33]
537        ldr r5, [r6, #257]
538        ldr.w pc, [r7, #257]
539
540@ CHECK: ldr	r5, [r5, #-4]           @ encoding: [0x55,0xf8,0x04,0x5c]
541@ CHECK: ldr	r5, [r6, #32]           @ encoding: [0x35,0x6a]
542@ CHECK: ldr.w	r5, [r6, #33]           @ encoding: [0xd6,0xf8,0x21,0x50]
543@ CHECK: ldr.w	r5, [r6, #257]          @ encoding: [0xd6,0xf8,0x01,0x51]
544@ CHECK: ldr.w	pc, [r7, #257]          @ encoding: [0xd7,0xf8,0x01,0xf1]
545
546
547@------------------------------------------------------------------------------
548@ LDR(literal)
549@------------------------------------------------------------------------------
550        ldr.w r5, _foo
551
552@ CHECK: ldr.w	r5, _foo                @ encoding: [0x5f'A',0xf8'A',A,0x50'A']
553            @   fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12
554
555
556@------------------------------------------------------------------------------
557@ LDR(register)
558@------------------------------------------------------------------------------
559        ldr r1, [r8, r1]
560        ldr.w r4, [r5, r2]
561        ldr r6, [r0, r2, lsl #3]
562        ldr r8, [r8, r2, lsl #2]
563        ldr r7, [sp, r2, lsl #1]
564        ldr r7, [sp, r2, lsl #0]
565        ldr r2, [r4, #255]!
566        ldr r8, [sp, #4]!
567        ldr lr, [sp, #-4]!
568        ldr r2, [r4], #255
569        ldr r8, [sp], #4
570        ldr lr, [sp], #-4
571
572@ CHECK: ldr.w	r1, [r8, r1]            @ encoding: [0x58,0xf8,0x01,0x10]
573@ CHECK: ldr.w	r4, [r5, r2]            @ encoding: [0x55,0xf8,0x02,0x40]
574@ CHECK: ldr.w	r6, [r0, r2, lsl #3]    @ encoding: [0x50,0xf8,0x32,0x60]
575@ CHECK: ldr.w	r8, [r8, r2, lsl #2]    @ encoding: [0x58,0xf8,0x22,0x80]
576@ CHECK: ldr.w	r7, [sp, r2, lsl #1]    @ encoding: [0x5d,0xf8,0x12,0x70]
577@ CHECK: ldr.w	r7, [sp, r2]            @ encoding: [0x5d,0xf8,0x02,0x70]
578@ CHECK: ldr	r2, [r4, #255]!         @ encoding: [0x54,0xf8,0xff,0x2f]
579@ CHECK: ldr	r8, [sp, #4]!           @ encoding: [0x5d,0xf8,0x04,0x8f]
580@ CHECK: ldr	lr, [sp, #-4]!          @ encoding: [0x5d,0xf8,0x04,0xed]
581@ CHECK: ldr	r2, [r4], #255          @ encoding: [0x54,0xf8,0xff,0x2b]
582@ CHECK: ldr	r8, [sp], #4            @ encoding: [0x5d,0xf8,0x04,0x8b]
583@ CHECK: ldr	lr, [sp], #-4           @ encoding: [0x5d,0xf8,0x04,0xe9]
584
585
586@------------------------------------------------------------------------------
587@ LDRB(immediate)
588@------------------------------------------------------------------------------
589        ldrb r5, [r5, #-4]
590        ldrb r5, [r6, #32]
591        ldrb r5, [r6, #33]
592        ldrb r5, [r6, #257]
593        ldrb.w lr, [r7, #257]
594
595@ CHECK: ldrb	r5, [r5, #-4]           @ encoding: [0x15,0xf8,0x04,0x5c]
596@ CHECK: ldrb.w	r5, [r6, #32]           @ encoding: [0x96,0xf8,0x20,0x50]
597@ CHECK: ldrb.w	r5, [r6, #33]           @ encoding: [0x96,0xf8,0x21,0x50]
598@ CHECK: ldrb.w	r5, [r6, #257]          @ encoding: [0x96,0xf8,0x01,0x51]
599@ CHECK: ldrb.w	lr, [r7, #257]          @ encoding: [0x97,0xf8,0x01,0xe1]
600
601
602@------------------------------------------------------------------------------
603@ LDRB(register)
604@------------------------------------------------------------------------------
605        ldrb r1, [r8, r1]
606        ldrb.w r4, [r5, r2]
607        ldrb r6, [r0, r2, lsl #3]
608        ldrb r8, [r8, r2, lsl #2]
609        ldrb r7, [sp, r2, lsl #1]
610        ldrb r7, [sp, r2, lsl #0]
611        ldrb r5, [r8, #255]!
612        ldrb r2, [r5, #4]!
613        ldrb r1, [r4, #-4]!
614        ldrb lr, [r3], #255
615        ldrb r9, [r2], #4
616        ldrb r3, [sp], #-4
617
618@ CHECK: ldrb.w	r1, [r8, r1]            @ encoding: [0x18,0xf8,0x01,0x10]
619@ CHECK: ldrb.w	r4, [r5, r2]            @ encoding: [0x15,0xf8,0x02,0x40]
620@ CHECK: ldrb.w	r6, [r0, r2, lsl #3]    @ encoding: [0x10,0xf8,0x32,0x60]
621@ CHECK: ldrb.w	r8, [r8, r2, lsl #2]    @ encoding: [0x18,0xf8,0x22,0x80]
622@ CHECK: ldrb.w	r7, [sp, r2, lsl #1]    @ encoding: [0x1d,0xf8,0x12,0x70]
623@ CHECK: ldrb.w	r7, [sp, r2]            @ encoding: [0x1d,0xf8,0x02,0x70]
624@ CHECK: ldrb	r5, [r8, #255]!         @ encoding: [0x18,0xf8,0xff,0x5f]
625@ CHECK: ldrb	r2, [r5, #4]!           @ encoding: [0x15,0xf8,0x04,0x2f]
626@ CHECK: ldrb	r1, [r4, #-4]!          @ encoding: [0x14,0xf8,0x04,0x1d]
627@ CHECK: ldrb	lr, [r3], #255          @ encoding: [0x13,0xf8,0xff,0xeb]
628@ CHECK: ldrb	r9, [r2], #4            @ encoding: [0x12,0xf8,0x04,0x9b]
629@ CHECK: ldrb	r3, [sp], #-4           @ encoding: [0x1d,0xf8,0x04,0x39]
630
631
632@------------------------------------------------------------------------------
633@ LDRBT
634@------------------------------------------------------------------------------
635        ldrbt r1, [r2]
636        ldrbt r1, [r8, #0]
637        ldrbt r1, [r8, #3]
638        ldrbt r1, [r8, #255]
639
640@ CHECK: ldrbt	r1, [r2]                @ encoding: [0x12,0xf8,0x00,0x1e]
641@ CHECK: ldrbt	r1, [r8]                @ encoding: [0x18,0xf8,0x00,0x1e]
642@ CHECK: ldrbt	r1, [r8, #3]            @ encoding: [0x18,0xf8,0x03,0x1e]
643@ CHECK: ldrbt	r1, [r8, #255]          @ encoding: [0x18,0xf8,0xff,0x1e]
644
645
646@------------------------------------------------------------------------------
647@ LDRD(immediate)
648@------------------------------------------------------------------------------
649        ldrd r3, r5, [r6, #24]
650        ldrd r3, r5, [r6, #24]!
651        ldrd r3, r5, [r6], #4
652        ldrd r3, r5, [r6], #-8
653        ldrd r3, r5, [r6]
654        ldrd r8, r1, [r3, #0]
655
656@ CHECK: ldrd	r3, r5, [r6, #24]       @ encoding: [0xd6,0xe9,0x06,0x35]
657@ CHECK: ldrd	r3, r5, [r6, #24]!      @ encoding: [0xf6,0xe9,0x06,0x35]
658@ CHECK: ldrd	r3, r5, [r6], #4        @ encoding: [0xf6,0xe8,0x01,0x35]
659@ CHECK: ldrd	r3, r5, [r6], #-8       @ encoding: [0x76,0xe8,0x02,0x35]
660@ CHECK: ldrd	r3, r5, [r6]            @ encoding: [0xd6,0xe9,0x00,0x35]
661@ CHECK: ldrd	r8, r1, [r3]            @ encoding: [0xd3,0xe9,0x00,0x81]
662
663
664@------------------------------------------------------------------------------
665@ FIXME: LDRD(literal)
666@------------------------------------------------------------------------------
667
668
669@------------------------------------------------------------------------------
670@ LDREX/LDREXB/LDREXH/LDREXD
671@------------------------------------------------------------------------------
672        ldrex r1, [r4]
673        ldrex r8, [r4, #0]
674        ldrex r2, [sp, #128]
675        ldrexb r5, [r7]
676        ldrexh r9, [r12]
677        ldrexd r9, r3, [r4]
678
679@ CHECK: ldrex	r1, [r4]                @ encoding: [0x54,0xe8,0x00,0x1f]
680@ CHECK: ldrex	r8, [r4]                @ encoding: [0x54,0xe8,0x00,0x8f]
681@ CHECK: ldrex	r2, [sp, #128]          @ encoding: [0x5d,0xe8,0x20,0x2f]
682@ CHECK: ldrexb	r5, [r7]                @ encoding: [0xd7,0xe8,0x4f,0x5f]
683@ CHECK: ldrexh	r9, [r12]               @ encoding: [0xdc,0xe8,0x5f,0x9f]
684@ CHECK: ldrexd	r9, r3, [r4]            @ encoding: [0xd4,0xe8,0x7f,0x93]
685
686
687@------------------------------------------------------------------------------
688@ LDRH(immediate)
689@------------------------------------------------------------------------------
690        ldrh r5, [r5, #-4]
691        ldrh r5, [r6, #32]
692        ldrh r5, [r6, #33]
693        ldrh r5, [r6, #257]
694        ldrh.w lr, [r7, #257]
695
696@ CHECK: ldrh	r5, [r5, #-4]           @ encoding: [0x35,0xf8,0x04,0x5c]
697@ CHECK: ldrh	r5, [r6, #32]           @ encoding: [0x35,0x8c]
698@ CHECK: ldrh.w	r5, [r6, #33]           @ encoding: [0xb6,0xf8,0x21,0x50]
699@ CHECK: ldrh.w	r5, [r6, #257]          @ encoding: [0xb6,0xf8,0x01,0x51]
700@ CHECK: ldrh.w	lr, [r7, #257]          @ encoding: [0xb7,0xf8,0x01,0xe1]
701
702
703@------------------------------------------------------------------------------
704@ LDRH(register)
705@------------------------------------------------------------------------------
706        ldrh r1, [r8, r1]
707        ldrh.w r4, [r5, r2]
708        ldrh r6, [r0, r2, lsl #3]
709        ldrh r8, [r8, r2, lsl #2]
710        ldrh r7, [sp, r2, lsl #1]
711        ldrh r7, [sp, r2, lsl #0]
712        ldrh r5, [r8, #255]!
713        ldrh r2, [r5, #4]!
714        ldrh r1, [r4, #-4]!
715        ldrh lr, [r3], #255
716        ldrh r9, [r2], #4
717        ldrh r3, [sp], #-4
718
719@ CHECK: ldrh.w	r1, [r8, r1]            @ encoding: [0x38,0xf8,0x01,0x10]
720@ CHECK: ldrh.w	r4, [r5, r2]            @ encoding: [0x35,0xf8,0x02,0x40]
721@ CHECK: ldrh.w	r6, [r0, r2, lsl #3]    @ encoding: [0x30,0xf8,0x32,0x60]
722@ CHECK: ldrh.w	r8, [r8, r2, lsl #2]    @ encoding: [0x38,0xf8,0x22,0x80]
723@ CHECK: ldrh.w	r7, [sp, r2, lsl #1]    @ encoding: [0x3d,0xf8,0x12,0x70]
724@ CHECK: ldrh.w	r7, [sp, r2]            @ encoding: [0x3d,0xf8,0x02,0x70]
725@ CHECK: ldrh	r5, [r8, #255]!         @ encoding: [0x38,0xf8,0xff,0x5f]
726@ CHECK: ldrh	r2, [r5, #4]!           @ encoding: [0x35,0xf8,0x04,0x2f]
727@ CHECK: ldrh	r1, [r4, #-4]!          @ encoding: [0x34,0xf8,0x04,0x1d]
728@ CHECK: ldrh	lr, [r3], #255          @ encoding: [0x33,0xf8,0xff,0xeb]
729@ CHECK: ldrh	r9, [r2], #4            @ encoding: [0x32,0xf8,0x04,0x9b]
730@ CHECK: ldrh	r3, [sp], #-4           @ encoding: [0x3d,0xf8,0x04,0x39]
731
732
733@------------------------------------------------------------------------------
734@ LDRH(literal)
735@------------------------------------------------------------------------------
736        ldrh r5, _bar
737
738@ CHECK: ldrh.w	r5, _bar                @ encoding: [0xbf'A',0xf8'A',A,0x50'A']
739@ CHECK:     @   fixup A - offset: 0, value: _bar, kind: fixup_t2_ldst_pcrel_12
740
741
742@------------------------------------------------------------------------------
743@ LDRSB(immediate)
744@------------------------------------------------------------------------------
745        ldrsb r5, [r5, #-4]
746        ldrsb r5, [r6, #32]
747        ldrsb r5, [r6, #33]
748        ldrsb r5, [r6, #257]
749        ldrsb.w lr, [r7, #257]
750
751@ CHECK: ldrsb	r5, [r5, #-4]            @ encoding: [0x15,0xf9,0x04,0x5c]
752@ CHECK: ldrsb.w r5, [r6, #32]           @ encoding: [0x96,0xf9,0x20,0x50]
753@ CHECK: ldrsb.w r5, [r6, #33]           @ encoding: [0x96,0xf9,0x21,0x50]
754@ CHECK: ldrsb.w r5, [r6, #257]          @ encoding: [0x96,0xf9,0x01,0x51]
755@ CHECK: ldrsb.w lr, [r7, #257]          @ encoding: [0x97,0xf9,0x01,0xe1]
756
757
758@------------------------------------------------------------------------------
759@ LDRSB(register)
760@------------------------------------------------------------------------------
761        ldrsb r1, [r8, r1]
762        ldrsb.w r4, [r5, r2]
763        ldrsb r6, [r0, r2, lsl #3]
764        ldrsb r8, [r8, r2, lsl #2]
765        ldrsb r7, [sp, r2, lsl #1]
766        ldrsb r7, [sp, r2, lsl #0]
767        ldrsb r5, [r8, #255]!
768        ldrsb r2, [r5, #4]!
769        ldrsb r1, [r4, #-4]!
770        ldrsb lr, [r3], #255
771        ldrsb r9, [r2], #4
772        ldrsb r3, [sp], #-4
773
774@ CHECK: ldrsb.w r1, [r8, r1]           @ encoding: [0x18,0xf9,0x01,0x10]
775@ CHECK: ldrsb.w r4, [r5, r2]           @ encoding: [0x15,0xf9,0x02,0x40]
776@ CHECK: ldrsb.w r6, [r0, r2, lsl #3]   @ encoding: [0x10,0xf9,0x32,0x60]
777@ CHECK: ldrsb.w r8, [r8, r2, lsl #2]   @ encoding: [0x18,0xf9,0x22,0x80]
778@ CHECK: ldrsb.w r7, [sp, r2, lsl #1]   @ encoding: [0x1d,0xf9,0x12,0x70]
779@ CHECK: ldrsb.w r7, [sp, r2]           @ encoding: [0x1d,0xf9,0x02,0x70]
780@ CHECK: ldrsb	r5, [r8, #255]!         @ encoding: [0x18,0xf9,0xff,0x5f]
781@ CHECK: ldrsb	r2, [r5, #4]!           @ encoding: [0x15,0xf9,0x04,0x2f]
782@ CHECK: ldrsb	r1, [r4, #-4]!          @ encoding: [0x14,0xf9,0x04,0x1d]
783@ CHECK: ldrsb	lr, [r3], #255          @ encoding: [0x13,0xf9,0xff,0xeb]
784@ CHECK: ldrsb	r9, [r2], #4            @ encoding: [0x12,0xf9,0x04,0x9b]
785@ CHECK: ldrsb	r3, [sp], #-4           @ encoding: [0x1d,0xf9,0x04,0x39]
786
787
788@------------------------------------------------------------------------------
789@ LDRSB(literal)
790@------------------------------------------------------------------------------
791        ldrsb r5, _bar
792
793@ CHECK: ldrsb.w r5, _bar               @ encoding: [0x9f'A',0xf9'A',A,0x50'A']
794@ CHECK:      @   fixup A - offset: 0, value: _bar, kind: fixup_t2_ldst_pcrel_12
795
796
797@------------------------------------------------------------------------------
798@ LDRSBT
799@------------------------------------------------------------------------------
800        ldrsbt r1, [r2]
801        ldrsbt r1, [r8, #0]
802        ldrsbt r1, [r8, #3]
803        ldrsbt r1, [r8, #255]
804
805@ CHECK: ldrsbt	r1, [r2]                @ encoding: [0x12,0xf9,0x00,0x1e]
806@ CHECK: ldrsbt	r1, [r8]                @ encoding: [0x18,0xf9,0x00,0x1e]
807@ CHECK: ldrsbt	r1, [r8, #3]            @ encoding: [0x18,0xf9,0x03,0x1e]
808@ CHECK: ldrsbt	r1, [r8, #255]          @ encoding: [0x18,0xf9,0xff,0x1e]
809
810
811@------------------------------------------------------------------------------
812@ LDRSH(immediate)
813@------------------------------------------------------------------------------
814        ldrsh r5, [r5, #-4]
815        ldrsh r5, [r6, #32]
816        ldrsh r5, [r6, #33]
817        ldrsh r5, [r6, #257]
818        ldrsh.w lr, [r7, #257]
819
820@ CHECK: ldrsh	r5, [r5, #-4]           @ encoding: [0x35,0xf9,0x04,0x5c]
821@ CHECK: ldrsh.w r5, [r6, #32]          @ encoding: [0xb6,0xf9,0x20,0x50]
822@ CHECK: ldrsh.w r5, [r6, #33]          @ encoding: [0xb6,0xf9,0x21,0x50]
823@ CHECK: ldrsh.w r5, [r6, #257]         @ encoding: [0xb6,0xf9,0x01,0x51]
824@ CHECK: ldrsh.w lr, [r7, #257]         @ encoding: [0xb7,0xf9,0x01,0xe1]
825
826
827@------------------------------------------------------------------------------
828@ LDRSH(register)
829@------------------------------------------------------------------------------
830        ldrsh r1, [r8, r1]
831        ldrsh.w r4, [r5, r2]
832        ldrsh r6, [r0, r2, lsl #3]
833        ldrsh r8, [r8, r2, lsl #2]
834        ldrsh r7, [sp, r2, lsl #1]
835        ldrsh r7, [sp, r2, lsl #0]
836        ldrsh r5, [r8, #255]!
837        ldrsh r2, [r5, #4]!
838        ldrsh r1, [r4, #-4]!
839        ldrsh lr, [r3], #255
840        ldrsh r9, [r2], #4
841        ldrsh r3, [sp], #-4
842
843@ CHECK: ldrsh.w r1, [r8, r1]           @ encoding: [0x38,0xf9,0x01,0x10]
844@ CHECK: ldrsh.w r4, [r5, r2]           @ encoding: [0x35,0xf9,0x02,0x40]
845@ CHECK: ldrsh.w r6, [r0, r2, lsl #3]   @ encoding: [0x30,0xf9,0x32,0x60]
846@ CHECK: ldrsh.w r8, [r8, r2, lsl #2]   @ encoding: [0x38,0xf9,0x22,0x80]
847@ CHECK: ldrsh.w r7, [sp, r2, lsl #1]   @ encoding: [0x3d,0xf9,0x12,0x70]
848@ CHECK: ldrsh.w r7, [sp, r2]           @ encoding: [0x3d,0xf9,0x02,0x70]
849@ CHECK: ldrsh	r5, [r8, #255]!         @ encoding: [0x38,0xf9,0xff,0x5f]
850@ CHECK: ldrsh	r2, [r5, #4]!           @ encoding: [0x35,0xf9,0x04,0x2f]
851@ CHECK: ldrsh	r1, [r4, #-4]!          @ encoding: [0x34,0xf9,0x04,0x1d]
852@ CHECK: ldrsh	lr, [r3], #255          @ encoding: [0x33,0xf9,0xff,0xeb]
853@ CHECK: ldrsh	r9, [r2], #4            @ encoding: [0x32,0xf9,0x04,0x9b]
854@ CHECK: ldrsh	r3, [sp], #-4           @ encoding: [0x3d,0xf9,0x04,0x39]
855
856
857@------------------------------------------------------------------------------
858@ LDRSH(literal)
859@------------------------------------------------------------------------------
860        ldrsh r5, _bar
861        ldrsh.w r4, #1435
862
863@ CHECK: ldrsh.w r5, _bar               @ encoding: [0xbf'A',0xf9'A',A,0x50'A']
864@ CHECK:      @   fixup A - offset: 0, value: _bar, kind: fixup_t2_ldst_pcrel_12
865@ CHECK: ldrsh.w r4, #1435               @ encoding: [0x3f,0xf9,0x9b,0x45]
866
867@------------------------------------------------------------------------------
868@ LDRSHT
869@------------------------------------------------------------------------------
870        ldrsht r1, [r2]
871        ldrsht r1, [r8, #0]
872        ldrsht r1, [r8, #3]
873        ldrsht r1, [r8, #255]
874
875@ CHECK: ldrsht	r1, [r2]                @ encoding: [0x32,0xf9,0x00,0x1e]
876@ CHECK: ldrsht	r1, [r8]                @ encoding: [0x38,0xf9,0x00,0x1e]
877@ CHECK: ldrsht	r1, [r8, #3]            @ encoding: [0x38,0xf9,0x03,0x1e]
878@ CHECK: ldrsht	r1, [r8, #255]          @ encoding: [0x38,0xf9,0xff,0x1e]
879
880
881@------------------------------------------------------------------------------
882@ LDRT
883@------------------------------------------------------------------------------
884        ldrt r1, [r2]
885        ldrt r2, [r6, #0]
886        ldrt r3, [r7, #3]
887        ldrt r4, [r9, #255]
888
889@ CHECK: ldrt	r1, [r2]                @ encoding: [0x52,0xf8,0x00,0x1e]
890@ CHECK: ldrt	r2, [r6]                @ encoding: [0x56,0xf8,0x00,0x2e]
891@ CHECK: ldrt	r3, [r7, #3]            @ encoding: [0x57,0xf8,0x03,0x3e]
892@ CHECK: ldrt	r4, [r9, #255]          @ encoding: [0x59,0xf8,0xff,0x4e]
893
894
895@------------------------------------------------------------------------------
896@ LSL (immediate)
897@------------------------------------------------------------------------------
898        lsl r2, r3, #12
899        lsls r8, r3, #31
900        lsls.w r2, r3, #1
901        lsl r2, r3, #4
902        lsls r2, r12, #15
903
904        lsl r3, #19
905        lsls r8, #2
906        lsls.w r7, #5
907        lsl.w r12, #21
908
909@ CHECK: lsl.w	r2, r3, #12             @ encoding: [0x4f,0xea,0x03,0x32]
910@ CHECK: lsls.w	r8, r3, #31             @ encoding: [0x5f,0xea,0xc3,0x78]
911@ CHECK: lsls.w	r2, r3, #1              @ encoding: [0x5f,0xea,0x43,0x02]
912@ CHECK: lsl.w	r2, r3, #4              @ encoding: [0x4f,0xea,0x03,0x12]
913@ CHECK: lsls.w	r2, r12, #15            @ encoding: [0x5f,0xea,0xcc,0x32]
914
915@ CHECK: lsl.w	r3, r3, #19             @ encoding: [0x4f,0xea,0xc3,0x43]
916@ CHECK: lsls.w	r8, r8, #2              @ encoding: [0x5f,0xea,0x88,0x08]
917@ CHECK: lsls.w	r7, r7, #5              @ encoding: [0x5f,0xea,0x47,0x17]
918@ CHECK: lsl.w	r12, r12, #21           @ encoding: [0x4f,0xea,0x4c,0x5c]
919
920
921@------------------------------------------------------------------------------
922@ LSL (register)
923@------------------------------------------------------------------------------
924        lsl r3, r4, r2
925        lsl.w r1, r2
926        lsls r3, r4, r8
927
928@ CHECK: lsl.w	r3, r4, r2              @ encoding: [0x04,0xfa,0x02,0xf3]
929@ CHECK: lsl.w	r1, r1, r2              @ encoding: [0x01,0xfa,0x02,0xf1]
930@ CHECK: lsls.w	r3, r4, r8              @ encoding: [0x14,0xfa,0x08,0xf3]
931
932
933@------------------------------------------------------------------------------
934@ LSR (immediate)
935@------------------------------------------------------------------------------
936        lsr r2, r3, #12
937        lsrs r8, r3, #32
938        lsrs.w r2, r3, #1
939        lsr r2, r3, #4
940        lsrs r2, r12, #15
941
942        lsr r3, #19
943        lsrs r8, #2
944        lsrs.w r7, #5
945        lsr.w r12, #21
946
947@ CHECK: lsr.w	r2, r3, #12             @ encoding: [0x4f,0xea,0x13,0x32]
948@ CHECK: lsrs.w	r8, r3, #32             @ encoding: [0x5f,0xea,0x13,0x08]
949@ CHECK: lsrs.w	r2, r3, #1              @ encoding: [0x5f,0xea,0x53,0x02]
950@ CHECK: lsr.w	r2, r3, #4              @ encoding: [0x4f,0xea,0x13,0x12]
951@ CHECK: lsrs.w	r2, r12, #15            @ encoding: [0x5f,0xea,0xdc,0x32]
952
953@ CHECK: lsr.w	r3, r3, #19             @ encoding: [0x4f,0xea,0xd3,0x43]
954@ CHECK: lsrs.w	r8, r8, #2              @ encoding: [0x5f,0xea,0x98,0x08]
955@ CHECK: lsrs.w	r7, r7, #5              @ encoding: [0x5f,0xea,0x57,0x17]
956@ CHECK: lsr.w	r12, r12, #21           @ encoding: [0x4f,0xea,0x5c,0x5c]
957
958
959@------------------------------------------------------------------------------
960@ LSR (register)
961@------------------------------------------------------------------------------
962        lsr r3, r4, r2
963        lsr.w r1, r2
964        lsrs r3, r4, r8
965
966@ CHECK: lsr.w	r3, r4, r2              @ encoding: [0x24,0xfa,0x02,0xf3]
967@ CHECK: lsr.w	r1, r1, r2              @ encoding: [0x21,0xfa,0x02,0xf1]
968@ CHECK: lsrs.w	r3, r4, r8              @ encoding: [0x34,0xfa,0x08,0xf3]
969
970@------------------------------------------------------------------------------
971@ MCR/MCR2
972@------------------------------------------------------------------------------
973        mcr  p7, #1, r5, c1, c1, #4
974        mcr2  p7, #1, r5, c1, c1, #4
975
976@ CHECK: mcr	p7, #1, r5, c1, c1, #4  @ encoding: [0x21,0xee,0x91,0x57]
977@ CHECK: mcr2	p7, #1, r5, c1, c1, #4  @ encoding: [0x21,0xfe,0x91,0x57]
978
979
980@------------------------------------------------------------------------------
981@ MCRR/MCRR2
982@------------------------------------------------------------------------------
983        mcrr  p7, #15, r5, r4, c1
984        mcrr2  p7, #15, r5, r4, c1
985
986@ CHECK: mcrr	p7, #15, r5, r4, c1     @ encoding: [0x44,0xec,0xf1,0x57]
987@ CHECK: mcrr2	p7, #15, r5, r4, c1     @ encoding: [0x44,0xfc,0xf1,0x57]
988
989
990@------------------------------------------------------------------------------
991@ MLA/MLS
992@------------------------------------------------------------------------------
993        mla  r1,r2,r3,r4
994        mls  r1,r2,r3,r4
995
996@ CHECK: mla	r1, r2, r3, r4          @ encoding: [0x02,0xfb,0x03,0x41]
997@ CHECK: mls	r1, r2, r3, r4          @ encoding: [0x02,0xfb,0x13,0x41]
998
999
1000@------------------------------------------------------------------------------
1001@ MOV(immediate)
1002@------------------------------------------------------------------------------
1003        movs r1, #21
1004        movs.w r1, #21
1005        movs r8, #21
1006        movw r0, #65535
1007        movw r1, #43777
1008        movw r1, #43792
1009        mov.w r0, #0x3fc0000
1010        mov r0, #0x3fc0000
1011        movs.w r0, #0x3fc0000
1012        itte eq
1013        movseq r1, #12
1014        moveq r1, #12
1015        movne.w r1, #12
1016
1017@ CHECK: movs	r1, #21                 @ encoding: [0x15,0x21]
1018@ CHECK: movs.w	r1, #21                 @ encoding: [0x5f,0xf0,0x15,0x01]
1019@ CHECK: movs.w	r8, #21                 @ encoding: [0x5f,0xf0,0x15,0x08]
1020@ CHECK: movw	r0, #65535              @ encoding: [0x4f,0xf6,0xff,0x70]
1021@ CHECK: movw	r1, #43777              @ encoding: [0x4a,0xf6,0x01,0x31]
1022@ CHECK: movw	r1, #43792              @ encoding: [0x4a,0xf6,0x10,0x31]
1023@ CHECK: mov.w	r0, #66846720           @ encoding: [0x4f,0xf0,0x7f,0x70]
1024@ CHECK: mov.w	r0, #66846720           @ encoding: [0x4f,0xf0,0x7f,0x70]
1025@ CHECK: movs.w	r0, #66846720           @ encoding: [0x5f,0xf0,0x7f,0x70]
1026@ CHECK: itte	eq                      @ encoding: [0x06,0xbf]
1027@ CHECK: movseq.w	r1, #12         @ encoding: [0x5f,0xf0,0x0c,0x01]
1028@ CHECK: moveq	r1, #12                 @ encoding: [0x0c,0x21]
1029@ CHECK: movne.w r1, #12                @ encoding: [0x4f,0xf0,0x0c,0x01]
1030
1031
1032@------------------------------------------------------------------------------
1033@ MOVT
1034@------------------------------------------------------------------------------
1035        movt r3, #7
1036        movt r6, #0xffff
1037        it eq
1038        movteq r4, #0xff0
1039
1040@ CHECK: movt	r3, #7                  @ encoding: [0xc0,0xf2,0x07,0x03]
1041@ CHECK: movt	r6, #65535              @ encoding: [0xcf,0xf6,0xff,0x76]
1042@ CHECK: it	eq                      @ encoding: [0x08,0xbf]
1043@ CHECK: movteq	r4, #4080               @ encoding: [0xc0,0xf6,0xf0,0x74]
1044
1045@------------------------------------------------------------------------------
1046@ MRC/MRC2
1047@------------------------------------------------------------------------------
1048        mrc  p14, #0, r1, c1, c2, #4
1049        mrc2  p14, #0, r1, c1, c2, #4
1050
1051@ CHECK: mrc	p14, #0, r1, c1, c2, #4 @ encoding: [0x11,0xee,0x92,0x1e]
1052@ CHECK: mrc2	p14, #0, r1, c1, c2, #4 @ encoding: [0x11,0xfe,0x92,0x1e]
1053
1054
1055@------------------------------------------------------------------------------
1056@ MRRC/MRRC2
1057@------------------------------------------------------------------------------
1058        mrrc  p7, #1, r5, r4, c1
1059        mrrc2  p7, #1, r5, r4, c1
1060
1061@ CHECK: mrrc	p7, #1, r5, r4, c1      @ encoding: [0x54,0xec,0x11,0x57]
1062@ CHECK: mrrc2	p7, #1, r5, r4, c1      @ encoding: [0x54,0xfc,0x11,0x57]
1063
1064
1065@------------------------------------------------------------------------------
1066@ MRS
1067@------------------------------------------------------------------------------
1068        mrs  r8, apsr
1069        mrs  r8, cpsr
1070        mrs  r8, spsr
1071
1072@ CHECK: mrs	r8, apsr                @ encoding: [0xef,0xf3,0x00,0x88]
1073@ CHECK: mrs	r8, apsr                @ encoding: [0xef,0xf3,0x00,0x88]
1074@ CHECK: mrs	r8, spsr                @ encoding: [0xff,0xf3,0x00,0x88]
1075
1076
1077@------------------------------------------------------------------------------
1078@ MSR
1079@------------------------------------------------------------------------------
1080        msr  apsr, r1
1081        msr  apsr_g, r2
1082        msr  apsr_nzcvq, r3
1083        msr  APSR_nzcvq, r4
1084        msr  apsr_nzcvqg, r5
1085        msr  cpsr_fc, r6
1086        msr  cpsr_c, r7
1087        msr  cpsr_x, r8
1088        msr  cpsr_fc, r9
1089        msr  cpsr_all, r11
1090        msr  cpsr_fsx, r12
1091        msr  spsr_fc, r0
1092        msr  SPSR_fsxc, r5
1093        msr  cpsr_fsxc, r8
1094
1095@ CHECK: msr	APSR_nzcvq, r1          @ encoding: [0x81,0xf3,0x00,0x88]
1096@ CHECK: msr	APSR_g, r2              @ encoding: [0x82,0xf3,0x00,0x84]
1097@ CHECK: msr	APSR_nzcvq, r3          @ encoding: [0x83,0xf3,0x00,0x88]
1098@ CHECK: msr	APSR_nzcvq, r4          @ encoding: [0x84,0xf3,0x00,0x88]
1099@ CHECK: msr	APSR_nzcvqg, r5         @ encoding: [0x85,0xf3,0x00,0x8c]
1100@ CHECK: msr	CPSR_fc, r6             @ encoding: [0x86,0xf3,0x00,0x89]
1101@ CHECK: msr	CPSR_c, r7              @ encoding: [0x87,0xf3,0x00,0x81]
1102@ CHECK: msr	CPSR_x, r8              @ encoding: [0x88,0xf3,0x00,0x82]
1103@ CHECK: msr	CPSR_fc, r9             @ encoding: [0x89,0xf3,0x00,0x89]
1104@ CHECK: msr	CPSR_fc, r11            @ encoding: [0x8b,0xf3,0x00,0x89]
1105@ CHECK: msr	CPSR_fsx, r12           @ encoding: [0x8c,0xf3,0x00,0x8e]
1106@ CHECK: msr	SPSR_fc, r0             @ encoding: [0x90,0xf3,0x00,0x89]
1107@ CHECK: msr	SPSR_fsxc, r5           @ encoding: [0x95,0xf3,0x00,0x8f]
1108@ CHECK: msr	CPSR_fsxc, r8           @ encoding: [0x88,0xf3,0x00,0x8f]
1109
1110
1111@------------------------------------------------------------------------------
1112@ MUL
1113@------------------------------------------------------------------------------
1114        muls r3, r4, r3
1115        mul r3, r4, r3
1116        mul r3, r4, r6
1117        it eq
1118        muleq r3, r4, r5
1119
1120@ CHECK: muls	r3, r4, r3              @ encoding: [0x63,0x43]
1121@ CHECK: mul	r3, r4, r3              @ encoding: [0x04,0xfb,0x03,0xf3]
1122@ CHECK: mul	r3, r4, r6              @ encoding: [0x04,0xfb,0x06,0xf3]
1123@ CHECK: it	eq                      @ encoding: [0x08,0xbf]
1124@ CHECK: muleq	r3, r4, r5              @ encoding: [0x04,0xfb,0x05,0xf3]
1125
1126
1127@------------------------------------------------------------------------------
1128@ MVN(immediate)
1129@------------------------------------------------------------------------------
1130        mvns r8, #21
1131        mvn r0, #0x3fc0000
1132        mvns r0, #0x3fc0000
1133        itte eq
1134        mvnseq r1, #12
1135        mvneq r1, #12
1136        mvnne r1, #12
1137
1138@ CHECK: mvns	r8, #21                 @ encoding: [0x7f,0xf0,0x15,0x08]
1139@ CHECK: mvn	r0, #66846720           @ encoding: [0x6f,0xf0,0x7f,0x70]
1140@ CHECK: mvns	r0, #66846720           @ encoding: [0x7f,0xf0,0x7f,0x70]
1141@ CHECK: itte	eq                      @ encoding: [0x06,0xbf]
1142@ CHECK: mvnseq	r1, #12                 @ encoding: [0x7f,0xf0,0x0c,0x01]
1143@ CHECK: mvneq	r1, #12                 @ encoding: [0x6f,0xf0,0x0c,0x01]
1144@ CHECK: mvnne	r1, #12                 @ encoding: [0x6f,0xf0,0x0c,0x01]
1145
1146
1147@------------------------------------------------------------------------------
1148@ MVN(register)
1149@------------------------------------------------------------------------------
1150        mvn r2, r3
1151        mvns r2, r3
1152        mvn r5, r6, lsl #19
1153        mvn r5, r6, lsr #9
1154        mvn r5, r6, asr #4
1155        mvn r5, r6, ror #6
1156        mvn r5, r6, rrx
1157        it eq
1158        mvneq r2, r3
1159
1160@ CHECK: mvn.w	r2, r3                  @ encoding: [0x6f,0xea,0x03,0x02]
1161@ CHECK: mvns	r2, r3                  @ encoding: [0xda,0x43]
1162@ CHECK: mvn.w	r5, r6, lsl #19         @ encoding: [0x6f,0xea,0xc6,0x45]
1163@ CHECK: mvn.w	r5, r6, lsr #9          @ encoding: [0x6f,0xea,0x56,0x25]
1164@ CHECK: mvn.w	r5, r6, asr #4          @ encoding: [0x6f,0xea,0x26,0x15]
1165@ CHECK: mvn.w	r5, r6, ror #6          @ encoding: [0x6f,0xea,0xb6,0x15]
1166@ CHECK: mvn.w	r5, r6, rrx             @ encoding: [0x6f,0xea,0x36,0x05]
1167@ CHECK: it	eq                      @ encoding: [0x08,0xbf]
1168@ CHECK: mvneq	r2, r3                  @ encoding: [0xda,0x43]
1169
1170@------------------------------------------------------------------------------
1171@ NOP
1172@------------------------------------------------------------------------------
1173        nop.w
1174
1175@ CHECK: nop.w                          @ encoding: [0xaf,0xf3,0x00,0x80]
1176
1177
1178@------------------------------------------------------------------------------
1179@ ORN
1180@------------------------------------------------------------------------------
1181        orn r4, r5, #0xf000
1182        orn r4, r5, r6
1183        orns r4, r5, r6
1184        orn r4, r5, r6, lsl #5
1185        orns r4, r5, r6, lsr #5
1186        orn r4, r5, r6, lsr #5
1187        orns r4, r5, r6, asr #5
1188        orn r4, r5, r6, ror #5
1189
1190@ CHECK: orn	r4, r5, #61440          @ encoding: [0x65,0xf4,0x70,0x44]
1191@ CHECK: orn	r4, r5, r6              @ encoding: [0x65,0xea,0x06,0x04]
1192@ CHECK: orns	r4, r5, r6              @ encoding: [0x75,0xea,0x06,0x04]
1193@ CHECK: orn	r4, r5, r6, lsl #5      @ encoding: [0x65,0xea,0x46,0x14]
1194@ CHECK: orns	r4, r5, r6, lsr #5      @ encoding: [0x75,0xea,0x56,0x14]
1195@ CHECK: orn	r4, r5, r6, lsr #5      @ encoding: [0x65,0xea,0x56,0x14]
1196@ CHECK: orns	r4, r5, r6, asr #5      @ encoding: [0x75,0xea,0x66,0x14]
1197@ CHECK: orn	r4, r5, r6, ror #5      @ encoding: [0x65,0xea,0x76,0x14]
1198
1199
1200@------------------------------------------------------------------------------
1201@ ORR
1202@------------------------------------------------------------------------------
1203        orr r4, r5, #0xf000
1204        orr r4, r5, r6
1205        orr r4, r5, r6, lsl #5
1206        orrs r4, r5, r6, lsr #5
1207        orr r4, r5, r6, lsr #5
1208        orrs r4, r5, r6, asr #5
1209        orr r4, r5, r6, ror #5
1210
1211@ CHECK: orr	r4, r5, #61440          @ encoding: [0x45,0xf4,0x70,0x44]
1212@ CHECK: orr.w	r4, r5, r6              @ encoding: [0x45,0xea,0x06,0x04]
1213@ CHECK: orr.w	r4, r5, r6, lsl #5      @ encoding: [0x45,0xea,0x46,0x14]
1214@ CHECK: orrs.w	r4, r5, r6, lsr #5      @ encoding: [0x55,0xea,0x56,0x14]
1215@ CHECK: orr.w	r4, r5, r6, lsr #5      @ encoding: [0x45,0xea,0x56,0x14]
1216@ CHECK: orrs.w	r4, r5, r6, asr #5      @ encoding: [0x55,0xea,0x66,0x14]
1217@ CHECK: orr.w	r4, r5, r6, ror #5      @ encoding: [0x45,0xea,0x76,0x14]
1218
1219
1220@------------------------------------------------------------------------------
1221@ IT
1222@------------------------------------------------------------------------------
1223@ Test encodings of a few full IT blocks, not just the IT instruction
1224
1225        iteet eq
1226        addeq r0, r1, r2
1227        nopne
1228        subne r5, r6, r7
1229        addeq r1, r2, #4
1230
1231@ CHECK: iteet	eq                      @ encoding: [0x0d,0xbf]
1232@ CHECK: addeq	r0, r1, r2              @ encoding: [0x88,0x18]
1233@ CHECK: nopne                          @ encoding: [0x00,0xbf]
1234@ CHECK: subne	r5, r6, r7              @ encoding: [0xf5,0x1b]
1235@ CHECK: addeq	r1, r2, #4              @ encoding: [0x11,0x1d]
1236
1237@------------------------------------------------------------------------------
1238@ SUB (register)
1239@------------------------------------------------------------------------------
1240        sub.w r5, r2, r12, rrx
1241
1242@ CHECK: sub.w r5, r2, r12, rrx        @ encoding: [0xa2,0xeb,0x3c,0x05]
1243
1244