summary refs log tree commit diff
path: root/test/vararg1.ssa
diff options
context:
space:
mode:
Diffstat (limited to 'test/vararg1.ssa')
-rw-r--r--test/vararg1.ssa30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/vararg1.ssa b/test/vararg1.ssa
new file mode 100644
index 0000000..28b3d0e
--- /dev/null
+++ b/test/vararg1.ssa
@@ -0,0 +1,30 @@
+export
+function d $f(l %x, ...) {
+@start
+	%vp =l alloc8 24
+	vastart %vp
+	%i =l vaarg %vp
+	%n =d vaarg %vp
+	ret %n
+}
+
+export
+function w $g(l %fmt, ...) {
+@start
+	%vp =l alloc8 24
+	vastart %vp
+	%r =w call $vprintf(l %fmt, l %vp)
+	ret %r
+}
+
+# >>> driver
+# extern double f(int, ...);
+# extern int g(char *, ...);
+# int main() {
+# 	g("Hell%c %s %g!\n", 'o', "world", f(42, "x", 42.0));
+# }
+# <<<
+
+# >>> output
+# Hello world 42!
+# <<<