This is the mail archive of the
`gcc@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] |

*From*: Jan Hubicka <jh at suse dot cz>*To*: Tom Womack <tom at womack dot net>*Cc*: Jan Hubicka <jh at suse dot cz>, gcc at gcc dot gnu dot org*Date*: Tue, 19 Feb 2002 15:33:04 +0100*Subject*: Re: sin/cos via SSE2, and an alignment bug (was Re: sqrt via SSE2)*References*: <001b01c1b6ff$f11fe6c0$5637f380@maths.nottingham.ac.uk> <20020217170516.GB14522@atrey.karlin.mff.cuni.cz> <000501c1b934$b36408c0$5637f380@maths.nottingham.ac.uk> <20020219111705.GE24069@atrey.karlin.mff.cuni.cz> <004b01c1b946$599e9960$5637f380@maths.nottingham.ac.uk>

> > > There's then the issue, though it's probably more one for the next glibc > > > release after gcc-3.1 appears, of whether a sin() implementation using > SSE2 > > > code and a suitable rational-function approximation could get adequate > > > results in less than the 190-or-so cycles that fsin takes: I'm pretty > sure > > > it's possible, even given that the necessary two divides can't take less > > > than 70 ticks and that one might want a table-lookup for argument > reduction. > > > > Yes, we need to address this issue eventually. > > Annoyingly, whilst I've quickly cobbled together a strategy that ought to > work for sin() -- a degree-4 Pad\'e approximation is accurate to within > 7.5e-18 in [0 .. Pi/32], a 64-V2DF lookup table and a trig identity extend > to [0 .. 2*Pi], and I trust that > > MOVSD twopi, XMM0 > DIVSD XMM0, XMM1 -- divide by 53-bit-precision 2*PI > CVTTPD2DQ XMM1, XMM2 -- round to nearest integer > CVTTDQ2PD XMM2, XMM3 -- bring back to a double > MULSD XMM0, XMM3 -- multiple by 53-bit-precision 2*PI > SUBSD XMM3, XMM1 -- and get the remainder > > is good-enough argument reduction for -ffast-math -- the actual > implementation really wants to be written using the SSE2 built-ins which at > present don't exist. > > So I'll put that on a back-burner for the moment and continue bug-hunting: > I've got a rather suspicious problem at the moment where the use of unions > containing attribute(("V4SI")) elements either crashes the compiler in > expr.c, or generates code which uses MOVPD on non-16-byte-aligned objects > and segfaults. Can you show me the testcase? Note that gcc does not align properly stack frame of function main () in case your runtime don't. Many Linux distros contain glibc compiled by gcc 2.95 that miscompiles it in a way that stack is missaligned at the entry. Stack alignment works for nested functions, but just until you don't get it missaligned by being called via some callback from 2.95 code. Honza > > I'll bring in a more complete report tomorrow if the problem still exists > in -20020218, but for the moment see PR C/5680. > > Tom

**Follow-Ups**:**Re: sin/cos via SSE2, and an alignment bug (was Re: sqrt via SSE2)***From:*Richard Henderson

**References**:**sqrt via SSE2 registers***From:*Tom Womack

**Re: sqrt via SSE2 registers***From:*Jan Hubicka

**Re: sqrt via SSE2 registers***From:*Tom Womack

**Re: sqrt via SSE2 registers***From:*Jan Hubicka

**sin/cos via SSE2, and an alignment bug (was Re: sqrt via SSE2)***From:*Tom Womack

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |