aboutsummaryrefslogtreecommitdiff
path: root/test/echo.ssa
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2016-03-27 15:00:45 -0400
committerQuentin Carbonneaux <[email protected]>2016-03-27 15:00:45 -0400
commit36635660b40573f6a0c19d50dfdd9277589030de (patch)
treea1b4463f7260462c314bd8d7cb35b3d199143f33 /test/echo.ssa
parentaad52241c88ad5327a8488c66dc906c8393c9c92 (diff)
extract tests out of src
Diffstat (limited to 'test/echo.ssa')
-rw-r--r--test/echo.ssa32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/echo.ssa b/test/echo.ssa
new file mode 100644
index 0000000..d3c8a25
--- /dev/null
+++ b/test/echo.ssa
@@ -0,0 +1,32 @@
+function w $main(w %argc, l %argv) {
+@start
+ %fmt =l alloc8 8
+ storel 1663398693, %fmt # "%s%c"
+ %av0 =l add %argv, 8
+ %ac0 =w sub %argc, 1
+@loop
+ %av =l phi @start %av0, @loop2 %av1
+ %ac =w phi @start %ac0, @loop2 %ac1
+ %c0 =w ceqw %ac, 0
+ jnz %c0, @end, @loop1
+@loop1
+ %c1 =w ceqw %ac, 1
+ jnz %c1, @last, @nolast
+@last
+ jmp @loop2
+@nolast
+ jmp @loop2
+@loop2
+ %sep =w phi @last 10, @nolast 32
+ %arg =l loadl %av
+ %r =w call $printf(l %fmt, l %arg, w %sep)
+ %av1 =l add %av, 8
+ %ac1 =w sub %ac, 1
+ jmp @loop
+@end
+ ret 0
+}
+
+# >>> output
+# a b c
+# <<<