From 2cbd75bbab472b6861dc0ae806e41cf139518fe6 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Fri, 22 Feb 2019 12:25:50 -0800 Subject: Implement __builtin_alloca --- tests/builtin-alloca.c | 3 +++ tests/builtin-alloca.qbe | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/builtin-alloca.c create mode 100644 tests/builtin-alloca.qbe (limited to 'tests') 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 +} -- cgit v1.2.3