about summary refs log tree commit diff
path: root/sysdeps/sparc/sparc32
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-08-21 17:46:34 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-08-21 17:46:34 +0000
commit831bbd55271eacc0190a13954bd347f0a521b096 (patch)
treea46d925f2fca35cd930d73c6d0890ee005ba17fb /sysdeps/sparc/sparc32
parent813378e9fe17e029caf627cab76fe23eb46815fa (diff)
downloadglibc-831bbd55271eacc0190a13954bd347f0a521b096.tar.gz
glibc-831bbd55271eacc0190a13954bd347f0a521b096.tar.xz
glibc-831bbd55271eacc0190a13954bd347f0a521b096.zip
Remove SPARC sqrt wrappers (bug 21973).
This patch removes the SPARC-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those).  This disappeared,
probably with:

commit 8847f0377003fbfe9cbe951ce9f8717d74f26247
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there.  This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

	[BZ #21973]
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
	GLIBC_2.0 sqrtl symbol.
Diffstat (limited to 'sysdeps/sparc/sparc32')
-rw-r--r--sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S54
-rw-r--r--sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S52
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S50
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S12
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S48
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S12
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S52
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S51
9 files changed, 0 insertions, 332 deletions
diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S b/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S
deleted file mode 100644
index cca76541e4..0000000000
--- a/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/* sqrt function.  sparc32 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrt)
-	clr	%g1
-	std	%g0, [%sp + 72]
-	std	%o0, [%sp + 80]
-	ldd	[%sp + 72], %f8
-	ldd	[%sp + 80], %f0
-	fcmpd	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrtd	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o2
-	mov	%o1, %o3
-	mov	26, %o4
-	mov	%o7, %g1
-	call	__kernel_standard
-	 mov	%g1, %o7
-END (__sqrt)
-
-weak_alias (__sqrt, sqrt)
diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S b/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S
deleted file mode 100644
index 34f6113a0b..0000000000
--- a/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/* sqrtf function.  sparc32 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrtf)
-	st	%g0, [%sp + 68]
-	st	%o0, [%sp + 72]
-	ld	[%sp + 68], %f8
-	ld	[%sp + 72], %f0
-	fcmps	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrts	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o1
-	mov	126, %o2
-	mov	%o7, %g1
-	call	__kernel_standard_f
-	 mov	%g1, %o7
-END (__sqrtf)
-
-weak_alias (__sqrtf, sqrtf)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 322e300097..2a2d3745ed 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -3,7 +3,6 @@ ifeq ($(have-as-vis3),yes)
 libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \
 			s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
 			s_rintf-vis3 s_rint-vis3 \
-			w_sqrt_compat-vis3 w_sqrtf_compat-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_nearbyint-vis3 \
 			s_nearbyintf-vis3 s_fdimf-vis3 s_fdim-vis3
 sysdep_routines += s_copysignf-vis3 s_copysign-vis3
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S
deleted file mode 100644
index a3a642fba6..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/* sqrt function.  sparc32 v9 vis3 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrt_vis3)
-	movwtos	%o0, %f0
-	fzero	%f8
-	movwtos	%o1, %f1
-	fcmpd	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrtd	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o2
-	mov	%o1, %o3
-	mov	26, %o4
-	mov	%o7, %g1
-	call	__kernel_standard
-	 mov	%g1, %o7
-END (__sqrt_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S
deleted file mode 100644
index 1ccac19e29..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(sqrt)
-
-weak_alias (__sqrt, sqrt)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __sqrt __sqrt_generic
-
-#include "../w_sqrt_compat.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S
deleted file mode 100644
index 8cd160765a..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* sqrtf function.  sparc32 v9 vis3 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrtf_vis3)
-	movwtos	%o0, %f0
-	fzeros	%f8
-	fcmps	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrts	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o1
-	mov	126, %o2
-	mov	%o7, %g1
-	call	__kernel_standard_f
-	 mov	%g1, %o7
-END (__sqrtf_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S
deleted file mode 100644
index f0e759a2c8..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(sqrtf)
-
-weak_alias (__sqrtf, sqrtf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __sqrtf __sqrtf_generic
-
-#include "../w_sqrtf_compat.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S
deleted file mode 100644
index f3003da14f..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/* sqrt function.  sparc32 v9 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrt)
-	std	%o0, [%sp + 80]
-	fzero	%f8
-	ldd	[%sp + 80], %f0
-	fcmpd	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrtd	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o2
-	mov	%o1, %o3
-	mov	26, %o4
-	mov	%o7, %g1
-	call	__kernel_standard
-	 mov	%g1, %o7
-END (__sqrt)
-
-weak_alias (__sqrt, sqrt)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S
deleted file mode 100644
index 7a102de3dd..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/* sqrtf function.  sparc32 v9 version.
-   Copyright (C) 2012-2017 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math-svid-compat.h>
-
-ENTRY (__sqrtf)
-	st	%o0, [%sp + 72]
-	fzeros	%f8
-	ld	[%sp + 72], %f0
-	fcmps	%f0, %f8
-	fbl	1f
-	 nop
-8:	retl
-	 fsqrts	%f0, %f0
-1:
-#ifdef SHARED
-	SETUP_PIC_REG_LEAF(o5, g1)
-	sethi	%gdop_hix22(_LIB_VERSION), %g1
-	xor	%g1, %gdop_lox10(_LIB_VERSION), %g1
-	ld	[%o5 + %g1], %g1, %gdop(_LIB_VERSION)
-#else
-	sethi	%hi(_LIB_VERSION), %g1
-	or	%g1, %lo(_LIB_VERSION), %g1
-#endif
-	ld	[%g1], %g1
-	cmp	%g1, -1
-	be	8b
-	 mov	%o0, %o1
-	mov	126, %o2
-	mov	%o7, %g1
-	call	__kernel_standard_f
-	 mov	%g1, %o7
-END (__sqrtf)
-
-weak_alias (__sqrtf, sqrtf)