diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/builtin-va-copy+aarch64.c (renamed from test/builtin-va-copy.c) | 0 | ||||
-rw-r--r-- | test/builtin-va-copy+aarch64.qbe (renamed from test/builtin-va-copy.qbe) | 0 | ||||
-rw-r--r-- | test/builtin-va-copy+x86_64.c | 4 | ||||
-rw-r--r-- | test/builtin-va-copy+x86_64.qbe | 18 | ||||
-rw-r--r-- | test/varargs+aarch64.c (renamed from test/varargs.c) | 0 | ||||
-rw-r--r-- | test/varargs+aarch64.qbe (renamed from test/varargs.qbe) | 0 | ||||
-rw-r--r-- | test/varargs+riscv64.c | 12 | ||||
-rw-r--r-- | test/varargs+riscv64.qbe | 22 | ||||
-rw-r--r-- | test/varargs+x86_64.c | 12 | ||||
-rw-r--r-- | test/varargs+x86_64.qbe | 22 | ||||
-rw-r--r-- | test/varargs-pass-valist+aarch64.c | 5 | ||||
-rw-r--r-- | test/varargs-pass-valist+aarch64.qbe | 9 | ||||
-rw-r--r-- | test/varargs-pass-valist+riscv64.c | 5 | ||||
-rw-r--r-- | test/varargs-pass-valist+riscv64.qbe | 9 | ||||
-rw-r--r-- | test/varargs-pass-valist+x86_64.c | 5 | ||||
-rw-r--r-- | test/varargs-pass-valist+x86_64.qbe | 8 |
16 files changed, 131 insertions, 0 deletions
diff --git a/test/builtin-va-copy.c b/test/builtin-va-copy+aarch64.c index 7a69596..7a69596 100644 --- a/test/builtin-va-copy.c +++ b/test/builtin-va-copy+aarch64.c diff --git a/test/builtin-va-copy.qbe b/test/builtin-va-copy+aarch64.qbe index 6c8d288..6c8d288 100644 --- a/test/builtin-va-copy.qbe +++ b/test/builtin-va-copy+aarch64.qbe diff --git a/test/builtin-va-copy+x86_64.c b/test/builtin-va-copy+x86_64.c new file mode 100644 index 0000000..7a69596 --- /dev/null +++ b/test/builtin-va-copy+x86_64.c @@ -0,0 +1,4 @@ +void f(void) { + static __builtin_va_list a, b; + __builtin_va_copy(a, b); +} diff --git a/test/builtin-va-copy+x86_64.qbe b/test/builtin-va-copy+x86_64.qbe new file mode 100644 index 0000000..47e1d9e --- /dev/null +++ b/test/builtin-va-copy+x86_64.qbe @@ -0,0 +1,18 @@ +data $.La.2 = align 8 { z 24 } +data $.Lb.3 = align 8 { z 24 } +export +function $f() { +@start.1 +@body.2 + %.1 =l loadl $.Lb.3 + storel %.1, $.La.2 + %.2 =l add $.Lb.3, 8 + %.3 =l add $.La.2, 8 + %.4 =l loadl %.2 + storel %.4, %.3 + %.5 =l add %.2, 8 + %.6 =l add %.3, 8 + %.7 =l loadl %.5 + storel %.7, %.6 + ret +} diff --git a/test/varargs.c b/test/varargs+aarch64.c index 0b5a73d..0b5a73d 100644 --- a/test/varargs.c +++ b/test/varargs+aarch64.c diff --git a/test/varargs.qbe b/test/varargs+aarch64.qbe index 512a8c7..512a8c7 100644 --- a/test/varargs.qbe +++ b/test/varargs+aarch64.qbe diff --git a/test/varargs+riscv64.c b/test/varargs+riscv64.c new file mode 100644 index 0000000..0b5a73d --- /dev/null +++ b/test/varargs+riscv64.c @@ -0,0 +1,12 @@ +void f(int n, ...) { + __builtin_va_list ap; + + __builtin_va_start(ap, n); + while (n) { + __builtin_va_arg(ap, int); + __builtin_va_arg(ap, float); + __builtin_va_arg(ap, char *); + --n; + } + __builtin_va_end(ap); +} diff --git a/test/varargs+riscv64.qbe b/test/varargs+riscv64.qbe new file mode 100644 index 0000000..7fcda8d --- /dev/null +++ b/test/varargs+riscv64.qbe @@ -0,0 +1,22 @@ +export +function $f(w %.1, ...) { +@start.1 + %.2 =l alloc4 4 + storew %.1, %.2 + %.3 =l alloc8 8 +@body.2 + vastart %.3 +@while_cond.3 + %.4 =w loadw %.2 + jnz %.4, @while_body.4, @while_join.5 +@while_body.4 + %.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 + ret +} diff --git a/test/varargs+x86_64.c b/test/varargs+x86_64.c new file mode 100644 index 0000000..0b5a73d --- /dev/null +++ b/test/varargs+x86_64.c @@ -0,0 +1,12 @@ +void f(int n, ...) { + __builtin_va_list ap; + + __builtin_va_start(ap, n); + while (n) { + __builtin_va_arg(ap, int); + __builtin_va_arg(ap, float); + __builtin_va_arg(ap, char *); + --n; + } + __builtin_va_end(ap); +} diff --git a/test/varargs+x86_64.qbe b/test/varargs+x86_64.qbe new file mode 100644 index 0000000..641afa1 --- /dev/null +++ b/test/varargs+x86_64.qbe @@ -0,0 +1,22 @@ +export +function $f(w %.1, ...) { +@start.1 + %.2 =l alloc4 4 + storew %.1, %.2 + %.3 =l alloc8 24 +@body.2 + vastart %.3 +@while_cond.3 + %.4 =w loadw %.2 + jnz %.4, @while_body.4, @while_join.5 +@while_body.4 + %.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 + ret +} diff --git a/test/varargs-pass-valist+aarch64.c b/test/varargs-pass-valist+aarch64.c new file mode 100644 index 0000000..c1ede84 --- /dev/null +++ b/test/varargs-pass-valist+aarch64.c @@ -0,0 +1,5 @@ +void f(__builtin_va_list ap); +void g(void) { + static __builtin_va_list ap; + f(ap); +} diff --git a/test/varargs-pass-valist+aarch64.qbe b/test/varargs-pass-valist+aarch64.qbe new file mode 100644 index 0000000..67cef8a --- /dev/null +++ b/test/varargs-pass-valist+aarch64.qbe @@ -0,0 +1,9 @@ +data $.Lap.2 = align 8 { z 32 } +type :va_list.1 = align 8 { 32 } +export +function $g() { +@start.1 +@body.2 + call $f(:va_list.1 $.Lap.2) + ret +} diff --git a/test/varargs-pass-valist+riscv64.c b/test/varargs-pass-valist+riscv64.c new file mode 100644 index 0000000..c1ede84 --- /dev/null +++ b/test/varargs-pass-valist+riscv64.c @@ -0,0 +1,5 @@ +void f(__builtin_va_list ap); +void g(void) { + static __builtin_va_list ap; + f(ap); +} diff --git a/test/varargs-pass-valist+riscv64.qbe b/test/varargs-pass-valist+riscv64.qbe new file mode 100644 index 0000000..937f50a --- /dev/null +++ b/test/varargs-pass-valist+riscv64.qbe @@ -0,0 +1,9 @@ +data $.Lap.2 = align 8 { z 8 } +export +function $g() { +@start.1 +@body.2 + %.1 =l loadl $.Lap.2 + call $f(l %.1) + ret +} diff --git a/test/varargs-pass-valist+x86_64.c b/test/varargs-pass-valist+x86_64.c new file mode 100644 index 0000000..c1ede84 --- /dev/null +++ b/test/varargs-pass-valist+x86_64.c @@ -0,0 +1,5 @@ +void f(__builtin_va_list ap); +void g(void) { + static __builtin_va_list ap; + f(ap); +} diff --git a/test/varargs-pass-valist+x86_64.qbe b/test/varargs-pass-valist+x86_64.qbe new file mode 100644 index 0000000..50d9283 --- /dev/null +++ b/test/varargs-pass-valist+x86_64.qbe @@ -0,0 +1,8 @@ +data $.Lap.2 = align 8 { z 24 } +export +function $g() { +@start.1 +@body.2 + call $f(l $.Lap.2) + ret +} |