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

Re: [PATCH] libquadmath/81848, allow PowerPC to enable libquadmath


On Tue, Aug 15, 2017 at 11:06:01PM -0400, Michael Meissner wrote:
> 2017-08-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
> 
> 	PR libquadmath/81848
> 	* configure.ac (powerpc*-linux*): Use attribute mode KC to create
> 	complex __float128 on PowerPC instead of attribute mode TC.
> 	* quadmth.h (__complex128): Likewise.

quadmath.h ?

> 	* configure: Regenerate.
> 	* math/cbrtq.c (CBRT2): Use __float128 not long double.
> 	(CBRT4): Likewise.
> 	(CBRT2I): Likewise.
> 	(CBRT4I): Likewise.
> 	* math/j0q.c (U0): Likewise.
> 	* math/sqrtq.c (sqrtq): Don't depend on implicit conversion
> 	between __float128, instead explicitly convert the __float128
> 	value to long double because the PowerPC does not allow __float128
> 	and long double in the same expression.

Does the Q suffix on ppc* imply __float128 like on x86_64 etc.?

> --- libquadmath/math/sqrtq.c	(revision 251097)
> +++ libquadmath/math/sqrtq.c	(working copy)
> @@ -31,15 +31,18 @@ sqrtq (const __float128 x)
>      return y;
>    }
>  
> -#ifdef HAVE_SQRTL
> -  if (x <= LDBL_MAX && x >= LDBL_MIN)
> +#if defined(HAVE_SQRTL)

Why the #ifdef -> #if defined change?  That looks unnecessary.

>    {
> -    /* Use long double result as starting point.  */
> -    y = sqrtl ((long double) x);
> +    long double xl = (long double)x;

Please add a space after (long double)

> +    if (xl <= LDBL_MAX && xl >= LDBL_MIN)
> +      {
> +	/* Use long double result as starting point.  */
> +	y = sqrtl (xl);
>  
> -    /* One Newton iteration.  */
> -    y -= 0.5q * (y - x / y);
> -    return y;
> +	/* One Newton iteration.  */
> +	y -= 0.5q * (y - x / y);
> +	return y;
> +      }
>    }
>  #endif
>  

Otherwise LGTM.

	Jakub


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