diff mbox series

-mno-long-calls for arm/headmerge tests

Message ID ork0t6l7zy.fsf@lxoliva.fsfla.org
State New
Headers show
Series -mno-long-calls for arm/headmerge tests | expand

Commit Message

Alexandre Oliva Dec. 25, 2020, 6:22 a.m. UTC
The headmerge tests pass a constant to conditional calls, so that the
same constant is always passed to a function, though it's a different
function depending on which path is taken.

The test checks that the constant appears only once in the assembly
output, as a means to verify that the insns setting up the argument
are unified: they appear as separate insns up to jump2, where
crossjump identifies a common prefix to all conditional paths and
unifies them.

Alas, with -mlong-calls, that we enable in our arm-vxworks
configurations, the argument register is loaded after loading the
callee address into another register.  Since each path calls a
different function, there's no common initial code sequence for
crossjump to unify, and the argument register set up remains separate,
so the test fails.

Though it would surely be desirable for the compiler to perform the
unification of the argument register setting up, this patch merely
avoids the effects of -mlong-calls, with an explicit -mno-long-calls.

Regstrapped on x86_64-linux-gnu, also tested on arm-vxworks7r2.
Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.target/arm/headmerge-1.c: Add -mno-long-calls.
	* gcc.target/arm/headmerge-2.c: Likewise.
---
 gcc/testsuite/gcc.target/arm/headmerge-1.c |    2 +-
 gcc/testsuite/gcc.target/arm/headmerge-2.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Sandiford Dec. 29, 2020, 9:53 a.m. UTC | #1
Alexandre Oliva <oliva@adacore.com> writes:
> The headmerge tests pass a constant to conditional calls, so that the
> same constant is always passed to a function, though it's a different
> function depending on which path is taken.
>
> The test checks that the constant appears only once in the assembly
> output, as a means to verify that the insns setting up the argument
> are unified: they appear as separate insns up to jump2, where
> crossjump identifies a common prefix to all conditional paths and
> unifies them.
>
> Alas, with -mlong-calls, that we enable in our arm-vxworks
> configurations, the argument register is loaded after loading the
> callee address into another register.  Since each path calls a
> different function, there's no common initial code sequence for
> crossjump to unify, and the argument register set up remains separate,
> so the test fails.
>
> Though it would surely be desirable for the compiler to perform the
> unification of the argument register setting up, this patch merely
> avoids the effects of -mlong-calls, with an explicit -mno-long-calls.
>
> Regstrapped on x86_64-linux-gnu, also tested on arm-vxworks7r2.
> Ok to install?

OK, thanks.

Richard

> for  gcc/testsuite/ChangeLog
>
> 	* gcc.target/arm/headmerge-1.c: Add -mno-long-calls.
> 	* gcc.target/arm/headmerge-2.c: Likewise.
> ---
>  gcc/testsuite/gcc.target/arm/headmerge-1.c |    2 +-
>  gcc/testsuite/gcc.target/arm/headmerge-2.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/arm/headmerge-1.c b/gcc/testsuite/gcc.target/arm/headmerge-1.c
> index 218c6a21ebd27..319ccd254626d 100644
> --- a/gcc/testsuite/gcc.target/arm/headmerge-1.c
> +++ b/gcc/testsuite/gcc.target/arm/headmerge-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile }  */
> -/* { dg-options "-O2" }  */
> +/* { dg-options "-O2 -mno-long-calls" }  */
>  /* { dg-final { scan-assembler-times "#120" 1 } } */
>  
>  extern void foo1 (int);
> diff --git a/gcc/testsuite/gcc.target/arm/headmerge-2.c b/gcc/testsuite/gcc.target/arm/headmerge-2.c
> index 17d8e9365c52e..a015eb0f56905 100644
> --- a/gcc/testsuite/gcc.target/arm/headmerge-2.c
> +++ b/gcc/testsuite/gcc.target/arm/headmerge-2.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile }  */
> -/* { dg-options "-O2" }  */
> +/* { dg-options "-O2 -mno-long-calls" }  */
>  /* { dg-final { scan-assembler-times "120\n" 1 } } */
>  
>  extern void foo1 (int);
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/arm/headmerge-1.c b/gcc/testsuite/gcc.target/arm/headmerge-1.c
index 218c6a21ebd27..319ccd254626d 100644
--- a/gcc/testsuite/gcc.target/arm/headmerge-1.c
+++ b/gcc/testsuite/gcc.target/arm/headmerge-1.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile }  */
-/* { dg-options "-O2" }  */
+/* { dg-options "-O2 -mno-long-calls" }  */
 /* { dg-final { scan-assembler-times "#120" 1 } } */
 
 extern void foo1 (int);
diff --git a/gcc/testsuite/gcc.target/arm/headmerge-2.c b/gcc/testsuite/gcc.target/arm/headmerge-2.c
index 17d8e9365c52e..a015eb0f56905 100644
--- a/gcc/testsuite/gcc.target/arm/headmerge-2.c
+++ b/gcc/testsuite/gcc.target/arm/headmerge-2.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile }  */
-/* { dg-options "-O2" }  */
+/* { dg-options "-O2 -mno-long-calls" }  */
 /* { dg-final { scan-assembler-times "120\n" 1 } } */
 
 extern void foo1 (int);