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

Side by Side Diff: tests_lit/llvm2ice_tests/alloc.ll

Issue 2138383002: [Subzero][MIPS32] Implements variable alloca for MIPS32 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 5 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/IceTargetLoweringMIPS32.cpp ('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
1 ; This is a basic test of the alloca instruction. 1 ; This is a basic test of the alloca instruction.
2 2
3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
4 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ 4 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \
5 ; RUN: | %if --need=target_X8632 --command FileCheck %s 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s
6 6
7 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 7 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
8 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ 8 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \
9 ; RUN: | %if --need=target_X8632 --command FileCheck \ 9 ; RUN: | %if --need=target_X8632 --command FileCheck \
10 ; RUN: --check-prefix CHECK-OPTM1 %s 10 ; RUN: --check-prefix CHECK-OPTM1 %s
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ; CHECK: lea eax,[esp+0x10] 169 ; CHECK: lea eax,[esp+0x10]
170 ; CHECK: mov DWORD PTR [esp],eax 170 ; CHECK: mov DWORD PTR [esp],eax
171 ; CHECK: call {{.*}} R_{{.*}} f2 171 ; CHECK: call {{.*}} R_{{.*}} f2
172 172
173 ; ARM32-LABEL: variable_n_align_16 173 ; ARM32-LABEL: variable_n_align_16
174 ; ARM32: add r0, r0, #15 174 ; ARM32: add r0, r0, #15
175 ; ARM32: bic r0, r0, #15 175 ; ARM32: bic r0, r0, #15
176 ; ARM32: sub sp, sp, r0 176 ; ARM32: sub sp, sp, r0
177 ; ARM32: bl {{.*}} R_{{.*}} f2 177 ; ARM32: bl {{.*}} R_{{.*}} f2
178 178
179 ; MIPS32-LABEL: variable_n_align_16
180 ; MIPS32: addiu [[REG:.*]],{{.*}},7
181 ; MIPS32: li [[REG1:.*]],-8
182 ; MIPS32: and [[REG2:.*]],[[REG]],[[REG1]]
183 ; MIPS32: subu [[REG3:.*]],sp,[[REG2:.*]]
184 ; MIPS32: li [[REG4:.*]],-16
185 ; MIPS32: and {{.*}},[[REG3]],[[REG4]]
186 ; MIPS32: addiu sp,sp,-16
187 ; MIPS32: jal {{.*}} R_{{.*}} f2
188 ; MIPS32: addiu sp,sp,16
189
179 define internal void @variable_n_align_32(i32 %n) { 190 define internal void @variable_n_align_32(i32 %n) {
180 entry: 191 entry:
181 %array = alloca i8, i32 %n, align 32 192 %array = alloca i8, i32 %n, align 32
182 %__2 = ptrtoint i8* %array to i32 193 %__2 = ptrtoint i8* %array to i32
183 call void @f2(i32 %__2) 194 call void @f2(i32 %__2)
184 ret void 195 ret void
185 } 196 }
186 ; In -O2, the order of the CHECK-DAG lines in the output is switched. 197 ; In -O2, the order of the CHECK-DAG lines in the output is switched.
187 ; CHECK-LABEL: variable_n_align_32 198 ; CHECK-LABEL: variable_n_align_32
188 ; CHECK: push ebp 199 ; CHECK: push ebp
(...skipping 14 matching lines...) Expand all
203 ; ARM32: push {fp, lr} 214 ; ARM32: push {fp, lr}
204 ; ARM32: mov fp, sp 215 ; ARM32: mov fp, sp
205 ; ARM32: bic sp, sp, #31 216 ; ARM32: bic sp, sp, #31
206 ; ARM32: add r0, r0, #31 217 ; ARM32: add r0, r0, #31
207 ; ARM32: bic r0, r0, #31 218 ; ARM32: bic r0, r0, #31
208 ; ARM32: sub sp, sp, r0 219 ; ARM32: sub sp, sp, r0
209 ; ARM32: bl {{.*}} R_{{.*}} f2 220 ; ARM32: bl {{.*}} R_{{.*}} f2
210 ; ARM32: mov sp, fp 221 ; ARM32: mov sp, fp
211 ; ARM32: pop {fp, lr} 222 ; ARM32: pop {fp, lr}
212 223
224 ; MIPS32-LABEL: variable_n_align_32
225 ; MIPS32: addiu [[REG:.*]],{{.*}},7
226 ; MIPS32: li [[REG1:.*]],-8
227 ; MIPS32: and [[REG2:.*]],[[REG]],[[REG1]]
228 ; MIPS32: subu [[REG3:.*]],sp,[[REG2]]
229 ; MIPS32: li [[REG4:.*]],-32
230 ; MIPS32: and {{.*}},[[REG3]],[[REG4]]
231 ; MIPS32: addiu sp,sp,-16
232 ; MIPS32: jal {{.*}} R_{{.*}} f2
233 ; MIPS32: addiu sp,sp,16
234
213 ; Test alloca with default (0) alignment. 235 ; Test alloca with default (0) alignment.
214 define internal void @align0(i32 %n) { 236 define internal void @align0(i32 %n) {
215 entry: 237 entry:
216 %array = alloca i8, i32 %n 238 %array = alloca i8, i32 %n
217 %__2 = ptrtoint i8* %array to i32 239 %__2 = ptrtoint i8* %array to i32
218 call void @f2(i32 %__2) 240 call void @f2(i32 %__2)
219 ret void 241 ret void
220 } 242 }
221 ; CHECK-LABEL: align0 243 ; CHECK-LABEL: align0
222 ; CHECK: add [[REG:.*]],0xf 244 ; CHECK: add [[REG:.*]],0xf
223 ; CHECK: and [[REG]],0xfffffff0 245 ; CHECK: and [[REG]],0xfffffff0
224 ; CHECK: sub esp,[[REG]] 246 ; CHECK: sub esp,[[REG]]
225 247
226 ; ARM32-LABEL: align0 248 ; ARM32-LABEL: align0
227 ; ARM32: add r0, r0, #15 249 ; ARM32: add r0, r0, #15
228 ; ARM32: bic r0, r0, #15 250 ; ARM32: bic r0, r0, #15
229 ; ARM32: sub sp, sp, r0 251 ; ARM32: sub sp, sp, r0
230 252
253 ; MIPS32-LABEL: align0
254 ; MIPS32: addiu [[REG:.*]],{{.*}},7
255 ; MIPS32: li [[REG1:.*]],-8
256 ; MIPS32: and [[REG2:.*]],[[REG]],[[REG1]]
257 ; MIPS32: subu {{.*}},sp,[[REG2]]
258 ; MIPS32: addiu sp,sp,-16
259 ; MIPS32: jal {{.*}} R_{{.*}} f2
260 ; MIPS32: addiu sp,sp,16
261
231 ; Test a large alignment where a mask might not fit in an immediate 262 ; Test a large alignment where a mask might not fit in an immediate
232 ; field of an instruction for some architectures. 263 ; field of an instruction for some architectures.
233 define internal void @align1MB(i32 %n) { 264 define internal void @align1MB(i32 %n) {
234 entry: 265 entry:
235 %array = alloca i8, i32 %n, align 1048576 266 %array = alloca i8, i32 %n, align 1048576
236 %__2 = ptrtoint i8* %array to i32 267 %__2 = ptrtoint i8* %array to i32
237 call void @f2(i32 %__2) 268 call void @f2(i32 %__2)
238 ret void 269 ret void
239 } 270 }
240 ; CHECK-LABEL: align1MB 271 ; CHECK-LABEL: align1MB
241 ; CHECK: push ebp 272 ; CHECK: push ebp
242 ; CHECK-NEXT: mov ebp,esp 273 ; CHECK-NEXT: mov ebp,esp
243 ; CHECK: and esp,0xfff00000 274 ; CHECK: and esp,0xfff00000
244 ; CHECK: add [[REG:.*]],0xfffff 275 ; CHECK: add [[REG:.*]],0xfffff
245 ; CHECK: and [[REG]],0xfff00000 276 ; CHECK: and [[REG]],0xfff00000
246 ; CHECK: sub esp,[[REG]] 277 ; CHECK: sub esp,[[REG]]
247 278
248 ; ARM32-LABEL: align1MB 279 ; ARM32-LABEL: align1MB
249 ; ARM32: movw [[REG:.*]], #0 280 ; ARM32: movw [[REG:.*]], #0
250 ; ARM32: movt [[REG]], #65520 ; 0xfff0 281 ; ARM32: movt [[REG]], #65520 ; 0xfff0
251 ; ARM32: and sp, sp, [[REG]] 282 ; ARM32: and sp, sp, [[REG]]
252 ; ARM32: movw [[REG2:.*]], #65535 ; 0xffff 283 ; ARM32: movw [[REG2:.*]], #65535 ; 0xffff
253 ; ARM32: movt [[REG2]], #15 284 ; ARM32: movt [[REG2]], #15
254 ; ARM32: add r0, r0, [[REG2]] 285 ; ARM32: add r0, r0, [[REG2]]
255 ; ARM32: movw [[REG3:.*]], #0 286 ; ARM32: movw [[REG3:.*]], #0
256 ; ARM32: movt [[REG3]], #65520 ; 0xfff0 287 ; ARM32: movt [[REG3]], #65520 ; 0xfff0
257 ; ARM32: and r0, r0, [[REG3]] 288 ; ARM32: and r0, r0, [[REG3]]
258 ; ARM32: sub sp, sp, r0 289 ; ARM32: sub sp, sp, r0
259 290
291 ; MIPS32-LABEL: align1MB
292 ; MIPS32: addiu [[REG:.*]],{{.*}},7
293 ; MIPS32: li [[REG1:.*]],-8
294 ; MIPS32: and [[REG2:.*]],[[REG]],[[REG1]]
295 ; MIPS32: subu [[REG3:.*]],sp,[[REG2]]
296 ; MIPS32: lui [[REG4:.*]],0xfff0
297 ; MIPS32: and {{.*}},[[REG3]],[[REG4]]
298 ; MIPS32: addiu sp,sp,-16
299 ; MIPS32: jal {{.*}} R_{{.*}} f2
300 ; MIPS32: addiu sp,sp,16
301
260 ; Test a large alignment where a mask might still fit in an immediate 302 ; Test a large alignment where a mask might still fit in an immediate
261 ; field of an instruction for some architectures. 303 ; field of an instruction for some architectures.
262 define internal void @align512MB(i32 %n) { 304 define internal void @align512MB(i32 %n) {
263 entry: 305 entry:
264 %array = alloca i8, i32 %n, align 536870912 306 %array = alloca i8, i32 %n, align 536870912
265 %__2 = ptrtoint i8* %array to i32 307 %__2 = ptrtoint i8* %array to i32
266 call void @f2(i32 %__2) 308 call void @f2(i32 %__2)
267 ret void 309 ret void
268 } 310 }
269 ; CHECK-LABEL: align512MB 311 ; CHECK-LABEL: align512MB
270 ; CHECK: push ebp 312 ; CHECK: push ebp
271 ; CHECK-NEXT: mov ebp,esp 313 ; CHECK-NEXT: mov ebp,esp
272 ; CHECK: and esp,0xe0000000 314 ; CHECK: and esp,0xe0000000
273 ; CHECK: add [[REG:.*]],0x1fffffff 315 ; CHECK: add [[REG:.*]],0x1fffffff
274 ; CHECK: and [[REG]],0xe0000000 316 ; CHECK: and [[REG]],0xe0000000
275 ; CHECK: sub esp,[[REG]] 317 ; CHECK: sub esp,[[REG]]
276 318
277 ; ARM32-LABEL: align512MB 319 ; ARM32-LABEL: align512MB
278 ; ARM32: and sp, sp, #-536870912 ; 0xe0000000 320 ; ARM32: and sp, sp, #-536870912 ; 0xe0000000
279 ; ARM32: mvn [[REG:.*]], #-536870912 ; 0xe0000000 321 ; ARM32: mvn [[REG:.*]], #-536870912 ; 0xe0000000
280 ; ARM32: add r0, r0, [[REG]] 322 ; ARM32: add r0, r0, [[REG]]
281 ; ARM32: and r0, r0, #-536870912 ; 0xe0000000 323 ; ARM32: and r0, r0, #-536870912 ; 0xe0000000
282 ; ARM32: sub sp, sp, r0 324 ; ARM32: sub sp, sp, r0
283 325
326 ; MIPS32-LABEL: align512MB
327 ; MIPS32: addiu [[REG:.*]],{{.*}},7
328 ; MIPS32: li [[REG2:.*]],-8
329 ; MIPS32: and [[REG3:.*]],[[REG]],[[REG2]]
330 ; MIPS32: subu [[REG4:.*]],sp,[[REG3]]
331 ; MIPS32: lui [[REG5:.*]],0xe000
332 ; MIPS32: and {{.*}},[[REG4]],[[REG5]]
333 ; MIPS32: addiu sp,sp,-16
334 ; MIPS32: jal {{.*}} R_{{.*}} f2
335 ; MIPS32: addiu sp,sp,16
336
284 ; Test that a simple alloca sequence doesn't trigger a frame pointer. 337 ; Test that a simple alloca sequence doesn't trigger a frame pointer.
285 define internal void @fixed_no_frameptr(i32 %arg) { 338 define internal void @fixed_no_frameptr(i32 %arg) {
286 entry: 339 entry:
287 %a1 = alloca i8, i32 8, align 4 340 %a1 = alloca i8, i32 8, align 4
288 %a2 = alloca i8, i32 12, align 4 341 %a2 = alloca i8, i32 12, align 4
289 %a3 = alloca i8, i32 16, align 4 342 %a3 = alloca i8, i32 16, align 4
290 %p1 = bitcast i8* %a1 to i32* 343 %p1 = bitcast i8* %a1 to i32*
291 %p2 = bitcast i8* %a2 to i32* 344 %p2 = bitcast i8* %a2 to i32*
292 %p3 = bitcast i8* %a3 to i32* 345 %p3 = bitcast i8* %a3 to i32*
293 store i32 %arg, i32* %p1, align 1 346 store i32 %arg, i32* %p1, align 1
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 %p1 = bitcast i8* %a1 to i32* 378 %p1 = bitcast i8* %a1 to i32*
326 %p2 = bitcast i8* %a2 to i32* 379 %p2 = bitcast i8* %a2 to i32*
327 %p3 = bitcast i8* %a3 to i32* 380 %p3 = bitcast i8* %a3 to i32*
328 store i32 %arg, i32* %p1, align 1 381 store i32 %arg, i32* %p1, align 1
329 store i32 %arg, i32* %p2, align 1 382 store i32 %arg, i32* %p2, align 1
330 store i32 %arg, i32* %p3, align 1 383 store i32 %arg, i32* %p3, align 1
331 ret void 384 ret void
332 } 385 }
333 ; CHECK-LABEL: var_with_frameptr 386 ; CHECK-LABEL: var_with_frameptr
334 ; CHECK: mov ebp,esp 387 ; CHECK: mov ebp,esp
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.cpp ('k') | tests_lit/llvm2ice_tests/return_immediates.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698