public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Fix check_effective_target_sqrt_insn (PR99352)
@ 2021-03-09 17:08 Segher Boessenkool
  2021-03-10  5:06 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2021-03-09 17:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool, Alexandre Oliva

The previous version returned true for all PowerPC.  This is incorrect.
We only support floating point square root instructions if a) we support
floating point instructions at all, and b) we have _ARCH_PPCSQ defined.

2020-03-09  Segher Boessenkool  <segher@kernel.crashing.org>

	* testsuite/lib/target-supports.exp
	(check_effective_target_powerpc_sqrt): New.
	(check_effective_target_sqrt_insn): Use it.
---
 gcc/testsuite/lib/target-supports.exp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 570d5d3de00c..52d3d036d3c5 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5887,6 +5887,21 @@ proc check_effective_target_powerpc_hard_double { } {
     }
 }
 
+# Return 1 if this is a PowerPC target with hardware floating point sqrt.
+
+proc check_effective_target_powerpc_sqrt { } {
+    # We need to be PowerPC, and we need to have hardware fp enabled.
+    if {![check_effective_target_powerpc_fprs]} {
+      return 0;
+    }
+
+    return [check_no_compiler_messages powerpc_sqrt object {
+	#ifndef _ARCH_PPCSQ
+	#error _ARCH_PPCSQ is not defined
+	#endif
+    } {}]
+}
+
 # Return 1 if this is a PowerPC target supporting -maltivec.
 
 proc check_effective_target_powerpc_altivec_ok { } {
@@ -7581,7 +7596,7 @@ proc check_effective_target_vect_call_copysignf { } {
 proc check_effective_target_sqrt_insn { } {
     return [check_cached_effective_target sqrt_insn {
       expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
-	     || [istarget powerpc*-*-*]
+	     || [check_effective_target_powerpc_sqrt]
 	     || [istarget aarch64*-*-*]
 	     || ([istarget arm*-*-*] && [check_effective_target_arm_vfp_ok])
 	     || ([istarget s390*-*-*]
-- 
1.8.3.1


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

* Re: [PATCH] rs6000: Fix check_effective_target_sqrt_insn (PR99352)
  2021-03-09 17:08 [PATCH] rs6000: Fix check_effective_target_sqrt_insn (PR99352) Segher Boessenkool
@ 2021-03-10  5:06 ` Alexandre Oliva
  2021-03-12  2:37   ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2021-03-10  5:06 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-patches, dje.gcc

On Mar  9, 2021, Segher Boessenkool <segher@kernel.crashing.org> wrote:

> +    return [check_no_compiler_messages powerpc_sqrt object {

I don't think you really need to assemble this.  s/object/assembly/
would do.  Even preprocessing alone would do, but I don't think
check_compiler can do that.

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

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

* Re: [PATCH] rs6000: Fix check_effective_target_sqrt_insn (PR99352)
  2021-03-10  5:06 ` Alexandre Oliva
@ 2021-03-12  2:37   ` Segher Boessenkool
  0 siblings, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2021-03-12  2:37 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, dje.gcc

On Wed, Mar 10, 2021 at 02:06:24AM -0300, Alexandre Oliva wrote:
> On Mar  9, 2021, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> 
> > +    return [check_no_compiler_messages powerpc_sqrt object {
> 
> I don't think you really need to assemble this.  s/object/assembly/
> would do.  Even preprocessing alone would do, but I don't think
> check_compiler can do that.

We use object in all similar tests.  It helps to check if the assembler
is set up for the options used.  That doesn't matter for this test of
course, but making things more tricky for no win is a bad tradeoff.

Also, I didn't even bother to consider not assembling it :-)


Segher

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

end of thread, other threads:[~2021-03-12  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 17:08 [PATCH] rs6000: Fix check_effective_target_sqrt_insn (PR99352) Segher Boessenkool
2021-03-10  5:06 ` Alexandre Oliva
2021-03-12  2:37   ` Segher Boessenkool

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).