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

2020-06-02 Thread Joseph Myers
On Mon, 1 Jun 2020, Vineet Gupta via Libc-alpha wrote:

> 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' ?

Please see the comments in sysdeps/generic/libm-alias-float.h.  The 
arguments are *unsuffixed* names.

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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


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

2020-06-01 Thread Ramana Radhakrishnan
On Mon, Jun 1, 2020 at 10:45 PM Vineet Gupta via Libc-alpha
 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 
> >
> > LGTM, some comments below.
> >
> >> -#include 
> >> -#include 
> >> -
> >> -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 ..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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


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

2020-06-01 Thread Vineet Gupta
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 
> 
> LGTM, some comments below.
> 
>> -#include 
>> -#include 
>> -
>> -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.

>> diff --git a/sysdeps/aarch64/fpu/math-use-builtins.h 
>> b/sysdeps/aarch64/fpu/math-use-builtins.h
>> new file mode 100644
>> index ..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
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


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

2020-06-01 Thread Adhemerval Zanella



On 29/05/2020 23:00, Vineet Gupta wrote:
> Signed-off-by: Vineet Gupta 

LGTM, some comments below.

> ---
>  sysdeps/aarch64/fpu/e_sqrt.c| 27 --
>  sysdeps/aarch64/fpu/e_sqrtf.c   | 27 --
>  sysdeps/aarch64/fpu/math-use-builtins.h | 70 +
>  sysdeps/aarch64/fpu/s_fma.c | 28 --
>  sysdeps/aarch64/fpu/s_fmaf.c| 28 --
>  5 files changed, 70 insertions(+), 110 deletions(-)
>  delete mode 100644 sysdeps/aarch64/fpu/e_sqrt.c
>  delete mode 100644 sysdeps/aarch64/fpu/e_sqrtf.c
>  create mode 100644 sysdeps/aarch64/fpu/math-use-builtins.h
>  delete mode 100644 sysdeps/aarch64/fpu/s_fma.c
>  delete mode 100644 sysdeps/aarch64/fpu/s_fmaf.c
> 
> diff --git a/sysdeps/aarch64/fpu/e_sqrt.c b/sysdeps/aarch64/fpu/e_sqrt.c
> deleted file mode 100644
> index abb67ef7b061..
> --- a/sysdeps/aarch64/fpu/e_sqrt.c
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/* Square root of floating point number.
> -   Copyright (C) 2015-2020 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library; if not, see
> -   .  */
> -
> -#include 
> -#include 
> -
> -double
> -__ieee754_sqrt (double d)
> -{
> -  return __builtin_sqrt (d);
> -}
> -libm_alias_finite (__ieee754_sqrt, __sqrt)

Ok.

> diff --git a/sysdeps/aarch64/fpu/e_sqrtf.c b/sysdeps/aarch64/fpu/e_sqrtf.c
> deleted file mode 100644
> index 13008a4f45d6..
> --- a/sysdeps/aarch64/fpu/e_sqrtf.c
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/* Single-precision floating point square root.
> -   Copyright (C) 2015-2020 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library; if not, see
> -   .  */
> -
> -#include 
> -#include 
> -
> -float
> -__ieee754_sqrtf (float s)
> -{
> -  return __builtin_sqrtf (s);
> -}
> -libm_alias_finite (__ieee754_sqrtf, __sqrtf)

Ok.

> diff --git a/sysdeps/aarch64/fpu/math-use-builtins.h 
> b/sysdeps/aarch64/fpu/math-use-builtins.h
> new file mode 100644
> index ..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.

> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   .  */
> +
> +#ifndef MATH_USE_BUILTINS_H
> +#define MATH_USE_BUILTINS_H  1
> +
> +#include  /* For __GNUC_PREREQ.  */
> +
> +/* 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.

> +
> +#define