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

Unified Diff: tests_lit/llvm2ice_tests/simple-loop.ll

Issue 205613002: Initial skeleton of Subzero. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Use non-anonymous structs so that array_lengthof works Created 6 years, 8 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 | « tests_lit/llvm2ice_tests/simple-cond.ll ('k') | tests_lit/llvm2ice_tests/store.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/simple-loop.ll
diff --git a/tests_lit/llvm2ice_tests/simple-loop.ll b/tests_lit/llvm2ice_tests/simple-loop.ll
new file mode 100644
index 0000000000000000000000000000000000000000..4460834a46ef237bf569038824db19ae1fb0bb15
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/simple-loop.ll
@@ -0,0 +1,52 @@
+; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
+; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s
+
+define i32 @simple_loop(i32 %a, i32 %n) {
+entry:
+ %cmp4 = icmp sgt i32 %n, 0
+ br i1 %cmp4, label %for.body, label %for.end
+
+for.body:
+ %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
+ %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
+ %gep_array = mul i32 %i.06, 4
+ %gep = add i32 %a, %gep_array
+ %gep.asptr = inttoptr i32 %gep to i32*
+ %v0 = load i32* %gep.asptr, align 1
+ %add = add i32 %v0, %sum.05
+ %inc = add i32 %i.06, 1
+ %cmp = icmp slt i32 %inc, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
+ ret i32 %sum.0.lcssa
+}
+
+; Checks for verbose instruction output
+
+; CHECK: br i1 %cmp4, label %for.body, label %for.end
+; CHECK-NEXT: for.body
+; CHECK: %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
+; CHECK-NEXT: %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
+
+; Checks for emitted assembly
+
+; CHECK: .globl simple_loop
+
+; CHECK: mov ecx, dword ptr [esp+{{[0-9]+}}]
+; CHECK: cmp ecx, 0
+; CHECK-NEXT: jg {{.*}}for.body
+; CHECK-NEXT: jmp {{.*}}for.end
+
+; TODO: the mov from ebx to esi seems redundant here - so this may need to be
+; modified later
+
+; CHECK: add [[IREG:[a-z]+]], 1
+; CHECK-NEXT: mov [[ICMPREG:[a-z]+]], [[IREG]]
+; CHECK: cmp [[ICMPREG]], ecx
+; CHECK-NEXT: jl {{.*}}for.body
+
+; ERRORS-NOT: ICE translation error
+; DUMP-NOT: SZ
« no previous file with comments | « tests_lit/llvm2ice_tests/simple-cond.ll ('k') | tests_lit/llvm2ice_tests/store.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698