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 <fka...@suse.cz> --- gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 } } } } */ -- 2.45.2