1 @ RUN: llvm-mc -triple=thumbv6-apple-darwin -show-encoding < %s | FileCheck %s
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
12 @ FIXME: Some 3-operand instructions have a 2-operand assembly syntax.
17 @------------------------------------------------------------------------------
19 @------------------------------------------------------------------------------
22 @ CHECK: adcs r4, r6 @ encoding: [0x74,0x41]
25 @------------------------------------------------------------------------------
27 @------------------------------------------------------------------------------
32 @ CHECK: adds r1, r2, #3 @ encoding: [0xd1,0x1c]
33 @ CHECK: adds r2, r2, #3 @ encoding: [0xd2,0x1c]
34 @ CHECK: adds r2, #8 @ encoding: [0x08,0x32]
37 @------------------------------------------------------------------------------
39 @------------------------------------------------------------------------------
43 @ CHECK: adds r1, r2, r3 @ encoding: [0xd1,0x18]
44 @ CHECK: add r2, r8 @ encoding: [0x42,0x44]
47 @------------------------------------------------------------------------------
48 @ FIXME: ADD (SP plus immediate)
49 @------------------------------------------------------------------------------
50 @------------------------------------------------------------------------------
51 @ FIXME: ADD (SP plus register)
52 @------------------------------------------------------------------------------
55 @------------------------------------------------------------------------------
57 @------------------------------------------------------------------------------
60 @ CHECK: adr r2, _baz @ encoding: [A,0xa2]
61 @ fixup A - offset: 0, value: _baz, kind: fixup_thumb_adr_pcrel_10
64 @------------------------------------------------------------------------------
66 @------------------------------------------------------------------------------
71 @ CHECK: asrs r2, r3, #32 @ encoding: [0x1a,0x10]
72 @ CHECK: asrs r2, r3, #5 @ encoding: [0x5a,0x11]
73 @ CHECK: asrs r2, r3, #1 @ encoding: [0x5a,0x10]
76 @------------------------------------------------------------------------------
78 @------------------------------------------------------------------------------
81 @ CHECK: asrs r5, r2 @ encoding: [0x15,0x41]
84 @------------------------------------------------------------------------------
86 @------------------------------------------------------------------------------
90 @ CHECK: b _baz @ encoding: [A,0xe0'A']
91 @ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
92 @ CHECK: beq _bar @ encoding: [A,0xd0]
93 @ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
96 @------------------------------------------------------------------------------
98 @------------------------------------------------------------------------------
101 @ CHECK: bics r1, r6 @ encoding: [0xb1,0x43]
104 @------------------------------------------------------------------------------
106 @------------------------------------------------------------------------------
110 @ CHECK: bkpt #0 @ encoding: [0x00,0xbe]
111 @ CHECK: bkpt #255 @ encoding: [0xff,0xbe]
114 @------------------------------------------------------------------------------
116 @------------------------------------------------------------------------------
120 @ CHECK: bl _bar @ encoding: [A,0xf0'A',A,0xf8'A']
121 @ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bl
122 @ CHECK: blx _baz @ encoding: [A,0xf0'A',A,0xe8'A']
123 @ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_blx
126 @------------------------------------------------------------------------------
128 @------------------------------------------------------------------------------
131 @ CHECK: blx r4 @ encoding: [0xa0,0x47]
134 @------------------------------------------------------------------------------
136 @------------------------------------------------------------------------------
139 @ CHECK: bx r2 @ encoding: [0x10,0x47]
142 @------------------------------------------------------------------------------
144 @------------------------------------------------------------------------------
148 @ CHECK: cmn r5, r1 @ encoding: [0xcd,0x42]
151 @------------------------------------------------------------------------------
153 @------------------------------------------------------------------------------
158 @ CHECK: cmp r6, #32 @ encoding: [0x20,0x2e]
159 @ CHECK: cmp r3, r4 @ encoding: [0xa3,0x42]
160 @ CHECK: cmp r8, r1 @ encoding: [0x88,0x45]
162 @------------------------------------------------------------------------------
164 @------------------------------------------------------------------------------
167 @ CHECK: eors r4, r5 @ encoding: [0x6c,0x40]
170 @------------------------------------------------------------------------------
172 @------------------------------------------------------------------------------
173 ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7}
174 ldm r2!, {r1, r3, r4, r5, r7}
177 @ CHECK: ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7} @ encoding: [0xff,0xcb]
178 @ CHECK: ldm r2!, {r1, r3, r4, r5, r7} @ encoding: [0xba,0xca]
179 @ CHECK: ldm r1, {r1} @ encoding: [0x02,0xc9]
182 @------------------------------------------------------------------------------
184 @------------------------------------------------------------------------------
193 @ CHECK: ldr r1, [r5] @ encoding: [0x29,0x68]
194 @ CHECK: ldr r2, [r6, #32] @ encoding: [0x32,0x6a]
195 @ CHECK: ldr r3, [r7, #124] @ encoding: [0xfb,0x6f]
196 @ CHECK: ldr r1, [sp] @ encoding: [0x00,0x99]
197 @ CHECK: ldr r2, [sp, #24] @ encoding: [0x06,0x9a]
198 @ CHECK: ldr r3, [sp, #1020] @ encoding: [0xff,0x9b]
201 @------------------------------------------------------------------------------
203 @------------------------------------------------------------------------------
206 @ CHECK: ldr r1, _foo @ encoding: [A,0x49]
207 @ fixup A - offset: 0, value: _foo, kind: fixup_arm_thumb_cp
210 @------------------------------------------------------------------------------
212 @------------------------------------------------------------------------------
215 @ CHECK: ldr r1, [r2, r3] @ encoding: [0xd1,0x58]
218 @------------------------------------------------------------------------------
220 @------------------------------------------------------------------------------
225 @ CHECK: ldrb r4, [r3] @ encoding: [0x1c,0x78]
226 @ CHECK: ldrb r5, [r6] @ encoding: [0x35,0x78]
227 @ CHECK: ldrb r6, [r7, #31] @ encoding: [0xfe,0x7f]
230 @------------------------------------------------------------------------------
232 @------------------------------------------------------------------------------
235 @ CHECK: ldrb r6, [r4, r5] @ encoding: [0x66,0x5d]
238 @------------------------------------------------------------------------------
240 @------------------------------------------------------------------------------
245 @ CHECK: ldrh r3, [r3] @ encoding: [0x1b,0x88]
246 @ CHECK: ldrh r4, [r6, #2] @ encoding: [0x74,0x88]
247 @ CHECK: ldrh r5, [r7, #62] @ encoding: [0xfd,0x8f]
250 @------------------------------------------------------------------------------
252 @------------------------------------------------------------------------------
255 @ CHECK: ldrh r6, [r2, r6] @ encoding: [0x96,0x5b]
258 @------------------------------------------------------------------------------
260 @------------------------------------------------------------------------------
264 @ CHECK: ldrsb r6, [r2, r6] @ encoding: [0x96,0x57]
265 @ CHECK: ldrsh r3, [r7, r1] @ encoding: [0x7b,0x5e]
268 @------------------------------------------------------------------------------
270 @------------------------------------------------------------------------------
274 @ CHECK: lsls r4, r5, #0 @ encoding: [0x2c,0x00]
275 @ CHECK: lsls r4, r5, #4 @ encoding: [0x2c,0x01]
278 @------------------------------------------------------------------------------
280 @------------------------------------------------------------------------------
283 @ CHECK: lsls r2, r6 @ encoding: [0xb2,0x40]
286 @------------------------------------------------------------------------------
288 @------------------------------------------------------------------------------
292 @ CHECK: lsrs r1, r3, #1 @ encoding: [0x59,0x08]
293 @ CHECK: lsrs r1, r3, #32 @ encoding: [0x19,0x08]
296 @------------------------------------------------------------------------------
298 @------------------------------------------------------------------------------
301 @ CHECK: lsrs r2, r6 @ encoding: [0xf2,0x40]
304 @------------------------------------------------------------------------------
306 @------------------------------------------------------------------------------
311 @ CHECK: movs r2, #0 @ encoding: [0x00,0x22]
312 @ CHECK: movs r2, #255 @ encoding: [0xff,0x22]
313 @ CHECK: movs r2, #23 @ encoding: [0x17,0x22]
316 @------------------------------------------------------------------------------
318 @------------------------------------------------------------------------------
322 @ CHECK: mov r3, r4 @ encoding: [0x23,0x46]
323 @ CHECK: movs r1, r3 @ encoding: [0x19,0x00]
326 @------------------------------------------------------------------------------
328 @------------------------------------------------------------------------------
332 @ CHECK: muls r1, r2, r1 @ encoding: [0x51,0x43]
333 @ CHECK: muls r3, r4, r3 @ encoding: [0x63,0x43]
336 @------------------------------------------------------------------------------
338 @------------------------------------------------------------------------------
341 @ CHECK: mvns r6, r3 @ encoding: [0xde,0x43]
344 @------------------------------------------------------------------------------
346 @------------------------------------------------------------------------------
349 @ CHECK: rsbs r3, r4, #0 @ encoding: [0x63,0x42]