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

Side by Side Diff: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll

Issue 396993009: Lower stacksave and restore intrinsics. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: line em up Created 6 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
OLDNEW
1 ; This tests the NaCl intrinsics not related to atomic operations. 1 ; This tests the NaCl intrinsics not related to atomic operations.
2 2
3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s 3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
4 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s 4 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
5 5
6 ; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1 6 ; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1
7 ; share the same "CHECK" prefix). This separate run helps check that 7 ; share the same "CHECK" prefix). This separate run helps check that
8 ; some code is optimized out. 8 ; some code is optimized out.
9 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM 9 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM
10 10
(...skipping 10 matching lines...) Expand all
21 declare i32 @llvm.nacl.setjmp(i8*) 21 declare i32 @llvm.nacl.setjmp(i8*)
22 declare float @llvm.sqrt.f32(float) 22 declare float @llvm.sqrt.f32(float)
23 declare double @llvm.sqrt.f64(double) 23 declare double @llvm.sqrt.f64(double)
24 declare void @llvm.trap() 24 declare void @llvm.trap()
25 declare i32 @llvm.ctlz.i32(i32, i1) 25 declare i32 @llvm.ctlz.i32(i32, i1)
26 declare i64 @llvm.ctlz.i64(i64, i1) 26 declare i64 @llvm.ctlz.i64(i64, i1)
27 declare i32 @llvm.cttz.i32(i32, i1) 27 declare i32 @llvm.cttz.i32(i32, i1)
28 declare i64 @llvm.cttz.i64(i64, i1) 28 declare i64 @llvm.cttz.i64(i64, i1)
29 declare i32 @llvm.ctpop.i32(i32) 29 declare i32 @llvm.ctpop.i32(i32)
30 declare i64 @llvm.ctpop.i64(i64) 30 declare i64 @llvm.ctpop.i64(i64)
31 declare i8* @llvm.stacksave()
32 declare void @llvm.stackrestore(i8*)
31 33
32 define i32 @test_nacl_read_tp() { 34 define i32 @test_nacl_read_tp() {
33 entry: 35 entry:
34 %ptr = call i8* @llvm.nacl.read.tp() 36 %ptr = call i8* @llvm.nacl.read.tp()
35 %__1 = ptrtoint i8* %ptr to i32 37 %__1 = ptrtoint i8* %ptr to i32
36 ret i32 %__1 38 ret i32 %__1
37 } 39 }
38 ; CHECK-LABEL: test_nacl_read_tp 40 ; CHECK-LABEL: test_nacl_read_tp
39 ; CHECK: mov e{{.*}}, dword ptr gs:[0] 41 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
40 ; CHECKO2REM-LABEL: test_nacl_read_tp 42 ; CHECKO2REM-LABEL: test_nacl_read_tp
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 entry: 359 entry:
358 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x) 360 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x)
359 %r = trunc i64 %r_i64 to i32 361 %r = trunc i64 %r_i64 to i32
360 ret i32 %r 362 ret i32 %r
361 } 363 }
362 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out. 364 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out.
363 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32 365 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32
364 ; CHECKO2REM: call __popcountdi2 366 ; CHECKO2REM: call __popcountdi2
365 ; CHECKO2REM-NOT: mov {{.*}}, 0 367 ; CHECKO2REM-NOT: mov {{.*}}, 0
366 368
369 define void @test_stacksave_noalloca() {
370 entry:
371 %sp = call i8* @llvm.stacksave()
372 call void @llvm.stackrestore(i8* %sp)
373 ret void
374 }
375 ; CHECK-LABEL: test_stacksave_noalloca
376 ; CHECK: mov {{.*}}, esp
377 ; CHECK: mov esp, {{.*}}
378
379 declare i32 @foo(i32 %x)
380
381 define void @test_stacksave_multiple(i32 %x) {
382 entry:
383 %x_4 = mul i32 %x, 4
384 %sp1 = call i8* @llvm.stacksave()
385 %tmp1 = alloca i8, i32 %x_4, align 4
386
387 %sp2 = call i8* @llvm.stacksave()
388 %tmp2 = alloca i8, i32 %x_4, align 4
389
390 %y = call i32 @foo(i32 %x)
391
392 %sp3 = call i8* @llvm.stacksave()
393 %tmp3 = alloca i8, i32 %x_4, align 4
394
395 %__9 = bitcast i8* %tmp1 to i32*
396 store i32 %y, i32* %__9, align 1
397
398 %__10 = bitcast i8* %tmp2 to i32*
399 store i32 %x, i32* %__10, align 1
400
401 %__11 = bitcast i8* %tmp3 to i32*
402 store i32 %x, i32* %__11, align 1
403
404 call void @llvm.stackrestore(i8* %sp1)
405 ret void
406 }
407 ; CHECK-LABEL: test_stacksave_multiple
408 ; At least 3 copies of esp, but probably more from having to do the allocas.
409 ; CHECK: mov {{.*}}, esp
410 ; CHECK: mov {{.*}}, esp
411 ; CHECK: mov {{.*}}, esp
412 ; CHECK: mov esp, {{.*}}
367 413
368 ; ERRORS-NOT: ICE translation error 414 ; ERRORS-NOT: ICE translation error
369 ; DUMP-NOT: SZ 415 ; DUMP-NOT: SZ
OLDNEW
« crosstest/test_stacksave_main.c ('K') | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698