As explained in PR64796, code for bswap64 effective target computes the answer 
once and then cache. However the result depends on the flags passed to the 
compiler and with --target_board it's possible to test several sets of flags. 
Besides, this code assume only lp64 targets can do 64-bit bswap when all 32-bit 
targets also can by virtue of expand_doubleword_bswap () called in expand_unop 
(). This patch solve both problems by removing the caching of the result and 
changing the condition to include all target with 32-bit or more wordsize.

ChangeLog entry is as follows:

**** gcc/testsuite/ChangeLog ***

2015-01-27  Thomas Preud'homme  <thomas.preudho...@arm.com>

        PR testsuite/64796
        * lib/target-supports.exp (check_effective_target_bswap64): Do not
        cache result in a global variable.  Include all 32-bit targets for
        bswap64 tests.


diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index e51d07d..9aaf229 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5039,18 +5039,11 @@ proc check_effective_target_bswap32 { } {
 proc check_effective_target_bswap64 { } {
     global et_bswap64_saved
 
-    if [info exists et_bswap64_saved] {
-        verbose "check_effective_target_bswap64: using cached result" 2
-    } else {
-       set et_bswap64_saved 0
-       if { [is-effective-target bswap]
-            && [is-effective-target lp64] } {
-          set et_bswap64_saved 1
-       }
+    # expand_unop can expand 64-bit byte swap on 32-bit targets
+    if { [is-effective-target bswap] && [is-effective-target int32plus] } {
+       return 1
     }
-
-    verbose "check_effective_target_bswap64: returning $et_bswap64_saved" 2
-    return $et_bswap64_saved
+    return 0
 }
 
 # Return 1 if the target supports atomic operations on "int" and "long".


Testing done:
* arm-none-eabi-gcc cross-compiler was built and x86_64 GCC native compiler was 
bootstrapped. Both show no regressions when running the testsuite and 
optimize-bswapdi-* tests are run for arm-non-eabi-gcc.
* optimize-bswapdi-* are also run when passing --target_board=unix/-m32 in 
RUNTESTFLAGS.


Is this ok for trunk?

Best regards,

Thomas



Reply via email to