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

Re: implement __builtin_copysign

On Fri, Jan 28, 2005 at 11:21:23AM +0000, Joseph S. Myers wrote:
> Or, rather, an algorithm which achieves the Annex G treatment of NaNs and 
> infinities but also takes more care to avoid undue overflow (an attachment 
> to bug 18902 illustrates division with scaling to avoid overflow in 
> calculation of either numerator or denominator, but without dealing with 
> NaNs and infinities).

Unfortunately, the best ways to to the logrithmic reduction involve
routines from a c99 libm, and we don't link against the
system libm.  Further, doing so would pessimize program startup times
for the bulk of programs.

We can either use the plain division reduction mechanism that we 
currently use for trees, or we can implement some more builtins to
do exponent manipulation.  The primitives that I was thinking of 
would be *similar* to ldexp/frexp, but not exactly.  I was actually
thinking of the "copy-sign-and-exponent" type of instructions that
exist on alpha and ia64.

But I'm definitely starting with plain division.  That'll prove that
the code paths leading into libgcc are working.  We can discuss the
Right and Proper way to actually perform the division separately.


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