• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate move (immediate) ARM instruction.
2
3; REQUIRES: allow_dump
4
5; Compile using standalone assembler.
6; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \
7; RUN:   | FileCheck %s --check-prefix=ASM
8
9; Show bytes in assembled standalone code.
10; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
11; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
12
13; Compile using integrated assembler.
14; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
15; RUN:   | FileCheck %s --check-prefix=IASM
16
17; Show bytes in assembled integrated code.
18; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
19; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
20
21define internal i32 @Imm1() {
22  ret i32 1
23}
24
25; ASM-LABEL: Imm1:
26; ASM: mov      r0, #1
27
28; DIS-LABEL:00000000 <Imm1>:
29; DIS-NEXT:   0:        e3a00001
30
31; IASM-LABEL: Imm1:
32; IASM: .byte 0x1
33; IASM: .byte 0x0
34; IASM: .byte 0xa0
35; IASM: .byte 0xe3
36
37
38define internal i32 @rotateFImmAA() {
39  ; immediate = 0x000002a8 = b 0000 0000 0000 0000 0000 0010 1010 1000
40  ret i32 680
41}
42
43; ASM-LABEL: rotateFImmAA:
44; ASM: mov      r0, #680
45
46; DIS-LABEL:00000010 <rotateFImmAA>:
47; DIS-NEXT:  10:        e3a00faa
48
49; IASM-LABEL: rotateFImmAA:
50; IASM: .byte 0xaa
51; IASM: .byte 0xf
52; IASM: .byte 0xa0
53; IASM: .byte 0xe3
54
55define internal i32 @rotateEImmAA() {
56 ; immediate = 0x00000aa0 = b 0000 0000 0000 0000 0000 1010 1010 0000
57  ret i32 2720
58}
59
60; ASM-LABEL: rotateEImmAA:
61; ASM: mov      r0, #2720
62
63; DIS-LABEL:00000020 <rotateEImmAA>:
64; DIS-NEXT:  20:        e3a00eaa
65
66; IASM-LABEL: rotateEImmAA:
67; IASM: .byte 0xaa
68; IASM: .byte 0xe
69; IASM: .byte 0xa0
70; IASM: .byte 0xe3
71
72define internal i32 @rotateDImmAA() {
73  ; immediate = 0x00002a80 = b 0000 0000 0000 0000 0010 1010 1000 0000
74  ret i32 10880
75}
76
77; ASM-LABEL: rotateDImmAA:
78; ASM: mov      r0, #10880
79
80; DIS-LABEL:00000030 <rotateDImmAA>:
81; DIS-NEXT:  30:        e3a00daa
82
83; IASM-LABEL: rotateDImmAA:
84; IASM: .byte 0xaa
85; IASM: .byte 0xd
86; IASM: .byte 0xa0
87; IASM: .byte 0xe3
88
89define internal i32 @rotateCImmAA() {
90  ; immediate = 0x0000aa00 = b 0000 0000 0000 0000 1010 1010 0000 0000
91  ret i32 43520
92}
93
94; ASM-LABEL: rotateCImmAA:
95; ASM: mov      r0, #43520
96
97; DIS-LABEL:00000040 <rotateCImmAA>:
98; DIS-NEXT:  40:        e3a00caa
99
100; IASM-LABEL: rotateCImmAA:
101; IASM: .byte 0xaa
102; IASM: .byte 0xc
103; IASM: .byte 0xa0
104; IASM: .byte 0xe3
105
106define internal i32 @rotateBImmAA() {
107  ; immediate = 0x0002a800 = b 0000 0000 0000 0010 1010 1000 0000 0000
108  ret i32 174080
109}
110
111; ASM-LABEL: rotateBImmAA:
112; ASM: mov      r0, #174080
113
114; DIS-LABEL:00000050 <rotateBImmAA>:
115; DIS-NEXT:  50:        e3a00baa
116
117; IASM-LABEL: rotateBImmAA:
118; IASM: .byte 0xaa
119; IASM: .byte 0xb
120; IASM: .byte 0xa0
121; IASM: .byte 0xe3
122
123define internal i32 @rotateAImmAA() {
124  ; immediate = 0x000aa000 = b 0000 0000 0000 1010 1010 0000 0000 0000
125  ret i32 696320
126}
127
128; ASM-LABEL: rotateAImmAA:
129; ASM: mov      r0, #696320
130
131; DIS-LABEL:00000060 <rotateAImmAA>:
132; DIS-NEXT:  60:        e3a00aaa
133
134; IASM-LABEL: rotateAImmAA:
135; IASM: .byte 0xaa
136; IASM: .byte 0xa
137; IASM: .byte 0xa0
138; IASM: .byte 0xe3
139
140define internal i32 @rotate9ImmAA() {
141  ; immediate = 0x002a8000 = b 0000 0000 0010 1010 1000 0000 0000 0000
142  ret i32 2785280
143}
144
145; ASM-LABEL: rotate9ImmAA:
146; ASM: mov      r0, #2785280
147
148; DIS-LABEL:00000070 <rotate9ImmAA>:
149; DIS-NEXT:  70:        e3a009aa
150
151; IASM-LABEL: rotate9ImmAA:
152; IASM: .byte 0xaa
153; IASM: .byte 0x9
154; IASM: .byte 0xa0
155; IASM: .byte 0xe3
156
157define internal i32 @rotate8ImmAA() {
158  ; immediate = 0x00aa0000 = b 0000 0000 1010 1010 0000 0000 0000 0000
159  ret i32 11141120
160}
161
162; ASM-LABEL: rotate8ImmAA:
163; ASM: mov      r0, #11141120
164
165; DIS-LABEL:00000080 <rotate8ImmAA>:
166; DIS-NEXT:  80:        e3a008aa
167
168; IASM-LABEL: rotate8ImmAA:
169; IASM: .byte 0xaa
170; IASM: .byte 0x8
171; IASM: .byte 0xa0
172; IASM: .byte 0xe3
173
174define internal i32 @rotate7ImmAA() {
175  ; immediate = 0x02a80000 = b 0000 0010 1010 1000 0000 0000 0000 0000
176  ret i32 44564480
177}
178
179; ASM-LABEL: rotate7ImmAA:
180; ASM:  mov     r0, #44564480
181
182; DIS-LABEL:00000090 <rotate7ImmAA>:
183; DIS-NEXT:  90:        e3a007aa
184
185; IASM-LABEL: rotate7ImmAA:
186; IASM: .byte 0xaa
187; IASM: .byte 0x7
188; IASM: .byte 0xa0
189; IASM: .byte 0xe3
190
191define internal i32 @rotate6ImmAA() {
192  ; immediate = 0x0aa00000 = b 0000 1010 1010 0000 0000 0000 0000 0000
193  ret i32 178257920
194}
195
196; ASM-LABEL: rotate6ImmAA:
197; ASM:  mov     r0, #178257920
198
199; DIS-LABEL:000000a0 <rotate6ImmAA>:
200; DIS-NEXT:  a0:        e3a006aa
201
202; IASM-LABEL: rotate6ImmAA:
203; IASM: .byte 0xaa
204; IASM: .byte 0x6
205; IASM: .byte 0xa0
206; IASM: .byte 0xe3
207
208define internal i32 @rotate5ImmAA() {
209  ; immediate = 0x2a800000 = b 0010 1010 1000 0000 0000 0000 0000 0000
210  ret i32 713031680
211}
212
213; ASM-LABEL: rotate5ImmAA:
214; ASM:  mov     r0, #713031680
215
216; DIS-LABEL:000000b0 <rotate5ImmAA>:
217; DIS-NEXT:  b0:        e3a005aa
218
219; IASM-LABEL: rotate5ImmAA:
220; IASM: .byte 0xaa
221; IASM: .byte 0x5
222; IASM: .byte 0xa0
223; IASM: .byte 0xe3
224
225define internal i32 @rotate4ImmAA() {
226  ; immediate = 0xaa000000 = b 1010 1010 0000 0000 0000 0000 0000 0000
227  ret i32 2852126720
228}
229
230; ASM-LABEL: rotate4ImmAA:
231; ASM: mov      r0, #2852126720
232
233; DIS-LABEL:000000c0 <rotate4ImmAA>:
234; DIS-NEXT:  c0:        e3a004aa
235
236; IASM-LABEL: rotate4ImmAA:
237; IASM: .byte 0xaa
238; IASM: .byte 0x4
239; IASM: .byte 0xa0
240; IASM: .byte 0xe3
241
242define internal i32 @rotate3ImmAA() {
243  ; immediate = 0xa8000002 = b 1010 1000 0000 0000 0000 0000 0000 0010
244  ret i32 2818572290
245}
246
247; ASM-LABEL: rotate3ImmAA:
248; ASM: mov      r0, #2818572290
249
250; DIS-LABEL:000000d0 <rotate3ImmAA>:
251; DIS-NEXT:  d0:        e3a003aa
252
253; IASM-LABEL: rotate3ImmAA:
254; IASM: .byte 0xaa
255; IASM: .byte 0x3
256; IASM: .byte 0xa0
257; IASM: .byte 0xe3
258
259define internal i32 @rotate2ImmAA() {
260  ; immediate = 0xa000000a = b 1010 0000 0000 0000 0000 0000 0000 1010
261  ret i32 2684354570
262}
263
264; ASM-LABEL: rotate2ImmAA:
265; ASM:  mov     r0, #2684354570
266
267; DIS-LABEL:000000e0 <rotate2ImmAA>:
268; DIS-NEXT:  e0:        e3a002aa
269
270; IASM-LABEL: rotate2ImmAA:
271; IASM: .byte 0xaa
272; IASM: .byte 0x2
273; IASM: .byte 0xa0
274; IASM: .byte 0xe3
275
276define internal i32 @rotate1ImmAA() {
277  ; immediate = 0x8000002a = b 1000 1000 0000 0000 0000 0000 0010 1010
278  ret i32 2147483690
279}
280
281; ASM-LABEL: rotate1ImmAA:
282; ASM: mov      r0, #2147483690
283
284; DIS-LABEL:000000f0 <rotate1ImmAA>:
285; DIS-NEXT:  f0:        e3a001aa
286
287; IASM-LABEL: rotate1ImmAA:
288; IASM: .byte 0xaa
289; IASM: .byte 0x1
290; IASM: .byte 0xa0
291; IASM: .byte 0xe3
292
293define internal i32 @rotate0ImmAA() {
294  ; immediate = 0x000000aa = b 0000 0000 0000 0000 0000 0000 1010 1010
295  ret i32 170
296}
297
298; ASM-LABEL: rotate0ImmAA:
299; ASM: mov      r0, #170
300
301; DIS-LABEL:00000100 <rotate0ImmAA>:
302; DIS-NEXT: 100:        e3a000aa
303
304; IASM-LABEL: rotate0ImmAA:
305; IASM: .byte 0xaa
306; IASM: .byte 0x0
307; IASM: .byte 0xa0
308; IASM: .byte 0xe3
309