1 # RUN: llvm-mc -triple arm64-apple-darwin --disassemble < %s | FileCheck %s
3 #==---------------------------------------------------------------------------==
4 # Add/Subtract with carry/borrow
5 #==---------------------------------------------------------------------------==
12 # CHECK: adc w1, w2, w3
13 # CHECK: adc x1, x2, x3
14 # CHECK: adcs w5, w4, w3
15 # CHECK: adcs x5, x4, x3
22 # CHECK: sbc w1, w2, w3
23 # CHECK: sbc x1, x2, x3
24 # CHECK: sbcs w1, w2, w3
25 # CHECK: sbcs x1, x2, x3
27 #==---------------------------------------------------------------------------==
28 # Add/Subtract with (optionally shifted) immediate
29 #==---------------------------------------------------------------------------==
34 # CHECK: add w3, w4, #1024
35 # CHECK: add x3, x4, #1024
43 # CHECK: add w3, w4, #1024, lsl #12
44 # CHECK: add x3, x4, #1024, lsl #12
45 # CHECK: add x3, x4, #0, lsl #12
46 # CHECK: add sp, sp, #32
54 # CHECK: adds w3, w4, #1024
55 # CHECK: adds w3, w4, #1024, lsl #12
56 # CHECK: adds x3, x4, #1024
57 # CHECK: adds x3, x4, #1024, lsl #12
66 # CHECK: sub w3, w4, #1024
67 # CHECK: sub w3, w4, #1024, lsl #12
68 # CHECK: sub x3, x4, #1024
69 # CHECK: sub x3, x4, #1024, lsl #12
70 # CHECK: sub sp, sp, #32
78 # CHECK: subs w3, w4, #1024
79 # CHECK: subs w3, w4, #1024, lsl #12
80 # CHECK: subs x3, x4, #1024
81 # CHECK: subs x3, x4, #1024, lsl #12
84 #==---------------------------------------------------------------------------==
85 # Add/Subtract register with (optional) shift
86 #==---------------------------------------------------------------------------==
97 # CHECK: add w12, w13, w14
98 # CHECK: add x12, x13, x14
99 # CHECK: add w12, w13, w14, lsl #12
100 # CHECK: add x12, x13, x14, lsl #12
101 # CHECK: add w12, w13, w14, lsr #10
102 # CHECK: add x12, x13, x14, lsr #10
103 # CHECK: add w12, w13, w14, asr #7
104 # CHECK: add x12, x13, x14, asr #39
115 # CHECK: sub w12, w13, w14
116 # CHECK: sub x12, x13, x14
117 # CHECK: sub w12, w13, w14, lsl #12
118 # CHECK: sub x12, x13, x14, lsl #12
119 # CHECK: sub w12, w13, w14, lsr #10
120 # CHECK: sub x12, x13, x14, lsr #10
121 # CHECK: sub w12, w13, w14, asr #7
122 # CHECK: sub x12, x13, x14, asr #39
133 # CHECK: adds w12, w13, w14
134 # CHECK: adds x12, x13, x14
135 # CHECK: adds w12, w13, w14, lsl #12
136 # CHECK: adds x12, x13, x14, lsl #12
137 # CHECK: adds w12, w13, w14, lsr #10
138 # CHECK: adds x12, x13, x14, lsr #10
139 # CHECK: adds w12, w13, w14, asr #7
140 # CHECK: adds x12, x13, x14, asr #39
151 # CHECK: subs w12, w13, w14
152 # CHECK: subs x12, x13, x14
153 # CHECK: subs w12, w13, w14, lsl #12
154 # CHECK: subs x12, x13, x14, lsl #12
155 # CHECK: subs w12, w13, w14, lsr #10
156 # CHECK: subs x12, x13, x14, lsr #10
157 # CHECK: subs w12, w13, w14, asr #7
158 # CHECK: subs x12, x13, x14, asr #39
160 #==---------------------------------------------------------------------------==
161 # Add/Subtract with (optional) extend
162 #==---------------------------------------------------------------------------==
173 # CHECK: add w1, w2, w3, uxtb
174 # CHECK: add w1, w2, w3, uxth
175 # CHECK: add w1, w2, w3
176 # CHECK: add w1, w2, w3, uxtx
177 # CHECK: add w1, w2, w3, sxtb
178 # CHECK: add w1, w2, w3, sxth
179 # CHECK: add w1, w2, w3, sxtw
180 # CHECK: add w1, w2, w3, sxtx
189 # CHECK: add x1, x2, w3, uxtb
190 # CHECK: add x1, x2, w3, uxth
191 # CHECK: add x1, x2, w3, uxtw
192 # CHECK: add x1, x2, w3, sxtb
193 # CHECK: add x1, x2, w3, sxth
194 # CHECK: add x1, x2, w3, sxtw
201 # CHECK: add w1, wsp, w3
202 # CHECK: add w1, wsp, w3
203 # CHECK: add sp, x2, x3
204 # CHECK: add sp, x2, x3
215 # CHECK: sub w1, w2, w3, uxtb
216 # CHECK: sub w1, w2, w3, uxth
217 # CHECK: sub w1, w2, w3
218 # CHECK: sub w1, w2, w3, uxtx
219 # CHECK: sub w1, w2, w3, sxtb
220 # CHECK: sub w1, w2, w3, sxth
221 # CHECK: sub w1, w2, w3, sxtw
222 # CHECK: sub w1, w2, w3, sxtx
231 # CHECK: sub x1, x2, w3, uxtb
232 # CHECK: sub x1, x2, w3, uxth
233 # CHECK: sub x1, x2, w3, uxtw
234 # CHECK: sub x1, x2, w3, sxtb
235 # CHECK: sub x1, x2, w3, sxth
236 # CHECK: sub x1, x2, w3, sxtw
243 # CHECK: sub w1, wsp, w3
244 # CHECK: sub w1, wsp, w3
245 # CHECK: sub sp, x2, x3
246 # CHECK: sub sp, x2, x3
257 # CHECK: adds w1, w2, w3, uxtb
258 # CHECK: adds w1, w2, w3, uxth
259 # CHECK: adds w1, w2, w3
260 # CHECK: adds w1, w2, w3, uxtx
261 # CHECK: adds w1, w2, w3, sxtb
262 # CHECK: adds w1, w2, w3, sxth
263 # CHECK: adds w1, w2, w3, sxtw
264 # CHECK: adds w1, w2, w3, sxtx
273 # CHECK: adds x1, x2, w3, uxtb
274 # CHECK: adds x1, x2, w3, uxth
275 # CHECK: adds x1, x2, w3, uxtw
276 # CHECK: adds x1, x2, w3, sxtb
277 # CHECK: adds x1, x2, w3, sxth
278 # CHECK: adds x1, x2, w3, sxtw
283 # CHECK: adds w1, wsp, w3
284 # CHECK: adds w1, wsp, w3
295 # CHECK: subs w1, w2, w3, uxtb
296 # CHECK: subs w1, w2, w3, uxth
297 # CHECK: subs w1, w2, w3
298 # CHECK: subs w1, w2, w3, uxtx
299 # CHECK: subs w1, w2, w3, sxtb
300 # CHECK: subs w1, w2, w3, sxth
301 # CHECK: subs w1, w2, w3, sxtw
302 # CHECK: subs w1, w2, w3, sxtx
311 # CHECK: subs x1, x2, w3, uxtb
312 # CHECK: subs x1, x2, w3, uxth
313 # CHECK: subs x1, x2, w3, uxtw
314 # CHECK: subs x1, x2, w3, sxtb
315 # CHECK: subs x1, x2, w3, sxth
316 # CHECK: subs x1, x2, w3, sxtw
321 # CHECK: subs w1, wsp, w3
322 # CHECK: subs w1, wsp, w3
329 # CHECK: cmp x8, w8, uxtw
330 # CHECK: cmp w9, w8, uxtw
343 # CHECK: sub wsp, w9, w8
344 # CHECK: sub w1, wsp, w8
345 # CHECK: sub wsp, wsp, w8
346 # CHECK: sub sp, x9, w8
347 # CHECK: sub x1, sp, w8
348 # CHECK: sub sp, sp, w8
349 # CHECK: subs w1, wsp, w8
350 # CHECK: subs x1, sp, w8
352 #==---------------------------------------------------------------------------==
353 # Signed/Unsigned divide
354 #==---------------------------------------------------------------------------==
361 # CHECK: sdiv w1, w2, w3
362 # CHECK: sdiv x1, x2, x3
363 # CHECK: udiv w1, w2, w3
364 # CHECK: udiv x1, x2, x3
366 #==---------------------------------------------------------------------------==
368 #==---------------------------------------------------------------------------==
371 # CHECK: asr w1, w2, w3
373 # CHECK: asr x1, x2, x3
375 # CHECK: lsl w1, w2, w3
377 # CHECK: lsl x1, x2, x3
379 # CHECK: lsr w1, w2, w3
381 # CHECK: lsr x1, x2, x3
383 # CHECK: ror w1, w2, w3
385 # CHECK: ror x1, x2, x3
387 #==---------------------------------------------------------------------------==
388 # One operand instructions
389 #==---------------------------------------------------------------------------==
408 # CHECK: rev16 w1, w2
410 # CHECK: rev16 x1, x2
412 # CHECK: rev32 x1, x2
414 #==---------------------------------------------------------------------------==
415 # 6.6.1 Multiply-add instructions
416 #==---------------------------------------------------------------------------==
427 # CHECK: madd w1, w2, w3, w4
428 # CHECK: madd x1, x2, x3, x4
429 # CHECK: msub w1, w2, w3, w4
430 # CHECK: msub x1, x2, x3, x4
431 # CHECK: smaddl x1, w2, w3, x4
432 # CHECK: smsubl x1, w2, w3, x4
433 # CHECK: umaddl x1, w2, w3, x4
434 # CHECK: umsubl x1, w2, w3, x4
436 #==---------------------------------------------------------------------------==
437 # Multiply-high instructions
438 #==---------------------------------------------------------------------------==
443 # CHECK: smulh x1, x2, x3
444 # CHECK: umulh x1, x2, x3
446 #==---------------------------------------------------------------------------==
447 # Move immediate instructions
448 #==---------------------------------------------------------------------------==
457 # CHECK: mov w0, #65536
458 # CHECK: mov x0, #65536
467 # CHECK: mov w0, #-131073
468 # CHECK: mov x0, #-131073
477 # CHECK: movk w0, #1, lsl #16
478 # CHECK: movk x0, #1, lsl #16
480 #==---------------------------------------------------------------------------==
481 # Conditionally set flags instructions
482 #==---------------------------------------------------------------------------==
490 # CHECK: ccmn w1, #2, #3, eq
492 # CHECK: ccmn x1, #2, #3, eq
494 # CHECK: ccmp w1, #2, #3, eq
496 # CHECK: ccmp x1, #2, #3, eq
499 # CHECK: ccmn w1, w2, #3, eq
501 # CHECK: ccmn x1, x2, #3, eq
503 # CHECK: ccmp w1, w2, #3, eq
505 # CHECK: ccmp x1, x2, #3, eq
507 #==---------------------------------------------------------------------------==
508 # Conditional select instructions
509 #==---------------------------------------------------------------------------==
512 # CHECK: csel w1, w2, w3, eq
514 # CHECK: csel x1, x2, x3, eq
516 # CHECK: csinc w1, w2, w3, eq
518 # CHECK: csinc x1, x2, x3, eq
520 # CHECK: csinv w1, w2, w3, eq
522 # CHECK: csinv x1, x2, x3, eq
524 # CHECK: csneg w1, w2, w3, eq
526 # CHECK: csneg x1, x2, x3, eq