basic-arm-instructions.s revision 37ee464ea98544d3ed84cec6dde5f769ce003d5f
13f00e317064560ad11168d22030416d853829f6eJim Grosbach@ RUN: llvm-mc -triple=armv7-apple-darwin -show-encoding < %s | FileCheck %s
23f00e317064560ad11168d22030416d853829f6eJim Grosbach  .syntax unified
33f00e317064560ad11168d22030416d853829f6eJim Grosbach  .globl _func
4e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
5e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ Check that the assembler can handle the documented syntax from the ARM ARM.
6e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ For complex constructs like shifter operands, check more thoroughly for them
7e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ once then spot check that following instructions accept the form generally.
8e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ This gives us good coverage while keeping the overall size of the test
9e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ more reasonable.
10e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
113f00e317064560ad11168d22030416d853829f6eJim Grosbach_func:
123f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: _func
133f00e317064560ad11168d22030416d853829f6eJim Grosbach
143f00e317064560ad11168d22030416d853829f6eJim Grosbach@ ADC (immediate)
153f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf
163f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf0
173f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf00
183f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf000
193f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf0000
203f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf00000
213f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf000000
223f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf0000000
233f00e317064560ad11168d22030416d853829f6eJim Grosbach  adc r1, r2, #0xf000000f
243f00e317064560ad11168d22030416d853829f6eJim Grosbach  adcs r1, r2, #0xf00
253f00e317064560ad11168d22030416d853829f6eJim Grosbach  adcseq r1, r2, #0xf00
26dc89561fecf100d6c32d73c7b009fd73e51be688Jim Grosbach  adceq r1, r2, #0xf00
273f00e317064560ad11168d22030416d853829f6eJim Grosbach
283f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #15             @ encoding: [0x0f,0x10,0xa2,0xe2]
293f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #240            @ encoding: [0xf0,0x10,0xa2,0xe2]
303f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #3840           @ encoding: [0x0f,0x1c,0xa2,0xe2]
313f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #61440          @ encoding: [0x0f,0x1a,0xa2,0xe2]
323f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #983040         @ encoding: [0x0f,0x18,0xa2,0xe2]
333f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #15728640       @ encoding: [0x0f,0x16,0xa2,0xe2]
343f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #251658240      @ encoding: [0x0f,0x14,0xa2,0xe2]
353f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #4026531840     @ encoding: [0x0f,0x12,0xa2,0xe2]
363f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adc	r1, r2, #4026531855     @ encoding: [0xff,0x12,0xa2,0xe2]
373f00e317064560ad11168d22030416d853829f6eJim Grosbach
383f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adcs	r1, r2, #3840           @ encoding: [0x0f,0x1c,0xb2,0xe2]
393f00e317064560ad11168d22030416d853829f6eJim Grosbach@ CHECK: adcseq	r1, r2, #3840           @ encoding: [0x0f,0x1c,0xb2,0x02]
40dc89561fecf100d6c32d73c7b009fd73e51be688Jim Grosbach@ CHECK: adceq	r1, r2, #3840           @ encoding: [0x0f,0x1c,0xa2,0x02]
41e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
42e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ ADC (register)
43e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6
44e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  @ Constant shifts
45e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, lsl #1
46e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, lsl #31
47e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, lsr #1
48e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, lsr #31
49e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, lsr #32
50e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, asr #1
51e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, asr #31
52e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, asr #32
53e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, ror #1
54e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, ror #31
55e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
56e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  @ Register shifts
57e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r6, r7, r8, lsl r9
58e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r6, r7, r8, lsr r9
59e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r6, r7, r8, asr r9
60e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r6, r7, r8, ror r9
61e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach  adc r4, r5, r6, rrx
62e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
6337ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  @ Destination register is optional
6437ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r5, r6
6537ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, lsl #1
6637ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, lsl #31
6737ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, lsr #1
6837ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, lsr #31
6937ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, lsr #32
7037ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, asr #1
7137ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, asr #31
7237ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, asr #32
7337ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, ror #1
7437ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, ror #31
7537ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, rrx
7637ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r6, r7, lsl r9
7737ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r6, r7, lsr r9
7837ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r6, r7, asr r9
7937ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r6, r7, ror r9
8037ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach  adc r4, r5, rrx
8137ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach
82e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6              @ encoding: [0x06,0x40,0xa5,0xe0]
83e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
84e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, lsl #1      @ encoding: [0x86,0x40,0xa5,0xe0]
85e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, lsl #31     @ encoding: [0x86,0x4f,0xa5,0xe0]
86e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, lsr #1      @ encoding: [0xa6,0x40,0xa5,0xe0]
87e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, lsr #31     @ encoding: [0xa6,0x4f,0xa5,0xe0]
88e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, lsr #32     @ encoding: [0x26,0x40,0xa5,0xe0]
89e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, asr #1      @ encoding: [0xc6,0x40,0xa5,0xe0]
90e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, asr #31     @ encoding: [0xc6,0x4f,0xa5,0xe0]
91e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, asr #32     @ encoding: [0x46,0x40,0xa5,0xe0]
92e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, ror #1      @ encoding: [0xe6,0x40,0xa5,0xe0]
93e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, ror #31     @ encoding: [0xe6,0x4f,0xa5,0xe0]
94e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
95e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r6, r7, r8, lsl r9      @ encoding: [0x18,0x69,0xa7,0xe0]
96e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r6, r7, r8, lsr r9      @ encoding: [0x38,0x69,0xa7,0xe0]
97e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r6, r7, r8, asr r9      @ encoding: [0x58,0x69,0xa7,0xe0]
98e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r6, r7, r8, ror r9      @ encoding: [0x78,0x69,0xa7,0xe0]
99e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach@ CHECK: adc	r4, r5, r6, rrx         @ encoding: [0x66,0x40,0xa5,0xe0]
100e8606dc7c878d4562da5e3e5609b9d7d734d498cJim Grosbach
10137ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r5, r5, r6              @ encoding: [0x06,0x50,0xa5,0xe0]
10237ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, lsl #1      @ encoding: [0x85,0x40,0xa4,0xe0]
10337ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, lsl #31     @ encoding: [0x85,0x4f,0xa4,0xe0]
10437ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, lsr #1      @ encoding: [0xa5,0x40,0xa4,0xe0]
10537ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, lsr #31     @ encoding: [0xa5,0x4f,0xa4,0xe0]
10637ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, lsr #32     @ encoding: [0x25,0x40,0xa4,0xe0]
10737ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, asr #1      @ encoding: [0xc5,0x40,0xa4,0xe0]
10837ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, asr #31     @ encoding: [0xc5,0x4f,0xa4,0xe0]
10937ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, asr #32     @ encoding: [0x45,0x40,0xa4,0xe0]
11037ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, ror #1      @ encoding: [0xe5,0x40,0xa4,0xe0]
11137ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, ror #31     @ encoding: [0xe5,0x4f,0xa4,0xe0]
11237ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, rrx         @ encoding: [0x65,0x40,0xa4,0xe0]
11337ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r6, r6, r7, lsl r9      @ encoding: [0x17,0x69,0xa6,0xe0]
11437ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r6, r6, r7, lsr r9      @ encoding: [0x37,0x69,0xa6,0xe0]
11537ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r6, r6, r7, asr r9      @ encoding: [0x57,0x69,0xa6,0xe0]
11637ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r6, r6, r7, ror r9      @ encoding: [0x77,0x69,0xa6,0xe0]
11737ee464ea98544d3ed84cec6dde5f769ce003d5fJim Grosbach@ CHECK: adc	r4, r4, r5, rrx         @ encoding: [0x65,0x40,0xa4,0xe0]
118