aboutsummaryrefslogtreecommitdiff
path: root/test/varargs+riscv64.qbe
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-07 12:50:50 -0700
committerMichael Forney <mforney@mforney.org>2021-09-07 13:19:19 -0700
commit97c8fc5358bbecb6e2452425861e6cd5a5c93f91 (patch)
tree8bebb448e9c460072bf4e2aa52dce138d9ffcd1c /test/varargs+riscv64.qbe
parent056c471bb7f85854e2af7a0166785d06820b251a (diff)
expr: Fix varargs again and add more tests
Diffstat (limited to 'test/varargs+riscv64.qbe')
-rw-r--r--test/varargs+riscv64.qbe41
1 files changed, 34 insertions, 7 deletions
diff --git a/test/varargs+riscv64.qbe b/test/varargs+riscv64.qbe
index 7fcda8d..a918014 100644
--- a/test/varargs+riscv64.qbe
+++ b/test/varargs+riscv64.qbe
@@ -1,22 +1,49 @@
export
-function $f(w %.1, ...) {
+function w $f1(w %.1, l %.3) {
@start.1
%.2 =l alloc4 4
storew %.1, %.2
- %.3 =l alloc8 8
+ %.4 =l alloc8 8
+ storel %.3, %.4
@body.2
+ %.5 =w vaarg %.4
+ ret %.5
+}
+export
+function w $f2(w %.1, ...) {
+@start.3
+ %.2 =l alloc4 4
+ storew %.1, %.2
+ %.3 =l alloc4 4
+ %.4 =l alloc8 8
+@body.4
+ vastart %.4
+ %.5 =w loadw %.2
+ %.6 =l loadl %.4
+ %.7 =w call $f1(w %.5, l %.6)
+ storew %.7, %.3
+ %.8 =w loadw %.3
+ ret %.8
+}
+export
+function $f3(w %.1, ...) {
+@start.5
+ %.2 =l alloc4 4
+ storew %.1, %.2
+ %.3 =l alloc8 8
+@body.6
vastart %.3
-@while_cond.3
+@while_cond.7
%.4 =w loadw %.2
- jnz %.4, @while_body.4, @while_join.5
-@while_body.4
+ jnz %.4, @while_body.8, @while_join.9
+@while_body.8
%.5 =w vaarg %.3
%.6 =s vaarg %.3
%.7 =l vaarg %.3
%.8 =w loadw %.2
%.9 =w sub %.8, 1
storew %.9, %.2
- jmp @while_cond.3
-@while_join.5
+ jmp @while_cond.7
+@while_join.9
ret
}