[PATCH 4/5] aarch/fpu: use generic sqrt, fma functions

Ramana Radhakrishnan ramana.gcc@googlemail.com
Mon Jun 1 22:08:04 GMT 2020


On Mon, Jun 1, 2020 at 10:45 PM Vineet Gupta via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On 6/1/20 9:38 AM, Adhemerval Zanella via Libc-alpha wrote:
> >
> >
> > On 29/05/2020 23:00, Vineet Gupta wrote:
> >> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> >
> > LGTM, some comments below.
> >
> >> -#include <math_private.h>
> >> -#include <libm-alias-finite.h>
> >> -
> >> -double
> >> -__ieee754_sqrt (double d)
> >> -{
> >> -  return __builtin_sqrt (d);
> >> -}
> >> -libm_alias_finite (__ieee754_sqrt, __sqrt)
> >
> > Ok.
>
> How is one to test aarch64 port with hard-float. build-many-glibc doesn't have a
> hf variant and hacking one didn't do the right thing either.

AArch64 is hard-float by default : there is no soft-float variant.

regards
Ramana

>
> >> diff --git a/sysdeps/aarch64/fpu/math-use-builtins.h b/sysdeps/aarch64/fpu/math-use-builtins.h
> >> new file mode 100644
> >> index 000000000000..52f0a0dad6dd
> >> --- /dev/null
> >> +++ b/sysdeps/aarch64/fpu/math-use-builtins.h
> >> @@ -0,0 +1,70 @@
> >> +/* Using math gcc builtins instead of generic implementation.  aarch64 version.
> >> +   Copyright (C) 2019-2020 Free Software Foundation, Inc.
> >
> > I think it should be just 2020 here.
>
> Fixed.
>
> >> +
> >> +/* Define these macros to 1 to use __builtin_xyz instead of the
> >> +   generic implementation.  */
> >> +#define USE_NEARBYINT_BUILTIN 0
> >> +#define USE_NEARBYINTF_BUILTIN 0
> >> +#define USE_NEARBYINTL_BUILTIN 0
> >> +#define USE_NEARBYINTF128_BUILTIN 0
> >
> > Since we are adding this new file for aarch64, we could also enable it fo
> > nearbyint{f} and remove sysdeps/aarch64/fpu/s_nearbyint{f}.c as well.
>
> OK, but only
>
> +#define USE_NEARBYINT_BUILTIN 1
> +#define USE_NEARBYINTF_BUILTIN 1
>
> The other 2 are not defined currently. If they are, then I prefer they be enabled
> as a separate commit for bisectability.
>
>
> >> +#define USE_RINT_BUILTIN 0
> >> +#define USE_RINTF_BUILTIN 0
> >> +#define USE_RINTL_BUILTIN 0
> >> +#define USE_RINTF128_BUILTIN 0
> >
> > Ditto.
>
> OK and again only RINT and RINTF.
> Also I don't understand one thing. Both the generic and aarch64 code have this
>
> float
> __rintf (float x)
> ...
> libm_alias_float (__rint, rint)
>
> The alias arg 1 __rint seems to lack suffix 'f' ?
>
>
> >> +
> >> +#define USE_FLOOR_BUILTIN 0
> >> +#define USE_FLOORF_BUILTIN 0
>
> Again FLOOR, FLOORF only
>
> >> +#define USE_FLOORL_BUILTIN 0
> >> +#define USE_FLOORF128_BUILTIN 0
> >
> > Ditto.
>
> Ditto
>
>
> >> +
> >> +#define USE_CEIL_BUILTIN 0
> >> +#define USE_CEILF_BUILTIN 0
> >> +#define USE_CEILL_BUILTIN 0
> >> +#define USE_CEILF128_BUILTIN 0
> >
> > Ditto.
>
> Ditto
>
> >
> >> +
> >> +#define USE_TRUNC_BUILTIN 0
> >> +#define USE_TRUNCF_BUILTIN 0
> >> +#define USE_TRUNCL_BUILTIN 0
> >> +#define USE_TRUNCF128_BUILTIN 0
> >
> > Ditto.
>
> Ditto
>
> >> +
> >> +#define USE_ROUND_BUILTIN 0
> >> +#define USE_ROUNDF_BUILTIN 0
> >> +#define USE_ROUNDL_BUILTIN 0
> >> +#define USE_ROUNDF128_BUILTIN 0
> >
> > Ditto.
>
> Ditto
>
> >> +
> >> +#define USE_COPYSIGNL_BUILTIN 1
> >> +#if __GNUC_PREREQ (7, 0)
> >> +# define USE_COPYSIGNF128_BUILTIN 1
> >> +#else
> >> +# define USE_COPYSIGNF128_BUILTIN 0
> >> +#endif
> >> +
> >
> > It should be described in commit message as well (although generated
> > instruction are essentially the same).
>
> Well this one is even more special as it was already using the same code, except
> that the math-use-builtins.h was generic vs. aarch64 specific one.
>
> Thx
> -Vineet


More information about the Libc-alpha mailing list