summary refs log tree commit diff
path: root/test/ldhoist.ssa
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-10-27 21:01:37 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-12-12 22:17:03 -0500
commit8d8d551df23b5055507c501e3396dcfe3c33af2d (patch)
tree7932bf91d9d17d17d954a425ab195820d3081578 /test/ldhoist.ssa
parent3f147ed2e078769a71b2935fc36cb08b2b0ddb67 (diff)
downloadroux-8d8d551df23b5055507c501e3396dcfe3c33af2d.tar.gz
new tests for the load optimization
Diffstat (limited to 'test/ldhoist.ssa')
-rw-r--r--test/ldhoist.ssa21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ldhoist.ssa b/test/ldhoist.ssa
new file mode 100644
index 0000000..d4b1b64
--- /dev/null
+++ b/test/ldhoist.ssa
@@ -0,0 +1,21 @@
+# loads must not be unsafely hoisted
+
+export
+function w $f(w %n, l %p) {
+@start
+	%r =w copy 0
+@loop
+	%n =w sub %n, 1
+	%c =w csgew %n, 0
+	jnz %c, @loop1, @end
+@loop1
+	%r =w loadw %p
+	jmp @loop
+@end
+	ret %r
+}
+
+# >>> driver
+# extern int f(int, int *);
+# int main() { return f(0, 0); }
+# <<<