aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-11 18:07:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-11 18:07:31 -0800
commit0bb7d8093a98b8bd41b9eeeaf8bde671f0b9894e (patch)
tree19e7dab1a54605a2ac8294f93aba2590fd5a4617
parent9f74e557418e58ecdac3c9fc9c82c733bab1f308 (diff)
more i64 switch tests
-rw-r--r--tests/cases/switch64_ta2.ll44
-rw-r--r--tests/cases/switch64_ta2.txt2
-rw-r--r--tests/cases/switch64b_ta2.ll54
-rw-r--r--tests/cases/switch64b_ta2.txt3
4 files changed, 79 insertions, 24 deletions
diff --git a/tests/cases/switch64_ta2.ll b/tests/cases/switch64_ta2.ll
index 4d5c6273..1a6d52f3 100644
--- a/tests/cases/switch64_ta2.ll
+++ b/tests/cases/switch64_ta2.ll
@@ -1,12 +1,14 @@
target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
target triple = "le32-unknown-nacl"
-@.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1]
+@.str = private constant [18 x i8] c"hello, world: %d\0A\00", align 1
+
+declare i32 @printf(i8*, ...)
define linkonce_odr i32 @main() align 2 {
- %a333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
- %a444 = zext i32 %a333 to i64
- %a199 = trunc i8 1 to i1 ; [#uses=1]
+ %a333 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 5)
+ %a400 = zext i32 %a333 to i64
+ %a444 = udiv i64 %a400, 3
switch i64 %a444, label %label999 [
i64 1000, label %label9950
i64 1001, label %label9951
@@ -18,41 +20,35 @@ define linkonce_odr i32 @main() align 2 {
i64 1007, label %label9957
i64 1008, label %label9958
i64 1009, label %label9959
- ] ; switch should ignore all code after it in the block
- ; No predecessors!
- %a472 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- cleanup
- %a473 = extractvalue { i8*, i32 } %a472, 0
- %a474 = extractvalue { i8*, i32 } %a472, 1
- br label %label999
+ ]
label9950:
- %a333b = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ %waka = phi i32 [1000, %0], [0, %label9951], [1, %label9952], [2, %label9953], [3, %label9954], [4, %label9955], [5, %label9956], [6, %label9957], [7, %label9958], [8, %label9959]
+ %a333b = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %waka)
br label %label999
label9951:
- br label %label999
+ br label %label9950
label9952:
- br label %label999
+ br label %label9950
label9953:
- br label %label999
+ br label %label9950
label9954:
- br label %label999
+ br label %label9950
label9955:
- br label %label999
+ br label %label9950
label9956:
- br label %label999
+ br label %label9950
label9957:
- br label %label999
+ br label %label9950
label9958:
- br label %label999
+ br label %label9950
label9959:
- br label %label999
+ br label %label9950
label999: ; preds = %555
+ %last = phi i32 [1, %0], [2, %label9950]
+ %a333c = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %last)
ret i32 0
}
-declare i32 @printf(i8*)
-declare i32 @__gxx_personality_v0(...)
-
diff --git a/tests/cases/switch64_ta2.txt b/tests/cases/switch64_ta2.txt
new file mode 100644
index 00000000..72084b0c
--- /dev/null
+++ b/tests/cases/switch64_ta2.txt
@@ -0,0 +1,2 @@
+hello, world: 5
+hello, world: 1
diff --git a/tests/cases/switch64b_ta2.ll b/tests/cases/switch64b_ta2.ll
new file mode 100644
index 00000000..4364725f
--- /dev/null
+++ b/tests/cases/switch64b_ta2.ll
@@ -0,0 +1,54 @@
+target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
+target triple = "le32-unknown-nacl"
+
+@.str = private constant [18 x i8] c"hello, world: %d\0A\00", align 1
+
+declare i32 @printf(i8*, ...)
+
+define linkonce_odr i32 @main() align 2 {
+ %a333 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 5)
+ %a400 = zext i32 %a333 to i64
+ %a444 = udiv i64 %a400, 3
+ switch i64 %a444, label %label999 [
+ i64 0, label %label9950
+ i64 1, label %label9951
+ i64 2, label %label9952
+ i64 3, label %label9953
+ i64 4, label %label9954
+ i64 5, label %label9955
+ i64 6, label %label9956
+ i64 7, label %label9957
+ i64 8, label %label9958
+ i64 9, label %label9959
+ ]
+
+label9950:
+ %waka = phi i32 [11000, %0], [10, %label9951], [11, %label9952], [12, %label9953], [13, %label9954], [14, %label9955], [15, %label9956], [16, %label9957], [17, %label9958], [18, %label9959]
+ %a333b = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %waka)
+ br label %label999
+
+label9951:
+ br label %label9950
+label9952:
+ br label %label9950
+label9953:
+ br label %label9950
+label9954:
+ br label %label9950
+label9955:
+ br label %label9950
+label9956:
+ br label %label9950
+label9957:
+ br label %label9950
+label9958:
+ br label %label9950
+label9959:
+ br label %label9950
+
+label999: ; preds = %555
+ %last = phi i32 [1, %0], [2, %label9950]
+ %a333c = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %last)
+ ret i32 0
+}
+
diff --git a/tests/cases/switch64b_ta2.txt b/tests/cases/switch64b_ta2.txt
new file mode 100644
index 00000000..917d42e5
--- /dev/null
+++ b/tests/cases/switch64b_ta2.txt
@@ -0,0 +1,3 @@
+hello, world: 5
+hello, world: 14
+hello, world: 2