summary refs log tree commit diff
path: root/lisc/test
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-18 17:50:14 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-18 17:50:27 -0400
commitdab9590ce754e6fd4b3a311a195fcf797c3b3eb3 (patch)
tree14f99f1771067207f882bc9fd650ebf58744349c /lisc/test
parente6048212be65159d865c41a803b2c4b3e075ff49 (diff)
downloadroux-dab9590ce754e6fd4b3a311a195fcf797c3b3eb3.tar.gz
add the first stand-alone test program
Diffstat (limited to 'lisc/test')
-rw-r--r--lisc/test/echo.ssa28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisc/test/echo.ssa b/lisc/test/echo.ssa
new file mode 100644
index 0000000..56e7305
--- /dev/null
+++ b/lisc/test/echo.ssa
@@ -0,0 +1,28 @@
+function $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 ceq %ac, 0
+	jnz %c0, @end, @loop1
+@loop1
+	%c1 =w ceq %ac, 1
+	jnz %c1, @last, @nolast
+@last
+	jmp @loop2
+@nolast
+	jmp @loop2
+@loop2
+	%sep =w phi @last 10, @nolast 32
+	%arg =l load %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
+}