Message ID | 55B7A4F3.3000302@arm.com |
---|---|
State | New |
Headers | show |
On 28 July 2015 at 16:51, Renlin Li <renlin.li@arm.com> wrote: > 2015-07-28 Renlin Li <renlin.li@arm.com> > > * gcc.target/aarch64/arm_align_max_pwr.c: Make it a compile test case, > check the assembly. > * gcc.target/aarch64/arm_align_max_stack_pwr.c: Likewise. Hi, #include <stdio.h> #include <assert.h> Test cases should not rely on external headers, see https://gcc.gnu.org/wiki/HowToPrepareATestcase and it looks like neither of these headers are actually required so OK with the includes removed (and tested). Cheers /Marcus
diff --git a/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c index bbb4c6f..ffa4d22 100644 --- a/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c @@ -1,15 +1,23 @@ -/* { dg-do run } */ - -#include <stdio.h> -#include <assert.h> +/* { dg-do compile } */ +/* { dg-options "-O1" } */ #define align (1ul << __ARM_ALIGN_MAX_PWR) static int x __attribute__ ((aligned (align))); +static int y __attribute__ ((aligned (align))); + +extern void foo (int *x, int *y); +extern int bar (int x, int y); int -main () +dummy () { - assert ((((unsigned long)&x) & (align - 1)) == 0); + int result; - return 0; + foo (&x, &y); + result = bar (x, y); + + return result; } + +/* { dg-final { scan-assembler-times "zero\t4" 2 } } */ +/* { dg-final { scan-assembler "zero\t268435452" } } */ 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 index 7a6355b..ea22b80 100644 --- a/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c @@ -1,15 +1,23 @@ -/* { dg-do run } */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ #include <stdio.h> #include <assert.h> #define align (1ul << __ARM_ALIGN_MAX_STACK_PWR) +extern void foo (int *x); +extern int bar (int x); int -main () +dummy () { int x __attribute__ ((aligned (align))); + int result; - assert ((((unsigned long)&x) & (align - 1)) == 0); - return 0; + foo (&x); + result = bar (x); + + return result; } + +/* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -65536" } } */