Message ID | ZqoLoJSsBrRI3Hgu@pc-76.home |
---|---|
State | New |
Headers | show |
Series | testsuite: Adjust switch-exp-transform-3.c for 32bit | expand |
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
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..cd00071d0bc 100644 --- a/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c +++ b/gcc/testsuite/gcc.target/i386/switch-exp-transform-3.c @@ -4,8 +4,7 @@ /* Checks that the exponential index transformation is done for all these types of the index variable: - (unsigned) int - - (unsigned) long - - (unsigned) long long */ + - (unsigned) long */ int unopt_int(int bit_position) { @@ -99,50 +98,4 @@ int unopt_unsigned_long(unsigned long bit_position) } } -int unopt_long_long(long long bit_position) -{ - switch (bit_position) - { - case (1 << 0): - return 0; - case (1 << 1): - return 1; - case (1 << 2): - return 2; - case (1 << 3): - return 3; - case (1 << 4): - return 4; - case (1 << 5): - return 5; - case (1 << 6): - return 6; - default: - return 0; - } -} - -int unopt_unsigned_long_long(unsigned long long bit_position) -{ - switch (bit_position) - { - case (1 << 0): - return 0; - case (1 << 1): - return 1; - case (1 << 2): - return 2; - case (1 << 3): - return 3; - case (1 << 4): - return 4; - case (1 << 5): - return 5; - case (1 << 6): - return 6; - default: - return 0; - } -} - -/* { dg-final { scan-tree-dump-times "Applying exponential index transform" 6 "switchconv" } } */ +/* { dg-final { scan-tree-dump-times "Applying exponential index transform" 4 "switchconv" } } */
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. Signed-off-by: Filip Kastl <fkastl@suse.cz> --- .../gcc.target/i386/switch-exp-transform-3.c | 51 +------------------ 1 file changed, 2 insertions(+), 49 deletions(-)