This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: weird optimization in sin+cos, x86 backend
On 02/09/2012 10:20 AM, James Courtier-Dutton wrote:
> From what I can see, on x86_64, the hardware fsin(x) is more accurate
> than the hardware fsincos(x).
> As you gradually increase the size of X from 0 to 10e22, fsincos(x)
> diverges from the correct accurate value quicker than fsin(x) does.
>
> So, from this I would say that using fsincos instead of fsin is not a
> good idea, at least on x86_64 platforms.
That's true iff you're using the hardware builtins, which we're not on
GNU/Linux unless you're using -ffast-math. If you're using
-ffast-math, the fsincos optimization is appropriate anyway because
you want fast. If you're not using -ffast-math it's still
appropriate, because we're using an accurate libm.
Andrew.
- References:
- weird optimization in sin+cos, x86 backend
- From: Konstantin Vladimirov
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- Re: weird optimization in sin+cos, x86 backend
- From: James Courtier-Dutton