Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: tests_lit/llvm2ice_tests/int-arg.ll

Issue 1127963004: Subzero ARM: lowerArguments (GPR), basic legalize(), and lowerRet(i32, i64). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix warnings, etc Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceUtils.h ('k') | tests_lit/llvm2ice_tests/return_immediates.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; This file checks that Subzero generates code in accordance with the
2 ; calling convention for integers.
3
4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
5 ; RUN: | FileCheck %s
6
7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented)
8 ; once enough infrastructure is in. Also, switch to --filetype=obj
9 ; when possible.
10 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --assemble \
11 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \
12 ; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix ARM32 %s
13
14 ; For x86-32, integer arguments use the stack.
15 ; For ARM32, integer arguments can be r0-r3. i64 arguments occupy two
16 ; adjacent 32-bit registers, and require the first to be an even register.
17
18
19 ; i32
20
21 define i32 @test_returning32_arg0(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
22 entry:
23 ret i32 %arg0
24 }
25 ; CHECK-LABEL: test_returning32_arg0
26 ; CHECK-NEXT: mov eax,{{.*}} [esp+0x4]
27 ; CHECK-NEXT: ret
28 ; ARM32-LABEL: test_returning32_arg0
29 ; ARM32-NEXT: bx lr
30
31 define i32 @test_returning32_arg1(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
32 entry:
33 ret i32 %arg1
34 }
35 ; CHECK-LABEL: test_returning32_arg1
36 ; CHECK-NEXT: mov eax,{{.*}} [esp+0x8]
37 ; CHECK-NEXT: ret
38 ; ARM32-LABEL: test_returning32_arg1
39 ; ARM32-NEXT: mov r0, r1
40 ; ARM32-NEXT: bx lr
41
42
43 define i32 @test_returning32_arg2(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
44 entry:
45 ret i32 %arg2
46 }
47 ; CHECK-LABEL: test_returning32_arg2
48 ; CHECK-NEXT: mov eax,{{.*}} [esp+0xc]
49 ; CHECK-NEXT: ret
50 ; ARM32-LABEL: test_returning32_arg2
51 ; ARM32-NEXT: mov r0, r2
52 ; ARM32-NEXT: bx lr
53
54
55 define i32 @test_returning32_arg3(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
56 entry:
57 ret i32 %arg3
58 }
59 ; CHECK-LABEL: test_returning32_arg3
60 ; CHECK-NEXT: mov eax,{{.*}} [esp+0x10]
61 ; CHECK-NEXT: ret
62 ; ARM32-LABEL: test_returning32_arg3
63 ; ARM32-NEXT: mov r0, r3
64 ; ARM32-NEXT: bx lr
65
66
67 define i32 @test_returning32_arg4(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
68 entry:
69 ret i32 %arg4
70 }
71 ; CHECK-LABEL: test_returning32_arg4
72 ; CHECK-NEXT: mov eax,{{.*}} [esp+0x14]
73 ; CHECK-NEXT: ret
74 ; ARM32-LABEL: test_returning32_arg4
75 ; TODO(jvoung): Toggle this on, once addProlog is done.
76 ; TODOARM32-NEXT: ldr r0, [sp]
77 ; ARM32-NEXT: bx lr
78
79
80 define i32 @test_returning32_arg5(i32 %arg0, i32 %arg1, i32 %arg2, i32 %arg3, i3 2 %arg4, i32 %arg5, i32 %arg6, i32 %arg7) {
81 entry:
82 ret i32 %arg5
83 }
84 ; CHECK-LABEL: test_returning32_arg5
85 ; CHECK-NEXT: mov eax,{{.*}} [esp+0x18]
86 ; CHECK-NEXT: ret
87 ; ARM32-LABEL: test_returning32_arg5
88 ; TODO(jvoung): Toggle this on, once addProlog is done.
89 ; TODOARM32-NEXT: ldr r0, [sp, #4]
90 ; ARM32-NEXT: bx lr
91
92 ; i64
93
94 define i64 @test_returning64_arg0(i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3) {
95 entry:
96 ret i64 %arg0
97 }
98 ; CHECK-LABEL: test_returning64_arg0
99 ; CHECK-NEXT: mov {{.*}} [esp+0x4]
100 ; CHECK-NEXT: mov {{.*}} [esp+0x8]
101 ; CHECK: ret
102 ; ARM32-LABEL: test_returning64_arg0
103 ; ARM32-NEXT: bx lr
104
105 define i64 @test_returning64_arg1(i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3) {
106 entry:
107 ret i64 %arg1
108 }
109 ; CHECK-LABEL: test_returning64_arg1
110 ; CHECK-NEXT: mov {{.*}} [esp+0xc]
111 ; CHECK-NEXT: mov {{.*}} [esp+0x10]
112 ; CHECK: ret
113 ; ARM32-LABEL: test_returning64_arg1
114 ; ARM32-NEXT: mov r0, r2
115 ; ARM32-NEXT: mov r1, r3
116 ; ARM32-NEXT: bx lr
117
118 define i64 @test_returning64_arg2(i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3) {
119 entry:
120 ret i64 %arg2
121 }
122 ; CHECK-LABEL: test_returning64_arg2
123 ; CHECK-NEXT: mov {{.*}} [esp+0x14]
124 ; CHECK-NEXT: mov {{.*}} [esp+0x18]
125 ; CHECK: ret
126 ; ARM32-LABEL: test_returning64_arg2
127 ; This could have been a ldm sp, {r0, r1}, but we don't do the ldm optimization.
128 ; TODO(jvoung): enable this once addProlog is done.
129 ; TODOARM32-NEXT: ldr r0, [sp]
130 ; TODOARM32-NEXT: ldr r1, [sp, #4]
131 ; ARM32-NEXT: bx lr
132
133 define i64 @test_returning64_arg3(i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3) {
134 entry:
135 ret i64 %arg3
136 }
137 ; CHECK-LABEL: test_returning64_arg3
138 ; CHECK-NEXT: mov {{.*}} [esp+0x1c]
139 ; CHECK-NEXT: mov {{.*}} [esp+0x20]
140 ; CHECK: ret
141 ; ARM32-LABEL: test_returning64_arg3
142 ; TODO(jvoung): enable this once addProlog is done.
143 ; TODOARM32-NEXT: ldr r0, [sp, #8]
144 ; TODOARM32-NEXT: ldr r1, [sp, #12]
145 ; ARM32-NEXT: bx lr
146
147
148 ; Test that on ARM, the i64 arguments start with an even register.
149
150 define i64 @test_returning64_even_arg1(i32 %arg0, i64 %arg1, i64 %arg2) {
151 entry:
152 ret i64 %arg1
153 }
154 ; Not padded out x86-32.
155 ; CHECK-LABEL: test_returning64_even_arg1
156 ; CHECK-NEXT: mov {{.*}} [esp+0x8]
157 ; CHECK-NEXT: mov {{.*}} [esp+0xc]
158 ; CHECK: ret
159 ; ARM32-LABEL: test_returning64_even_arg1
160 ; ARM32-NEXT: mov r0, r2
161 ; ARM32-NEXT: mov r1, r3
162 ; ARM32-NEXT: bx lr
163
164 define i64 @test_returning64_even_arg1b(i32 %arg0, i32 %arg0b, i64 %arg1, i64 %a rg2) {
165 entry:
166 ret i64 %arg1
167 }
168 ; CHECK-LABEL: test_returning64_even_arg1b
169 ; CHECK-NEXT: mov {{.*}} [esp+0xc]
170 ; CHECK-NEXT: mov {{.*}} [esp+0x10]
171 ; CHECK: ret
172 ; ARM32-LABEL: test_returning64_even_arg1b
173 ; ARM32-NEXT: mov r0, r2
174 ; ARM32-NEXT: mov r1, r3
175 ; ARM32-NEXT: bx lr
176
177 define i64 @test_returning64_even_arg2(i64 %arg0, i32 %arg1, i64 %arg2) {
178 entry:
179 ret i64 %arg2
180 }
181 ; Not padded out on x86-32.
182 ; CHECK-LABEL: test_returning64_even_arg2
183 ; CHECK-NEXT: mov {{.*}} [esp+0x10]
184 ; CHECK-NEXT: mov {{.*}} [esp+0x14]
185 ; CHECK: ret
186 ; ARM32-LABEL: test_returning64_even_arg2
187 ; TODO(jvoung): enable this once addProlog is done.
188 ; TODOARM32-NEXT: ldr r0, [sp]
189 ; TODOARM32-NEXT: ldr r1, [sp, #4]
190 ; ARM32-NEXT: bx lr
191
192 define i64 @test_returning64_even_arg2b(i64 %arg0, i32 %arg1, i32 %arg1b, i64 %a rg2) {
193 entry:
194 ret i64 %arg2
195 }
196 ; CHECK-LABEL: test_returning64_even_arg2b
197 ; CHECK-NEXT: mov {{.*}} [esp+0x14]
198 ; CHECK-NEXT: mov {{.*}} [esp+0x18]
199 ; CHECK: ret
200 ; ARM32-LABEL: test_returning64_even_arg2b
201 ; TODO(jvoung): enable this once addProlog is done.
202 ; TODOARM32-NEXT: ldr r0, [sp]
203 ; TODOARM32-NEXT: ldr r1, [sp, #4]
204 ; ARM32-NEXT: bx lr
205
206 define i32 @test_returning32_even_arg2(i64 %arg0, i32 %arg1, i32 %arg2) {
207 entry:
208 ret i32 %arg2
209 }
210 ; CHECK-LABEL: test_returning32_even_arg2
211 ; CHECK-NEXT: mov {{.*}} [esp+0x10]
212 ; CHECK-NEXT: ret
213 ; ARM32-LABEL: test_returning32_even_arg2
214 ; ARM32-NEXT: mov r0, r3
215 ; ARM32-NEXT: bx lr
216
217 define i32 @test_returning32_even_arg2b(i32 %arg0, i32 %arg1, i32 %arg2, i64 %ar g3) {
218 entry:
219 ret i32 %arg2
220 }
221 ; CHECK-LABEL: test_returning32_even_arg2b
222 ; CHECK-NEXT: mov {{.*}} [esp+0xc]
223 ; CHECK-NEXT: ret
224 ; ARM32-LABEL: test_returning32_even_arg2b
225 ; ARM32-NEXT: mov r0, r2
226 ; ARM32-NEXT: bx lr
227
228 ; The i64 won't fit in a pair of register, and consumes the last register so a
229 ; following i32 can't use that free register.
230 define i32 @test_returning32_even_arg4(i32 %arg0, i32 %arg1, i32 %arg2, i64 %arg 3, i32 %arg4) {
231 entry:
232 ret i32 %arg4
233 }
234 ; CHECK-LABEL: test_returning32_even_arg4
235 ; CHECK-NEXT: mov {{.*}} [esp+0x18]
236 ; CHECK-NEXT: ret
237 ; ARM32-LABEL: test_returning32_even_arg4
238 ; TODO(jvoung): enable this once addProlog is done.
239 ; TODOARM32-NEXT: ldr r0, [sp, #8]
240 ; ARM32-NEXT: bx lr
241
242 ; Test interleaving float/double and integer (different register streams on ARM) .
243 ; TODO(jvoung): Test once the S/D/Q regs are modeled.
OLDNEW
« no previous file with comments | « src/IceUtils.h ('k') | tests_lit/llvm2ice_tests/return_immediates.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698