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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

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..000000000000
> --- 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#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.

> diff --git a/sysdeps/aarch64/fpu/e_sqrtf.c b/sysdeps/aarch64/fpu/e_sqrtf.c
> deleted file mode 100644
> index 13008a4f45d6..000000000000
> --- 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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <math_private.h>
> -#include <libm-alias-finite.h>
> -
> -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 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.

> +   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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef MATH_USE_BUILTINS_H
> +#define MATH_USE_BUILTINS_H	1
> +
> +#include <features.h> /* 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 USE_RINT_BUILTIN 0
> +#define USE_RINTF_BUILTIN 0
> +#define USE_RINTL_BUILTIN 0
> +#define USE_RINTF128_BUILTIN 0

Ditto.

> +
> +#define USE_FLOOR_BUILTIN 0
> +#define USE_FLOORF_BUILTIN 0
> +#define USE_FLOORL_BUILTIN 0
> +#define USE_FLOORF128_BUILTIN 0

Ditto.

> +
> +#define USE_CEIL_BUILTIN 0
> +#define USE_CEILF_BUILTIN 0
> +#define USE_CEILL_BUILTIN 0
> +#define USE_CEILF128_BUILTIN 0

Ditto.

> +
> +#define USE_TRUNC_BUILTIN 0
> +#define USE_TRUNCF_BUILTIN 0
> +#define USE_TRUNCL_BUILTIN 0
> +#define USE_TRUNCF128_BUILTIN 0

Ditto.

> +
> +#define USE_ROUND_BUILTIN 0
> +#define USE_ROUNDF_BUILTIN 0
> +#define USE_ROUNDL_BUILTIN 0
> +#define USE_ROUNDF128_BUILTIN 0

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).

> +#define USE_SQRT_BUILTIN 1
> +#define USE_SQRTF_BUILTIN 1
> +
> +#define USE_FMA_BUILTIN 1
> +#define USE_FMAF_BUILTIN 1
> +#define USE_FMAL_BUILTIN 0
> +
> +#endif /* math-use-builtins.h */

Ok.

> diff --git a/sysdeps/aarch64/fpu/s_fma.c b/sysdeps/aarch64/fpu/s_fma.c
> deleted file mode 100644
> index 48bb40482dc9..000000000000
> --- a/sysdeps/aarch64/fpu/s_fma.c
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* Copyright (C) 1996-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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <math.h>
> -#include <libm-alias-double.h>
> -
> -double
> -__fma (double x, double y, double z)
> -{
> -  return __builtin_fma (x, y, z);
> -}
> -
> -libm_alias_double (__fma, fma)

Ok.

> diff --git a/sysdeps/aarch64/fpu/s_fmaf.c b/sysdeps/aarch64/fpu/s_fmaf.c
> deleted file mode 100644
> index 544f32e27aec..000000000000
> --- a/sysdeps/aarch64/fpu/s_fmaf.c
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* Copyright (C) 2011-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
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <math.h>
> -#include <libm-alias-float.h>
> -
> -float
> -__fmaf (float x, float y, float z)
> -{
> -  return __builtin_fmaf (x, y, z);
> -}
> -
> -libm_alias_float (__fma, fma)
> 

Ok.

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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux