This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[jh@suse.cz: Re: Complete sqrt patch...]


Hi,
I've installed the attached patch as obvious to fix i386 sqrt builtin
breakage introduced by my -mfpmath change.

Honza

----- Forwarded message from Jan Hubicka <jh@suse.cz> -----

Date: Fri, 14 Dec 2001 19:24:10 +0100
From: Jan Hubicka <jh@suse.cz>
To: Roger Sayle <roger@eyesopen.com>
Cc: Andreas Jaeger <aj@suse.de>, Jan Hubicka <jh@suse.cz>
Subject: Re: Complete sqrt patch...
In-Reply-To: <Pine.LNX.4.33.0112141019100.31018-100000@www.eyesopen.com>
User-Agent: Mutt/1.3.20i

> 
> Hi Andreas,
> > Honza, does i386.md need to get fixed - and how?
> 
> I'm beginning to suspect that it might indeed be i386.md related issue.
> Due to this bug in mainline we haven't actually been generating sqrtdf
> instructions on most platforms.  And the fact that you're seeing problems
> whilst I'm not may be due to differences our processors rather than a
> mistake in my patch.
> 
> For the record, /proc/cpuinfo describes my processor as GenuineIntel
> Pentium III (Copermine) [2x998MHz].
> 
> Given that the unrecognized insn looks reasonable, I'm guessing that
> the GCC routine that generates code the RTL for __builtin_sqrt is
> not checking whether the pattern is valid (i.e. only checking HAVE_sqrt
> or similar).
> 
> Jan, can you shed any light on this problem?
I've already noticed that problem too. It is because I've somewhat messed
update of sqrt patterns while implementing the -mfpmath patch.
I am attaching fix I am going to test (BTW the conditionals were already
wrong before the patch).
> 
> Andreas, could you check if __builtin_sin and __builtin_cos are working
> on your machine?
These should not be problem - they are not affected by sse changes.

I will probably install this change as obvious if it will pass checking.

Fri Dec 14 19:23:22 CET 2001  Jan Hubicka  <jh@suse.cz>
	* i386.md (sqrt?f2): Reorganize conditions to math rest of patterns.
Index: i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.322
diff -c -3 -p -r1.322 i386.md
*** i386.md	2001/12/14 11:20:24	1.322
--- i386.md	2001/12/14 18:22:06
***************
*** 14446,14454 ****
  (define_expand "sqrtsf2"
    [(set (match_operand:SF 0 "register_operand" "")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
!   "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387) || TARGET_SSE"
  {
!   if (!TARGET_SSE)
      operands[1] = force_reg (SFmode, operands[1]);
  })
  
--- 14446,14454 ----
  (define_expand "sqrtsf2"
    [(set (match_operand:SF 0 "register_operand" "")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
!   "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387) || TARGET_SSE_MATH"
  {
!   if (!TARGET_SSE_MATH)
      operands[1] = force_reg (SFmode, operands[1]);
  })
  
***************
*** 14456,14462 ****
    [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && (TARGET_SSE && TARGET_MIX_SSE_I387)"
    "@
     fsqrt
     sqrtss\t{%1, %0|%0, %1}"
--- 14456,14462 ----
    [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && (TARGET_SSE_MATH && TARGET_MIX_SSE_I387)"
    "@
     fsqrt
     sqrtss\t{%1, %0|%0, %1}"
***************
*** 14467,14473 ****
  (define_insn "sqrtsf2_1_sse_only"
    [(set (match_operand:SF 0 "register_operand" "=x")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
!   "TARGET_SSE && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
    "sqrtss\t{%1, %0|%0, %1}"
    [(set_attr "type" "sse")
     (set_attr "mode" "SF")
--- 14467,14473 ----
  (define_insn "sqrtsf2_1_sse_only"
    [(set (match_operand:SF 0 "register_operand" "=x")
  	(sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
!   "TARGET_SSE_MATH && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
    "sqrtss\t{%1, %0|%0, %1}"
    [(set_attr "type" "sse")
     (set_attr "mode" "SF")
***************
*** 14477,14483 ****
    [(set (match_operand:SF 0 "register_operand" "=f")
  	(sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && (!TARGET_SSE && !TARGET_MIX_SSE_I387)"
    "fsqrt"
    [(set_attr "type" "fpspc")
     (set_attr "mode" "SF")
--- 14477,14483 ----
    [(set (match_operand:SF 0 "register_operand" "=f")
  	(sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && !TARGET_SSE_MATH"
    "fsqrt"
    [(set_attr "type" "fpspc")
     (set_attr "mode" "SF")
***************
*** 14518,14524 ****
    [(set (match_operand:DF 0 "register_operand" "=f")
  	(sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && (!TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_MIX_SSE_I387)"
    "fsqrt"
    [(set_attr "type" "fpspc")
     (set_attr "mode" "DF")
--- 14518,14524 ----
    [(set (match_operand:DF 0 "register_operand" "=f")
  	(sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
    "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
!    && (!TARGET_SSE2 || !TARGET_SSE_MATH)"
    "fsqrt"
    [(set_attr "type" "fpspc")
     (set_attr "mode" "DF")

----- End forwarded message -----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]