aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-10-25 16:58:15 -0700
committerMichael Forney <mforney@mforney.org>2021-10-25 17:02:24 -0700
commite345d6fc4e3223e2d2655114c8829538276a0bb9 (patch)
tree4da93396c83926ffb8c04380ed1628bea830d1ad /test
parent7ffff16e6745c267b77d23a047f6ca5f20ca71e7 (diff)
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.
Diffstat (limited to 'test')
-rw-r--r--test/alignas-local-32.c4
-rw-r--r--test/alignas-local-32.qbe11
2 files changed, 15 insertions, 0 deletions
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
+}