From patchwork Thu Aug 4 01:09:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 14301 Received: (qmail 42781 invoked by alias); 4 Aug 2016 01:09:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 42727 invoked by uid 89); 4 Aug 2016 01:09:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=sk:CFLAGS-, sk:CFLAGS, sk:cflags, sk:cflags- X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: David Miller , Aurelien Jarno Subject: [PATCH 3/3] sparc32/sparcv9: add a VIS3 version of fdim Date: Thu, 4 Aug 2016 03:09:00 +0200 Message-Id: <1470272940-22128-3-git-send-email-aurelien@aurel32.net> In-Reply-To: <1470272940-22128-1-git-send-email-aurelien@aurel32.net> References: <1470272940-22128-1-git-send-email-aurelien@aurel32.net> sparc32 passes floating point values in the integer registers. VIS3 instructions gives access to the movwtos instruction to directly transfer a value from an integer register to a floating point register. Therefore it makes sense to provide a VIS3 version consisting in the generic version compiled with -mvis3. Changelog: * math/s_fdim.c: Avoid alias renamed. * math/s_fdimf.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): Add s_fdimf-vis3, s_fdim-vis3. (CFLAGS-s_fdimf-vis3.c): New. Set to -Wa,-Av9d -mvis3. (CFLAGS-s_fdim-vis3.c): Likewise. sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c: New file. sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise. --- ChangeLog | 12 ++++++++ math/s_fdim.c | 4 ++- math/s_fdimf.c | 2 ++ .../sparc/sparc32/sparcv9/fpu/multiarch/Makefile | 5 +++- .../sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c | 23 ++++++++++++++++ .../sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c | 32 ++++++++++++++++++++++ .../sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.c | 23 ++++++++++++++++ .../sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c | 32 ++++++++++++++++++++++ 8 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.c create mode 100644 sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c diff --git a/ChangeLog b/ChangeLog index 1effe19..3f36ff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2016-08-04 Aurelien Jarno + * math/s_fdim.c: Avoid alias renamed. + * math/s_fdimf.c: Likewise. + * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile + [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): + Add s_fdimf-vis3, s_fdim-vis3. + (CFLAGS-s_fdimf-vis3.c): New. Set to -Wa,-Av9d -mvis3. + (CFLAGS-s_fdim-vis3.c): Likewise. + sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c: New file. + sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise. + +2016-08-04 Aurelien Jarno + * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): Remove s_fdimf-vis3, s_fdim-vis3. diff --git a/math/s_fdim.c b/math/s_fdim.c index a051ed8..1786521 100644 --- a/math/s_fdim.c +++ b/math/s_fdim.c @@ -33,8 +33,10 @@ __fdim (double x, double y) return r; } +#ifndef __fdim weak_alias (__fdim, fdim) -#ifdef NO_LONG_DOUBLE +# ifdef NO_LONG_DOUBLE strong_alias (__fdim, __fdiml) weak_alias (__fdim, fdiml) +# endif #endif diff --git a/math/s_fdimf.c b/math/s_fdimf.c index 8aed61d..e457f9d 100644 --- a/math/s_fdimf.c +++ b/math/s_fdimf.c @@ -33,4 +33,6 @@ __fdimf (float x, float y) return r; } +#ifndef __fdimf weak_alias (__fdimf, fdimf) +#endif diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile index 13d3c6d..4489b70 100644 --- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile @@ -5,7 +5,10 @@ libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \ s_rintf-vis3 s_rint-vis3 w_sqrt-vis3 w_sqrtf-vis3 \ s_fminf-vis3 s_fmin-vis3 s_fmaxf-vis3 s_fmax-vis3 \ s_fmaf-vis3 s_fma-vis3 s_nearbyint-vis3 \ - s_nearbyintf-vis3 + s_nearbyintf-vis3 s_fdimf-vis3 s_fdim-vis3 sysdep_routines += s_copysignf-vis3 s_copysign-vis3 + +CFLAGS-s_fdimf-vis3.c += -Wa,-Av9d -mvis3 +CFLAGS-s_fdim-vis3.c += -Wa,-Av9d -mvis3 endif endif diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c new file mode 100644 index 0000000..2973b49 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c @@ -0,0 +1,23 @@ +/* Compute positive difference, sparc 32-bit+v9+vis3. + Copyright (C) 2016 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 + +#define __fdim __fdim_vis3 + +#include diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c new file mode 100644 index 0000000..c9c7704 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c @@ -0,0 +1,32 @@ +/* Compute positive difference, sparc 32-bit. + Copyright (C) 2016 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 + . */ + +#ifdef HAVE_AS_VIS3_SUPPORT +# include +# include + +extern double __fdim_vis3 (double, double); +extern double __fdim_generic (double, double); + +sparc_libm_ifunc(__fdim, hwcap & HWCAP_SPARC_VIS3 ? __fdim_vis3 : __fdim_generic); +weak_alias (__fdim, fdim) + +# define __fdim __fdim_generic +#endif + +#include diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.c new file mode 100644 index 0000000..75997c6 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.c @@ -0,0 +1,23 @@ +/* Float compute positive difference, sparc 32-bit+v9+vis3. + Copyright (C) 2016 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 + +#define __fdimf __fdimf_vis3 + +#include diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c new file mode 100644 index 0000000..767520f --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c @@ -0,0 +1,32 @@ +/* Float compute positive difference, sparc 32-bit. + Copyright (C) 2016 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 + . */ + +#ifdef HAVE_AS_VIS3_SUPPORT +# include +# include + +extern float __fdimf_vis3 (float, float); +extern float __fdimf_generic (float, float); + +sparc_libm_ifunc(__fdimf, hwcap & HWCAP_SPARC_VIS3 ? __fdimf_vis3 : __fdimf_generic); +weak_alias (__fdimf, fdimf) + +# define __fdimf __fdimf_generic +#endif + +#include