summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/vararg2.ssa88
1 files changed, 86 insertions, 2 deletions
diff --git a/test/vararg2.ssa b/test/vararg2.ssa
index 0b2eb53..cecb20a 100644
--- a/test/vararg2.ssa
+++ b/test/vararg2.ssa
@@ -278,6 +278,46 @@ export function $qbecall6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %a
 	ret
 }
 
+export function $qbeprint7(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %argw5, w %argw6, w %argw7, w %argw8, l %fmt, ...) {
+@start
+	%fmtdbl =l alloc4 4
+	%fmtint =l alloc4 4
+	%emptys =l alloc4 4
+	storew 2122789, %fmtint
+	storew 2123557, %fmtdbl
+	storew 0, %emptys
+	%vp =l alloc8 32
+	%fmt1 =l add 1, %fmt
+	vastart %vp
+@loop
+	%p =l phi @start %fmt1, @casef %p1, @cased %p1
+	%c =w loadsb %p
+	%p1 =l add 3, %p
+	jnz %c, @loop1, @end
+@loop1
+	%isg =w ceqw %c, 103
+	jnz %isg, @casef, @cased
+@casef
+	%dbl =d vaarg %vp
+	%r =w call $printf(l %fmtdbl, ..., d %dbl)
+	jmp @loop
+@cased
+	%int =w vaarg %vp
+	%r =w call $printf(l %fmtint, ..., w %int)
+	jmp @loop
+@end
+	%r =w call $puts(l %emptys)
+	ret
+}
+
+export function $qbecall7(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %argw5, w %argw6, w %argw7, w %argw8, l %fmt, ...) {
+@start
+	%vp =l alloc8 32
+	vastart %vp
+	%r =w call $print(l %fmt, l %vp)
+	ret
+}
+
 # >>> driver
 # #include <stdarg.h>
 # #include <stdio.h>
@@ -295,8 +335,10 @@ export function $qbecall6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %a
 # extern void qbecall5(int argw0, int argw1, int argw2, int argw3, int argw4, double argd0, double argd1, double argd2, double argd3, double argd4, double argd5, double argd6, char *, ...);
 # extern void qbeprint6(int argw0, int argw1, int argw2, int argw3, int argw4, int argw5, int argw6, int argw7, int argw8, int argw9, double argd0, double argd1, double argd2, double argd3, double argd4, double argd5, double argd6, double argd7, double argd8, double argd9, char *, ...);
 # extern void qbecall6(int argw0, int argw1, int argw2, int argw3, int argw4, int argw5, int argw6, int argw7, int argw8, int argw9, double argd0, double argd1, double argd2, double argd3, double argd4, double argd5, double argd6, double argd7, double argd8, double argd9, char *, ...);
-# int print(const char *fmt, va_list *ap) {
-# 	return vprintf(fmt, *ap);
+# extern void qbeprint7(int argw0, int argw1, int argw2, int argw3, int argw4, int argw5, int argw6, int argw7, int argw8, char *, ...);
+# extern void qbecall7(int argw0, int argw1, int argw2, int argw3, int argw4, int argw5, int argw6, int argw7, int argw8, char *, ...);
+# int print(char *fmt, va_list *ap) {
+#    return vprintf(fmt, *ap);
 # }
 # int main() {
 # 	puts("# (0 int, 0 double)");
@@ -446,6 +488,27 @@ export function $qbecall6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %a
 # 	qbecall6(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %d %g %g \n", -2, -1, 4.582, 3.467);
 # 	qbeprint6(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "\n");
 # 	qbecall6(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "\n");
+# 	puts("# (9 int, 0 double)");
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d \n", 10);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d \n", 10);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g \n", -8.032);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g \n", -8.032);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %g \n", -2, -3.214);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %g \n", -2, -3.214);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g \n", 7.233, -5.027);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g \n", 7.233, -5.027);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %d %d %d \n", -7, -1, -2, -5);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %d %d %d \n", -7, -1, -2, -5);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g %g %g \n", -5.004, 8.465, -1.137, 7.227);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g %g %g \n", -5.004, 8.465, -1.137, 7.227);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %g %d %g \n", 1, -8.988, 10, 6.721);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %g %d %g \n", 1, -8.988, 10, 6.721);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g %d %d \n", 9.38, 8.527, 7, -7);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%g %g %d %d \n", 9.38, 8.527, 7, -7);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %d %g %g \n", 0, -6, -1.979, -8.827);
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "%d %d %g %g \n", 0, -6, -1.979, -8.827);
+# 	qbeprint7(0, 0, 0, 0, 0, 0, 0, 0, 0, "\n");
+# 	qbecall7(0, 0, 0, 0, 0, 0, 0, 0, 0, "\n");
 # }
 # <<<
 
@@ -597,4 +660,25 @@ export function $qbecall6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %a
 # -2 -1 4.582 3.467 
 # 
 # 
+# # (9 int, 0 double)
+# 10 
+# 10 
+# -8.032 
+# -8.032 
+# -2 -3.214 
+# -2 -3.214 
+# 7.233 -5.027 
+# 7.233 -5.027 
+# -7 -1 -2 -5 
+# -7 -1 -2 -5 
+# -5.004 8.465 -1.137 7.227 
+# -5.004 8.465 -1.137 7.227 
+# 1 -8.988 10 6.721 
+# 1 -8.988 10 6.721 
+# 9.38 8.527 7 -7 
+# 9.38 8.527 7 -7 
+# 0 -6 -1.979 -8.827 
+# 0 -6 -1.979 -8.827 
+# 
+# 
 # <<<