testsuite: Fix regression on m32 by r12-6087 [PR103820]

Message ID 20220111052719.3283397-1-luoxhu@linux.ibm.com
State Committed
Commit 0552605b7b27dc6beed62e71bd05bc1efd191c0d
Headers
Series testsuite: Fix regression on m32 by r12-6087 [PR103820] |

Commit Message

Xionghu Luo Jan. 11, 2022, 5:27 a.m. UTC
  r12-6087 will avoid move cold bb out of hot loop, while the original
intent of this testcase is to hoist divides out of loop and CSE them to
only one divide.  So increase the loop count to turn the cold bb to hot
bb again.  Then the 3 divides could be rewritten with same reciptmp.

Tested pass on Power-Linux {32,64}, x86 {64,32} and i686-linux, OK for
master?

gcc/testsuite/ChangeLog:

	PR 103820
	* gcc.dg/tree-ssa/recip-3.c: Adjust.
---
 gcc/testsuite/gcc.dg/tree-ssa/recip-3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Richard Biener Jan. 11, 2022, 7:21 a.m. UTC | #1
On Tue, Jan 11, 2022 at 6:27 AM Xionghu Luo <luoxhu@linux.ibm.com> wrote:
>
> r12-6087 will avoid move cold bb out of hot loop, while the original
> intent of this testcase is to hoist divides out of loop and CSE them to
> only one divide.  So increase the loop count to turn the cold bb to hot
> bb again.  Then the 3 divides could be rewritten with same reciptmp.
>
> Tested pass on Power-Linux {32,64}, x86 {64,32} and i686-linux, OK for
> master?

OK.

Thanks,
Richard.

> gcc/testsuite/ChangeLog:
>
>         PR 103820
>         * gcc.dg/tree-ssa/recip-3.c: Adjust.
> ---
>  gcc/testsuite/gcc.dg/tree-ssa/recip-3.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
> index 641c91e719e..410b28044b4 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
> @@ -1,7 +1,7 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */
>
> -double F[2] = { 0.0, 0.0 }, e;
> +double F[5] = { 0.0, 0.0 }, e;
>
>  /* In this case the optimization is interesting.  */
>  float h ()
> @@ -13,7 +13,7 @@ float h ()
>         d = 2.*e;
>         E = 1. - d;
>
> -       for( i=0; i < 2; i++ )
> +       for( i=0; i < 5; i++ )
>                 if( d > 0.01 )
>                 {
>                         P = ( W < E ) ? (W - E)/d : (E - W)/d;
> @@ -23,4 +23,4 @@ float h ()
>         F[0] += E / d;
>  }
>
> -/* { dg-final { scan-tree-dump-times " / " 5 "recip" } } */
> +/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */
> --
> 2.27.0.90.geebb51ba8c
>
  

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
index 641c91e719e..410b28044b4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */
 
-double F[2] = { 0.0, 0.0 }, e;
+double F[5] = { 0.0, 0.0 }, e;
 
 /* In this case the optimization is interesting.  */
 float h ()
@@ -13,7 +13,7 @@  float h ()
 	d = 2.*e;
 	E = 1. - d;
 
-	for( i=0; i < 2; i++ )
+	for( i=0; i < 5; i++ )
 		if( d > 0.01 )
 		{
 			P = ( W < E ) ? (W - E)/d : (E - W)/d;
@@ -23,4 +23,4 @@  float h ()
 	F[0] += E / d;
 }
 
-/* { dg-final { scan-tree-dump-times " / " 5 "recip" } } */
+/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */