aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-06-27 16:10:44 -0700
committerMichael Forney <mforney@mforney.org>2019-06-27 16:36:51 -0700
commit0741a9b99ee72481e11272081343cc655a3a856f (patch)
tree1222919710d878458f6ba26c4d4c8bc4966aa649 /test
parent6400c868e2b320cac821581ed4bc6a65e2a216fc (diff)
downloadcproc-0741a9b99ee72481e11272081343cc655a3a856f.tar.xz
qbe: Fix switch statements with 64-bit controlling expression
Diffstat (limited to 'test')
-rw-r--r--test/switch-long-long.c7
-rw-r--r--test/switch-long-long.qbe30
2 files changed, 37 insertions, 0 deletions
diff --git a/test/switch-long-long.c b/test/switch-long-long.c
new file mode 100644
index 0000000..65e022f
--- /dev/null
+++ b/test/switch-long-long.c
@@ -0,0 +1,7 @@
+int main(void) {
+ switch (0x12300000000) {
+ case 0: return 1;
+ case 0x12300000000: return 0;
+ }
+ return 2;
+}
diff --git a/test/switch-long-long.qbe b/test/switch-long-long.qbe
new file mode 100644
index 0000000..a13feab
--- /dev/null
+++ b/test/switch-long-long.qbe
@@ -0,0 +1,30 @@
+export
+function w $main() {
+@start.1
+@body.2
+ jmp @switch_cond.3
+@switch_case.5
+ ret 1
+@switch_case.6
+ ret 0
+@switch_cond.3
+ %.1 =w ceql 1249835483136, 0
+ jnz %.1, @switch_case.5, @switch_ne.7
+@switch_ne.7
+ %.2 =w cultl 1249835483136, 0
+ jnz %.2, @switch_lt.8, @switch_gt.9
+@switch_lt.8
+ jmp @switch_join.4
+@switch_gt.9
+ %.3 =w ceql 1249835483136, 1249835483136
+ jnz %.3, @switch_case.6, @switch_ne.10
+@switch_ne.10
+ %.4 =w cultl 1249835483136, 1249835483136
+ jnz %.4, @switch_lt.11, @switch_gt.12
+@switch_lt.11
+ jmp @switch_join.4
+@switch_gt.12
+ jmp @switch_join.4
+@switch_join.4
+ ret 2
+}