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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
diff --git a/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll b/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
index dbebf118ead75079a42f93f6e212c0369997bd31..8a11a84a41306c546fe999b61cb1bfdf5f0e7406 100644
--- a/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
+++ b/tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
@@ -31,6 +31,8 @@ declare i32 @llvm.cttz.i32(i32, i1)
declare i64 @llvm.cttz.i64(i64, i1)
declare i32 @llvm.ctpop.i32(i32)
declare i64 @llvm.ctpop.i64(i64)
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8*)
define i32 @test_nacl_read_tp() {
entry:
@@ -394,6 +396,50 @@ entry:
; CHECKO2REM: call __popcountdi2
; CHECKO2REM-NOT: mov {{.*}}, 0
+define void @test_stacksave_noalloca() {
+entry:
+ %sp = call i8* @llvm.stacksave()
+ call void @llvm.stackrestore(i8* %sp)
+ ret void
+}
+; CHECK-LABEL: test_stacksave_noalloca
+; CHECK: mov {{.*}}, esp
+; CHECK: mov esp, {{.*}}
+
+declare i32 @foo(i32 %x)
+
+define void @test_stacksave_multiple(i32 %x) {
+entry:
+ %x_4 = mul i32 %x, 4
+ %sp1 = call i8* @llvm.stacksave()
+ %tmp1 = alloca i8, i32 %x_4, align 4
+
+ %sp2 = call i8* @llvm.stacksave()
+ %tmp2 = alloca i8, i32 %x_4, align 4
+
+ %y = call i32 @foo(i32 %x)
+
+ %sp3 = call i8* @llvm.stacksave()
+ %tmp3 = alloca i8, i32 %x_4, align 4
+
+ %__9 = bitcast i8* %tmp1 to i32*
+ store i32 %y, i32* %__9, align 1
+
+ %__10 = bitcast i8* %tmp2 to i32*
+ store i32 %x, i32* %__10, align 1
+
+ %__11 = bitcast i8* %tmp3 to i32*
+ store i32 %x, i32* %__11, align 1
+
+ call void @llvm.stackrestore(i8* %sp1)
+ ret void
+}
+; CHECK-LABEL: test_stacksave_multiple
+; At least 3 copies of esp, but probably more from having to do the allocas.
+; CHECK: mov {{.*}}, esp
+; CHECK: mov {{.*}}, esp
+; CHECK: mov {{.*}}, esp
+; CHECK: mov esp, {{.*}}
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698