public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][AARCH64] Make arm_align_max_stack_pwr.c and arm_align_max_pwr.c compile testcase, instead of execution.
@ 2015-07-28 16:38 Renlin Li
  2015-08-18  8:32 ` Marcus Shawcroft
  0 siblings, 1 reply; 2+ messages in thread
From: Renlin Li @ 2015-07-28 16:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Marcus Shawcroft, Ramana Radhakrishnan

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

Hi all,

This is a simple patch to make arm_align_max_stack_pwr.c and 
arm_align_max_pwr.c compile test cases, instead of execution tests.

In my local machine, those test cases pass. However, they fail on some 
systems with process memory usage restrictions. Anyway, the required 
space for those two newly defined macros are too big.

By rewriting the test cases, the basic maximum alignment support is 
checked at compile time. The correct code generation is checked by 
scanning assembly output.

Tested using aarch64-none-linux-gnu and aarch64-none-elf toolchain. They 
all passes.

Okay to commit?

gcc/testsuite/ChangeLog:

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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tmp.diff --]
[-- Type: text/x-patch; name=tmp.diff, Size: 1800 bytes --]

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" } } */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][AARCH64] Make arm_align_max_stack_pwr.c and arm_align_max_pwr.c compile testcase, instead of execution.
  2015-07-28 16:38 [PATCH][AARCH64] Make arm_align_max_stack_pwr.c and arm_align_max_pwr.c compile testcase, instead of execution Renlin Li
@ 2015-08-18  8:32 ` Marcus Shawcroft
  0 siblings, 0 replies; 2+ messages in thread
From: Marcus Shawcroft @ 2015-08-18  8:32 UTC (permalink / raw)
  To: Renlin Li; +Cc: gcc-patches, Marcus Shawcroft, Ramana Radhakrishnan

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-18  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 16:38 [PATCH][AARCH64] Make arm_align_max_stack_pwr.c and arm_align_max_pwr.c compile testcase, instead of execution Renlin Li
2015-08-18  8:32 ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).