Message ID | 5570544B.8000508@arm.com |
---|---|
State | New |
Headers | show |
On 4 June 2015 at 14:36, Renlin Li <renlin.li@arm.com> wrote: > Hi Marcus, > > Sorry for the delay. I have come up with an updated patch. Two test cases > are added to check against the limit. > > __ARM_ALIGN_MAX_STACK_PWR is hard coded into 16. > __ARM_ALIGN_MAX_PWR is hard coded into 28 which is the maximum allowable > alignment user can define for aarch64 backend. > > > Okay to commit on trunk, and backport to 5.0? OK for trunk. /Marcus
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 25b9927..085148d 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -29,6 +29,10 @@ builtin_define ("__aarch64__"); \ builtin_define ("__ARM_64BIT_STATE"); \ builtin_define_with_int_value \ + ("__ARM_ALIGN_MAX_PWR", 28); \ + builtin_define_with_int_value \ + ("__ARM_ALIGN_MAX_STACK_PWR", 16); \ + builtin_define_with_int_value \ ("__ARM_ARCH", aarch64_architecture_version); \ cpp_define_formatted \ (parse_in, "__ARM_ARCH_%dA", aarch64_architecture_version); \ diff --git a/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c new file mode 100644 index 0000000..d8471f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +#include <stdio.h> +#include <assert.h> + +#define align (1ul << __ARM_ALIGN_MAX_PWR) +static int x __attribute__ ((aligned (align))); + +int +main () +{ + assert ((((unsigned long)&x) & (align - 1)) == 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c b/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c new file mode 100644 index 0000000..e2e7900 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +#include <stdio.h> +#include <assert.h> + +#define align (1ul << __ARM_ALIGN_MAX_STACK_PWR) + +int +main () +{ + int x __attribute__ ((aligned (align))); + + assert ((((unsigned long)&x) & (align - 1)) == 0); + return 0; +}