diff mbox series

[v2] testsuite: Adjust switch-exp-transform-3.c for 32bit

Message ID ZqogtnpUMqB_K10x@pc-76.home
State New
Headers show
Series [v2] testsuite: Adjust switch-exp-transform-3.c for 32bit | expand

Commit Message

Filip Kastl July 31, 2024, 11:32 a.m. UTC
On Wed 2024-07-31 12:18:34, Jakub Jelinek wrote:
> On Wed, Jul 31, 2024 at 12:02:08PM +0200, Filip Kastl wrote:
> > 32bit x86 CPUs won't natively support the FFS operation on a 64 bit
> > type.  Therefore, the switch-exp-transform-3.c test will always fail
> > with a 32bit target.  I'm fixing my mistake.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 	* gcc.target/i386/switch-exp-transform-3.c: Remove code testing
> > 	  that the exponential index transform is able to handle long
> > 	  long int.
> 
> But for -m64 it does and it is good to test even that.
> Can't you wrap the long long stuff with
> #ifdef __x86_64__
> and
> do
> /* { dg-final { scan-tree-dump-times "Applying exponential index transform" 4 "switchconv" { target ia32 } } } */
> /* { dg-final { scan-tree-dump-times "Applying exponential index transform" 6 "switchconv" { target { ! ia32 } } } } */
> or so?
> 
> 	Jakub
> 

Thanks for the feedback!  Here is a second version of the patch.  I've tested
this version with

make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c --target_board='unix{-m32}'"

and

make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c"

on a x86_64 machine and in both cases the test didn't produce any errors and
scan-tree-dump-times was successful.

Is this version ok?

Thanks,
Filip Kastl


-- 8< --


testsuite: Adjust switch-exp-transform-3.c for 32bit

32bit x86 CPUs won't natively support the FFS operation on a 64 bit
type.  Therefore, I'm setting the long long int part of the
switch-exp-transform-3.c test to only execute with 64bit targets.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/switch-exp-transform-3.c: Set the long long
	  int test to only execute with 64bit targets.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
---
 gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jakub Jelinek July 31, 2024, 11:34 a.m. UTC | #1
On Wed, Jul 31, 2024 at 01:32:06PM +0200, Filip Kastl wrote:
> Thanks for the feedback!  Here is a second version of the patch.  I've tested
> this version with
> 
> make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c --target_board='unix{-m32}'"
> 
> and
> 
> make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c"

You can just use
make check RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} i386.exp=switch-exp-transform-3.c"

> testsuite: Adjust switch-exp-transform-3.c for 32bit
> 
> 32bit x86 CPUs won't natively support the FFS operation on a 64 bit
> type.  Therefore, I'm setting the long long int part of the
> switch-exp-transform-3.c test to only execute with 64bit targets.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/i386/switch-exp-transform-3.c: Set the long long
> 	  int test to only execute with 64bit targets.

There should be just tab, not tab + 2 spaces before int test.
Ok with that nit changed.

	Jakub
Filip Kastl July 31, 2024, 11:44 a.m. UTC | #2
On Wed 2024-07-31 13:34:28, Jakub Jelinek wrote:
> On Wed, Jul 31, 2024 at 01:32:06PM +0200, Filip Kastl wrote:
> > Thanks for the feedback!  Here is a second version of the patch.  I've tested
> > this version with
> > 
> > make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c --target_board='unix{-m32}'"
> > 
> > and
> > 
> > make check RUNTESTFLAGS="i386.exp=gcc.target/i386/switch-exp-transform-3.c"
> 
> You can just use
> make check RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} i386.exp=switch-exp-transform-3.c"
> 
> > testsuite: Adjust switch-exp-transform-3.c for 32bit
> > 
> > 32bit x86 CPUs won't natively support the FFS operation on a 64 bit
> > type.  Therefore, I'm setting the long long int part of the
> > switch-exp-transform-3.c test to only execute with 64bit targets.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 	* gcc.target/i386/switch-exp-transform-3.c: Set the long long
> > 	  int test to only execute with 64bit targets.
> 
> There should be just tab, not tab + 2 spaces before int test.
> Ok with that nit changed.
> 
> 	Jakub
> 

Ok, removed the 2 spaces and pushed the patch.

Thanks,
Filip Kastl
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c b/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c
index c8fae70692e..64a7b146172 100644
--- a/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c
+++ b/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c
@@ -99,6 +99,8 @@  int unopt_unsigned_long(unsigned long bit_position)
     }
 }
 
+#ifdef __x86_64__
+
 int unopt_long_long(long long bit_position)
 {
     switch (bit_position)
@@ -145,4 +147,7 @@  int unopt_unsigned_long_long(unsigned long long bit_position)
     }
 }
 
-/* { dg-final { scan-tree-dump-times "Applying exponential index transform" 6 "switchconv" } } */
+#endif
+
+/* { dg-final { scan-tree-dump-times "Applying exponential index transform" 4 "switchconv" { target ia32 } } } */
+/* { dg-final { scan-tree-dump-times "Applying exponential index transform" 6 "switchconv" { target { ! ia32 } } } } */