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

Unified Diff: test/NaCl/Bitcode/pnacl-bcdis/switch.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « test/NaCl/Bitcode/pnacl-bcdis/store.ll ('k') | test/NaCl/Bitcode/pnacl-bcdis/types-and-fcn-addrs.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/Bitcode/pnacl-bcdis/switch.ll
diff --git a/test/NaCl/Bitcode/pnacl-bcdis/switch.ll b/test/NaCl/Bitcode/pnacl-bcdis/switch.ll
new file mode 100644
index 0000000000000000000000000000000000000000..5bd242be772699f90f838a35c2178b214add419a
--- /dev/null
+++ b/test/NaCl/Bitcode/pnacl-bcdis/switch.ll
@@ -0,0 +1,73 @@
+; Test switch statements.
+
+; RUN: llvm-as < %s | pnacl-freeze | pnacl-bccompress --remove-abbreviations \
+; RUN: | pnacl-bcdis | FileCheck %s
+
+
+; Test case where we switch on a variable.
+define void @SwitchVariable(i32 %p0) {
+
+; CHECK: | | %b0:
+
+ switch i32 %p0, label %b1 [
+ i32 1, label %b2
+ i32 2, label %b2
+ i32 4, label %b3
+ i32 5, label %b3
+ ]
+
+; CHECK-NEXT: {{.*}}| 3: <12, 1, 1, 1, 4, 1, 1,| switch i32 %p0 {
+; CHECK-NEXT: | 2, 2, 1, 1, 4, 2, 1, | default: br label %b1;
+; CHECK-NEXT: | 1, 8, 3, 1, 1, 10, 3>| i32 1: br label %b2;
+; CHECK-NEXT: | | i32 2: br label %b2;
+; CHECK-NEXT: | | i32 4: br label %b3;
+; CHECK-NEXT: | | i32 5: br label %b3;
+; CHECK-NEXT: | | }
+
+b1:
+ br label %b4
+
+
+b2:
+ br label %b4
+
+b3:
+ br label %b4
+
+b4:
+ ret void
+}
+
+; Test case where we switch on a constant.
+define void @SwitchConstant() {
+
+; CHECK: | | %b0:
+
+ switch i32 3, label %b1 [
+ i32 2, label %b2
+ i32 1, label %b2
+ i32 5, label %b3
+ i32 4, label %b3
+ ]
+
+; CHECK-NEXT: {{.*}}| 3: <12, 1, 1, 1, 4, 1, 1,| switch i32 %c0 {
+; CHECK-NEXT: | 4, 2, 1, 1, 2, 2, 1, | default: br label %b1;
+; CHECK-NEXT: | 1, 10, 3, 1, 1, 8, 3>| i32 2: br label %b2;
+; CHECK-NEXT: | | i32 1: br label %b2;
+; CHECK-NEXT: | | i32 5: br label %b3;
+; CHECK-NEXT: | | i32 4: br label %b3;
+; CHECK-NEXT: | | }
+
+b1:
+ br label %b4
+
+b2:
+ br label %b4
+
+b3:
+ br label %b4
+
+b4:
+ ret void
+}
+
« no previous file with comments | « test/NaCl/Bitcode/pnacl-bcdis/store.ll ('k') | test/NaCl/Bitcode/pnacl-bcdis/types-and-fcn-addrs.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698