• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we handle constants in movw and mvt, when it isn't represented as
2; ConstantRelocatable (see mov-imm.ll for the ConstantRelocatable case).
3
4; REQUIRES: allow_dump
5
6; Compile using standalone assembler.
7; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 \
8; RUN:   --test-stack-extra 4084 | FileCheck %s --check-prefix=ASM
9
10; Show bytes in assembled standalone code.
11; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
12; RUN:   --args -Om1 --test-stack-extra 4084 | FileCheck %s --check-prefix=DIS
13
14; Compile using integrated assembler.
15; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
16; RUN:   --test-stack-extra 4084 | FileCheck %s --check-prefix=IASM
17
18; Show bytes in assembled integrated code.
19; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
20; RUN:   --args -Om1 --test-stack-extra 4084 \
21; RUN:   | FileCheck %s --check-prefix=DIS
22
23define internal i32 @foo(i32 %x) {
24entry:
25
26; ASM-LABEL: foo:
27; DIS-LABEL: 00000000 <foo>:
28; IASM-LABEL: foo:
29
30; ASM-NEXT: .Lfoo$entry:
31; IASM-NEXT: .Lfoo$entry:
32
33; ASM-NEXT:     movw    ip, #4092
34; DIS-NEXT:    0:       e300cffc
35; IASM-NEXT:    .byte 0xfc
36; IASM-NEXT:    .byte 0xcf
37; IASM-NEXT:    .byte 0x0
38; IASM-NEXT:    .byte 0xe3
39
40; ASM-NEXT:     sub     sp, sp, ip
41; DIS-NEXT:    4:       e04dd00c
42; IASM-NEXT:    .byte 0xc
43; IASM-NEXT:    .byte 0xd0
44; IASM-NEXT:    .byte 0x4d
45; IASM-NEXT:    .byte 0xe0
46
47; ASM-NEXT:     str     r0, [sp, #4088]
48; DIS-NEXT:    8:       e58d0ff8
49; IASM-NEXT:    .byte 0xf8
50; IASM-NEXT:    .byte 0xf
51; IASM-NEXT:    .byte 0x8d
52; IASM-NEXT:    .byte 0xe5
53
54; ASM-NEXT:     # [sp, #4088] = def.pseudo
55
56  %mul = mul i32 %x, %x
57
58; ASM-NEXT:     ldr     r0, [sp, #4088]
59; DIS-NEXT:    c:       e59d0ff8
60; IASM-NEXT:    .byte 0xf8
61; IASM-NEXT:    .byte 0xf
62; IASM-NEXT:    .byte 0x9d
63; IASM-NEXT:    .byte 0xe5
64
65; ASM-NEXT:     ldr     r1, [sp, #4088]
66; DIS-NEXT:   10:       e59d1ff8
67; IASM-NEXT:    .byte 0xf8
68; IASM-NEXT:    .byte 0x1f
69; IASM-NEXT:    .byte 0x9d
70; IASM-NEXT:    .byte 0xe5
71
72; ASM-NEXT:     mul     r0, r0, r1
73; DIS-NEXT:   14:       e0000190
74; IASM-NEXT:    .byte 0x90
75; IASM-NEXT:    .byte 0x1
76; IASM-NEXT:    .byte 0x0
77; IASM-NEXT:    .byte 0xe0
78
79; ASM-NEXT:     str     r0, [sp, #4084]
80; DIS-NEXT:   18:       e58d0ff4
81; IASM-NEXT:    .byte 0xf4
82; IASM-NEXT:    .byte 0xf
83; IASM-NEXT:    .byte 0x8d
84; IASM-NEXT:    .byte 0xe5
85
86; ASM-NEXT:     # [sp, #4084] = def.pseudo
87
88  ret i32 %mul
89
90; ASM-NEXT:     ldr     r0, [sp, #4084]
91; DIS-NEXT:   1c:       e59d0ff4
92; IASM-NEXT:    .byte 0xf4
93; IASM-NEXT:    .byte 0xf
94; IASM-NEXT:    .byte 0x9d
95; IASM-NEXT:    .byte 0xe5
96
97; ASM-NEXT:     movw    ip, #4092
98; DIS-NEXT:   20:       e300cffc
99; IASM-NEXT:    .byte 0xfc
100; IASM-NEXT:    .byte 0xcf
101; IASM-NEXT:    .byte 0x0
102; IASM-NEXT:    .byte 0xe3
103
104; ASM-NEXT:     add     sp, sp, ip
105; DIS-NEXT:   24:       e08dd00c
106; IASM-NEXT:    .byte 0xc
107; IASM-NEXT:    .byte 0xd0
108; IASM-NEXT:    .byte 0x8d
109; IASM-NEXT:    .byte 0xe0
110
111; ASM-NEXT:     bx      lr
112; DIS-NEXT:   28:       e12fff1e
113; IASM-NEXT:    .byte 0x1e
114; IASM-NEXT:    .byte 0xff
115; IASM-NEXT:    .byte 0x2f
116; IASM-NEXT:    .byte 0xe1
117
118}
119
120define internal void @saveConstI32(i32 %loc) {
121; ASM-LABEL:saveConstI32:
122; DIS-LABEL:00000030 <saveConstI32>:
123; IASM-LABEL:saveConstI32:
124
125entry:
126; ASM-NEXT:.LsaveConstI32$entry:
127; IASM-NEXT:.LsaveConstI32$entry:
128
129; ASM-NEXT:     movw    ip, #4088
130; DIS-NEXT:  30:        e300cff8
131; IASM-NEXT:    .byte 0xf8
132; IASM-NEXT:    .byte 0xcf
133; IASM-NEXT:    .byte 0x0
134; IASM-NEXT:    .byte 0xe3
135
136; ASM-NEXT:     sub     sp, sp, ip
137; DIS-NEXT:  34:        e04dd00c
138; IASM-NEXT:    .byte 0xc
139; IASM-NEXT:    .byte 0xd0
140; IASM-NEXT:    .byte 0x4d
141; IASM-NEXT:    .byte 0xe0
142
143; ASM-NEXT:     str     r0, [sp, #4084]
144; ASM-NEXT:     # [sp, #4084] = def.pseudo
145; DIS-NEXT:  38:        e58d0ff4
146; IASM-NEXT:    .byte 0xf4
147; IASM-NEXT:    .byte 0xf
148; IASM-NEXT:    .byte 0x8d
149; IASM-NEXT:    .byte 0xe5
150
151  %loc.asptr = inttoptr i32 %loc to i32*
152  store i32 524289, i32* %loc.asptr, align 1
153
154; ASM-NEXT:     ldr     r0, [sp, #4084]
155; DIS-NEXT:  3c:        e59d0ff4
156; IASM-NEXT:    .byte 0xf4
157; IASM-NEXT:    .byte 0xf
158; IASM-NEXT:    .byte 0x9d
159; IASM-NEXT:    .byte 0xe5
160
161; ASM-NEXT:     movw     r1, #1
162; DIS-NEXT:  40:        e3001001
163; IASM-NEXT:    .byte 0x1
164; IASM-NEXT:    .byte 0x10
165; IASM-NEXT:    .byte 0x0
166; IASM-NEXT:    .byte 0xe3
167
168; ASM-NEXT:     movt    r1, #8
169; DIS-NEXT:  44:        e3401008
170; IASM-NEXT:    .byte 0x8
171; IASM-NEXT:    .byte 0x10
172; IASM-NEXT:    .byte 0x40
173; IASM-NEXT:    .byte 0xe3
174
175; ASM-NEXT:     str     r1, [r0]
176; DIS-NEXT:  48:        e5801000
177; IASM-NEXT:    .byte 0x0
178; IASM-NEXT:    .byte 0x10
179; IASM-NEXT:    .byte 0x80
180; IASM-NEXT:    .byte 0xe5
181
182  ret void
183
184; ASM-NEXT:     movw    ip, #4088
185; DIS-NEXT:  4c:        e300cff8
186; IASM-NEXT:    .byte 0xf8
187; IASM-NEXT:    .byte 0xcf
188; IASM-NEXT:    .byte 0x0
189; IASM-NEXT:    .byte 0xe3
190
191; ASM-NEXT:     add     sp, sp, ip
192; DIS-NEXT:  50:        e08dd00c
193; IASM-NEXT:    .byte 0xc
194; IASM-NEXT:    .byte 0xd0
195; IASM-NEXT:    .byte 0x8d
196; IASM-NEXT:    .byte 0xe0
197
198; ASM-NEXT:     bx      lr
199; DIS-NEXT:  54:        e12fff1e
200; IASM-NEXT:    .byte 0x1e
201; IASM-NEXT:    .byte 0xff
202; IASM-NEXT:    .byte 0x2f
203; IASM-NEXT:    .byte 0xe1
204}
205