aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-22 12:25:50 -0800
committerMichael Forney <mforney@mforney.org>2019-02-22 12:25:50 -0800
commit2cbd75bbab472b6861dc0ae806e41cf139518fe6 (patch)
tree15435cabe49771c07664df83824297cfa3d9f008 /tests
parentf2a079fa1a94b6a99e7ce432b6df17fdb4c9b554 (diff)
Implement __builtin_alloca
Diffstat (limited to 'tests')
-rw-r--r--tests/builtin-alloca.c3
-rw-r--r--tests/builtin-alloca.qbe12
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/builtin-alloca.c b/tests/builtin-alloca.c
new file mode 100644
index 0000000..f086f19
--- /dev/null
+++ b/tests/builtin-alloca.c
@@ -0,0 +1,3 @@
+void f(void) {
+ int *x = __builtin_alloca(32);
+}
diff --git a/tests/builtin-alloca.qbe b/tests/builtin-alloca.qbe
new file mode 100644
index 0000000..75a1fe1
--- /dev/null
+++ b/tests/builtin-alloca.qbe
@@ -0,0 +1,12 @@
+export
+function $f() {
+@start.1
+ %.1 =l alloc8 8
+@body.2
+ %.2 =l add %.1, 0
+ %.3 =l extsw 32
+ %.4 =l alloc16 %.3
+ %.5 =l copy %.4
+ storel %.5, %.2
+ ret
+}