Patchwork [doc] Fix -mno-fancy-math-387

login
register
mail settings
Submitter Gerald Pfeifer
Date Feb. 16, 2011, 1:12 a.m.
Message ID <alpine.LFD.2.02.1102160204130.2792@ybpnyubfg6.ybpnyqbznva6>
Download mbox | patch
Permalink /patch/83321/
State New
Headers show

Comments

Gerald Pfeifer - Feb. 16, 2011, 1:12 a.m.
The documentation indicates that -mno-fancy-math-387 is the default
on FreeBSD, yet I do not see any code actually implementing that, and
I verified that the following

  #include <math.h>

  double f(double d) {
    return __builtin_sin(d);
  }

did generate fsin with -ffast-math as the only option.

Richard, http://gcc.gnu.org/ml/gcc-patches/2002-03/msg02001.html was
the last time someone really made changes in this area, though the
reference to FreeBSD predates your patch where you added OpenBSD and
NetBSD for both of which I _do_ see code in config/i386 to that extent,
unlike FreeBSD.

Am I missing something obvious, or is the patch below okay?

Gerald


2011-02-16  Gerald Pfeifer  <gerald@pfeifer.com>

	PR target/37072
	* doc/invoke.texi (i386 and x86-64 Options): -mno-fancy-math-387
	is not actually the default on FreeBSD.
	Uppercase CPU.
Gerald Pfeifer - June 28, 2015, 3:50 p.m.
Now that Andreas is on board, time to dust off some older issues 
of mine. :-)

I verified that current GCC HEAD generates fsincos on FreeBSD/i386
with -ffastmath (and no options otherwise), and generates a call
to a sin() function otherwise.

So, okay to apply this patch?  And if so, okay to push back to
GCC 5 and 4.9 as well?

Gerald

On Wed, 16 Feb 2011, Gerald Pfeifer wrote:
> The documentation indicates that -mno-fancy-math-387 is the default
> on FreeBSD, yet I do not see any code actually implementing that, and
> I verified that the following
> 
>   #include <math.h>
> 
>   double f(double d) {
>     return __builtin_sin(d);
>   }
> 
> did generate fsin with -ffast-math as the only option.
> 
> Richard, http://gcc.gnu.org/ml/gcc-patches/2002-03/msg02001.html was
> the last time someone really made changes in this area, though the
> reference to FreeBSD predates your patch where you added OpenBSD and
> NetBSD for both of which I _do_ see code in config/i386 to that extent,
> unlike FreeBSD.
> 
> Am I missing something obvious, or is the patch below okay?
> 
> Gerald
> 
> 
> 2011-02-16  Gerald Pfeifer  <gerald@pfeifer.com>
> 
> 	PR target/37072
> 	* doc/invoke.texi (i386 and x86-64 Options): -mno-fancy-math-387
> 	is not actually the default on FreeBSD.
> 	Uppercase CPU.
> 
> Index: doc/invoke.texi
> ===================================================================
> --- doc/invoke.texi	(revision 170120)
> +++ doc/invoke.texi	(working copy)
> @@ -12273,9 +12273,9 @@
>  @opindex mno-fancy-math-387
>  Some 387 emulators do not support the @code{sin}, @code{cos} and
>  @code{sqrt} instructions for the 387.  Specify this option to avoid
> -generating those instructions.  This option is the default on FreeBSD,
> +generating those instructions.  This option is the default on
>  OpenBSD and NetBSD@.  This option is overridden when @option{-march}
> -indicates that the target cpu will always have an FPU and so the
> +indicates that the target CPU will always have an FPU and so the
>  instruction will not need emulation.  As of revision 2.6.1, these
>  instructions are not generated unless you also use the
>  @option{-funsafe-math-optimizations} switch.
>
Andreas Tobler - July 2, 2015, 8:25 p.m.
On 28.06.15 17:50, Gerald Pfeifer wrote:
> Now that Andreas is on board, time to dust off some older issues
> of mine. :-)
>
> I verified that current GCC HEAD generates fsincos on FreeBSD/i386
> with -ffastmath (and no options otherwise), and generates a call
> to a sin() function otherwise.
>
> So, okay to apply this patch?  And if so, okay to push back to
> GCC 5 and 4.9 as well?

Aehm, sorry for the delay. It is hot here ....

Fine with me as far as I can decide/approve.

At least for trunk. For 5.2, I guess you must hurry since Richi wants to 
spin a candidate tomorrow.

On 4.9, I can't decide since I have no idea about the release planning. 
Have to inform myself.


Thanks,
Andreas


> On Wed, 16 Feb 2011, Gerald Pfeifer wrote:
>> The documentation indicates that -mno-fancy-math-387 is the default
>> on FreeBSD, yet I do not see any code actually implementing that, and
>> I verified that the following
>>
>>    #include <math.h>
>>
>>    double f(double d) {
>>      return __builtin_sin(d);
>>    }
>>
>> did generate fsin with -ffast-math as the only option.
>>
>> Richard, http://gcc.gnu.org/ml/gcc-patches/2002-03/msg02001.html was
>> the last time someone really made changes in this area, though the
>> reference to FreeBSD predates your patch where you added OpenBSD and
>> NetBSD for both of which I _do_ see code in config/i386 to that extent,
>> unlike FreeBSD.
>>
>> Am I missing something obvious, or is the patch below okay?
>>
>> Gerald
>>
>>
>> 2011-02-16  Gerald Pfeifer  <gerald@pfeifer.com>
>>
>> 	PR target/37072
>> 	* doc/invoke.texi (i386 and x86-64 Options): -mno-fancy-math-387
>> 	is not actually the default on FreeBSD.
>> 	Uppercase CPU.
>>
>> Index: doc/invoke.texi
>> ===================================================================
>> --- doc/invoke.texi	(revision 170120)
>> +++ doc/invoke.texi	(working copy)
>> @@ -12273,9 +12273,9 @@
>>   @opindex mno-fancy-math-387
>>   Some 387 emulators do not support the @code{sin}, @code{cos} and
>>   @code{sqrt} instructions for the 387.  Specify this option to avoid
>> -generating those instructions.  This option is the default on FreeBSD,
>> +generating those instructions.  This option is the default on
>>   OpenBSD and NetBSD@.  This option is overridden when @option{-march}
>> -indicates that the target cpu will always have an FPU and so the
>> +indicates that the target CPU will always have an FPU and so the
>>   instruction will not need emulation.  As of revision 2.6.1, these
>>   instructions are not generated unless you also use the
>>   @option{-funsafe-math-optimizations} switch.
>>
>
>

Patch

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 170120)
+++ doc/invoke.texi	(working copy)
@@ -12273,9 +12273,9 @@ 
 @opindex mno-fancy-math-387
 Some 387 emulators do not support the @code{sin}, @code{cos} and
 @code{sqrt} instructions for the 387.  Specify this option to avoid
-generating those instructions.  This option is the default on FreeBSD,
+generating those instructions.  This option is the default on
 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
-indicates that the target cpu will always have an FPU and so the
+indicates that the target CPU will always have an FPU and so the
 instruction will not need emulation.  As of revision 2.6.1, these
 instructions are not generated unless you also use the
 @option{-funsafe-math-optimizations} switch.