[PATCH] PR target/85456, Fix __builtin_powil for -mabi=ieeelongdouble on PowerPC

Segher Boessenkool segher@kernel.crashing.org
Fri Apr 20 15:53:00 GMT 2018


Hi Mike,

On Thu, Apr 19, 2018 at 12:33:45AM -0400, Michael Meissner wrote:
> This patch adds __powikf2 to libgcc, and makes GCC use it for __builtin_powil
> when long double is IEEE 128-bit (-mabi=ieeelongdouble).
> 
> I tested it on a little endian power8 system with a bootstrap compiler.  There
> were no regresion failures.  Can I check this into GCC 8?  This does not need
> to be checked into GCC 7, since -mabi=ieeelongdouble was not fully supported in
> that release.

> [libgcc]
> 2018-04-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
> 
> 	PR target/85456
> 	* config/rs6000/_powikf2.c: New file.  Entry point for
> 	__builtin_powil when -mabi=ieeelongdouble is in effect.
> 	* config/rs6000/float128-ifunc.c (__powikf2_resolve): Add
> 	__powikf2 support.
> 	(__powikf2): Likewise.
> 	* config/rs6000/quad-float128.h (__powikf2_sw): Likewise.
> 	(__powikf2_hw): Likewise.
> 	(__powikf2): Likewise.
> 	* config/rs6000/t-float128 (fp128_ppc_funcs): Likewise.
> 	* config/rs6000/t-float128-hw (fp128_hw_func): Likewise.
> 	(_powikf2-hw.c): Likewise.

This changelog does not make too much sense ("__powikf2: Add __powikf2
support." does not really say what it does, for example).

Does the leading underscore in the filename have any meaning?  The kc
files have one, too, but everything else does not.

> +#if defined(FLOAT128_HW_INSNS) && !defined(__powikf2)
> +#define __powikf2 __powikf2_sw
> +#endif

This could use a comment (it seems the wrong way around if you don't
see how it is built).

> +TFtype
> +__powikf2 (TFtype x, SItype_ppc m)
> +{
> +  unsigned int n = m < 0 ? -m : m;
> +  TFtype y = n % 2 ? x : 1;
> +  while (n >>= 1)
> +    {
> +      x = x * x;
> +      if (n % 2)
> +	y = y * x;
> +    }
> +  return m < 0 ? 1/y : y;
> +}

This work correctly for the most negative integer.  Okay.


Okay for trunk.  Thanks!


Segher



More information about the Gcc-patches mailing list