On Tue, 29 Dec 2015, Michael Meissner wrote:

> +/* __eqkf2 returns 0 if equal, or 1 if not equal or NaN.  */
> +CMPtype
> +__eqkf2_hw (TFtype a, TFtype b)
> +{
> +  return (__builtin_isunordered (a, b) || (a != b)) ? 1 : 0;

This is more complicated than necessary.  "return a != b;" will suffice.

> +/* __gekf2 returns -1 if a < b, 0 if a == b, +1 if a > b, or -2 if NaN.  */
> +CMPtype
> +__gekf2_hw (TFtype a, TFtype b)
> +{
> +  if (__builtin_isunordered (a, b))
> +    return -2;
> +
> +  else if (a < b)
> +    return -1;

The __builtin_isunordered check should come after the < check, so that the 
"invalid" exception gets raised for quiet NaN arguments.

> +/* __lekf2 returns -1 if a < b, 0 if a == b, +1 if a > b, or +2 if NaN.  */
> +CMPtype
> +__lekf2_hw (TFtype a, TFtype b)
> +{
> +  if (__builtin_isunordered (a, b))
> +    return 2;
> +
> +  else if (a < b)
> +    return -1;

Likewise.

> +      char *p = (char *) getauxval (AT_PLATFORM);

glibc deliberately exports __getauxval at a public symbol version, so you 
can do this in a namespace-clean way.

> +CMPtype __eqkf2 (TFtype, TFtype)
> +  __attribute__ ((__ifunc__ ("__eqkf2_resolve")));
> +
> +CMPtype __gekf2 (TFtype, TFtype)
> +  __attribute__ ((__ifunc__ ("__gekf2_resolve")));
> +
> +CMPtype __lekf2 (TFtype, TFtype)
> +  __attribute__ ((__ifunc__ ("__lekf2_resolve")));

Don't you need to arrange __nekf2, __gtkf2, __ltkf2 aliases to these 
resolvers (the semantics mean they don't need to be separate functions, 
but the entry points need to be there given the optabs the back end sets 
up)?

> +#ifdef _ARCH_PPC64
> +TItype_ppc __fixkfti (TFtype)
> +  __attribute__ ((__ifunc__ ("__fixkfti_resolve")));
> +
> +UTItype_ppc __fixunskfti (TFtype)
> +  __attribute__ ((__ifunc__ ("__fixunskfti_resolve")));
> +
> +TFtype __floattikf (TItype_ppc)
> +  __attribute__ ((__ifunc__ ("__floattikf_resolve")));
> +
> +TFtype __floatuntikf (UTItype_ppc)
> +  __attribute__ ((__ifunc__ ("__floatuntikf_resolve")));
> +#endif

I don't see the point of using ifuncs that just always return the software 
version.  You might as well just give the software version the appropriate 
function name directly, and add ifuncs later if adding a version using 
hardware arithmetic (e.g. doing something like the libgcc2.c functions 
with hardware conversions to/from DImode).

> +#define ISA_BIT(x) (1 << (63 - x))

As far as I can see, my previous comment still applies: this part of the 
sfp-machine.h changes needs to be under some appropriate conditional so 
that it only applies when building the KFmode functions, not for 32-bit 
soft-float / e500 libgcc builds.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to