public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite] Fix PR64796: bswap64 effective target should not cache its result
@ 2015-01-27 11:00 Thomas Preud'homme
  2015-02-03 18:58 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Preud'homme @ 2015-01-27 11:00 UTC (permalink / raw)
  To: gcc-patches, Rainer Orth, Mike Stump, Janis Johnson

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.preudhomme@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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, testsuite] Fix PR64796: bswap64 effective target should not cache its result
  2015-01-27 11:00 [PATCH, testsuite] Fix PR64796: bswap64 effective target should not cache its result Thomas Preud'homme
@ 2015-02-03 18:58 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-02-03 18:58 UTC (permalink / raw)
  To: Thomas Preud'homme, gcc-patches, Rainer Orth, Mike Stump,
	Janis Johnson

On 01/27/15 02:36, Thomas Preud'homme wrote:
> 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.preudhomme@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.
OK.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-03 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 11:00 [PATCH, testsuite] Fix PR64796: bswap64 effective target should not cache its result Thomas Preud'homme
2015-02-03 18:58 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).