This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: [PATCH] PPC faster sqrt functions


> +/* The method is based on a description in
> +   Computation of elementary functions on the IBM RISC System/6000 processor,
> +   P. W. Markstein, IBM J. Res. Develop, 34(1) 1990.
> +   Basically, it consists of two interleaved Newton-Rhapson approximations,
> +   one to find the actual square root, and one to find its reciprocal
> +   without the expense of a division operation.   The tricky bit here
> +   is the use of the POWER/PowerPC multiply-add operation to get the
> +   required accuracy with high speed.
> +
> +   The argument reduction works by a combination of table lookup to
> +   obtain the initial guesses, and some careful modification of the
> +   generated guesses (which mostly runs on the integer unit, while the
> +   Newton-Rhapson is running on the FPU).  */
> +
> +#ifdef __STDC__
> +double
> +__slow_ieee754_sqrt (double x)
> +#else
> +double
> +__slow_ieee754_sqrt (x)
> +     double x;
> +#endif
> +{
> +  const float inf = a_inf.value;
> +
> +  if (x > 0)
> +    {
> +      /* schedule the EXTRACT_WORDS to get separation between the store
> +         and the load.  */
> +      ieee_double_shape_type ew_u;
> +      ieee_double_shape_type iw_u;
> +      ew_u.value = (x);
> +      if (x != inf)
> +	{
> +	  /* Variables named starting with 's' exist in the
> +	     argument-reduced space, so that 2 > sx >= 0.5,
> +	     1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... .
> +	     Variables named ending with 'i' are integer versions of
> +	     floating-point values.  */
> [...]

What's all that crap?  There is already a generic implementation and
this must be used.  If the generic implementation can be improved this
is another thing but nothing of any concern here.

-- 
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â


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