From e345d6fc4e3223e2d2655114c8829538276a0bb9 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 25 Oct 2021 16:58:15 -0700 Subject: decl: Allow alignment > 16 of locals This is not yet supported by QBE, so for now we allocate a bit extra and choose the address in the allocated region with an aligned address. --- test/alignas-local-32.c | 4 ++++ test/alignas-local-32.qbe | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/alignas-local-32.c create mode 100644 test/alignas-local-32.qbe (limited to 'test') diff --git a/test/alignas-local-32.c b/test/alignas-local-32.c new file mode 100644 index 0000000..e69a105 --- /dev/null +++ b/test/alignas-local-32.c @@ -0,0 +1,4 @@ +int main(void) { + _Alignas(32) char x; + return (unsigned long)&x % 32; +} diff --git a/test/alignas-local-32.qbe b/test/alignas-local-32.qbe new file mode 100644 index 0000000..53bfab3 --- /dev/null +++ b/test/alignas-local-32.qbe @@ -0,0 +1,11 @@ +export +function w $main() { +@start.1 + %.1 =l alloc16 17 + %.2 =l add %.1, 16 + %.3 =l and %.2, 18446744073709551584 +@body.2 + %.4 =l extsw 32 + %.5 =l urem %.3, %.4 + ret %.5 +} -- cgit v1.2.3