about summary refs log tree commit diff
path: root/sysdeps/sparc/sparc32
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-15 02:13:54 -0700
committerDavid S. Miller <davem@davemloft.net>2012-03-15 02:13:54 -0700
commitf7062b9a6f8ccaeb080b6c819ceec59b77cce3c4 (patch)
treed72011561c032765833f16dbca7f5a67309cae03 /sysdeps/sparc/sparc32
parent559398ab746fd7dbbe09e847813a1b917b9ded14 (diff)
downloadglibc-f7062b9a6f8ccaeb080b6c819ceec59b77cce3c4.tar.gz
glibc-f7062b9a6f8ccaeb080b6c819ceec59b77cce3c4.tar.xz
glibc-f7062b9a6f8ccaeb080b6c819ceec59b77cce3c4.zip
Sparc optimized fmin{,f} and fmax{,f}.
	* sysdeps/sparc/sparc64/fpu/s_fmax.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_fmaxf.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_fmin.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_fminf.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Add new vis3
	fmin/fmax sysdep routines.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Likewise.
Diffstat (limited to 'sysdeps/sparc/sparc32')
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile3
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S30
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S46
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S28
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S46
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S30
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S46
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S28
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S46
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S40
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S40
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S40
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S40
13 files changed, 462 insertions, 1 deletions
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 3a7a389380..af62259788 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -3,7 +3,8 @@ ifeq ($(have-as-vis3),yes)
 libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_ceilf-vis3 \
 			s_ceil-vis3 s_fabs-vis3 s_fabsf-vis3 s_floor-vis3 \
 			s_floorf-vis3 s_llrintf-vis3 s_llrint-vis3 \
-			s_rintf-vis3 s_rint-vis3 w_sqrt-vis3 w_sqrtf-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
 sysdep_routines += s_copysignf-vis3 s_copysign-vis3
 endif
 endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S
new file mode 100644
index 0000000000..9fdee2c4c9
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S
@@ -0,0 +1,30 @@
+/* fmax function, sparc32 vis3 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+ENTRY (__fmax_vis3)
+	movwtos	%o0, %f0
+	movwtos	%o1, %f1
+	movwtos	%o2, %f2
+	movwtos	%o3, %f3
+	flcmpd	%fcc1, %f0, %f2
+	retl
+	 fmovdlg %fcc1, %f2, %f0
+END (__fmax_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S
new file mode 100644
index 0000000000..f604f5b533
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+	.text
+ENTRY(__fmax)
+	.type	__fmax, @gnu_indirect_function
+# ifdef SHARED
+	SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+	set	HWCAP_SPARC_VIS3, %o1
+	andcc	%o0, %o1, %g0
+	be	9f
+	 nop
+#  ifdef SHARED
+	sethi	%gdop_hix22(__fmax_vis3), %o1
+	xor	%o1, %gdop_lox10(__fmax_vis3), %o1
+#  else
+	set	__fmax_vis3, %o1
+#  endif
+	ba	10f
+	 nop
+9:
+# endif
+# ifdef SHARED
+	sethi	%gdop_hix22(__fmax_generic), %o1
+	xor	%o1, %gdop_lox10(__fmax_generic), %o1
+# else
+	set	__fmax_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+	add	%o3, %o1, %o1
+# endif
+	retl
+	 mov	%o1, %o0
+END(__fmax)
+weak_alias (__fmax, fmax)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __fmax __fmax_generic
+
+#include "../s_fmax.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S
new file mode 100644
index 0000000000..731a04aefc
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S
@@ -0,0 +1,28 @@
+/* fmaxf function, sparc32 vis3 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+ENTRY (__fmaxf_vis3)
+	movwtos	%o0, %f0
+	movwtos	%o1, %f1
+	flcmps	%fcc1, %f0, %f1
+	retl
+	 fmovslg %fcc1, %f1, %f0
+END (__fmaxf_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S
new file mode 100644
index 0000000000..c188f8e568
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+	.text
+ENTRY(__fmaxf)
+	.type	__fmaxf, @gnu_indirect_function
+# ifdef SHARED
+	SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+	set	HWCAP_SPARC_VIS3, %o1
+	andcc	%o0, %o1, %g0
+	be	9f
+	 nop
+#  ifdef SHARED
+	sethi	%gdop_hix22(__fmaxf_vis3), %o1
+	xor	%o1, %gdop_lox10(__fmaxf_vis3), %o1
+#  else
+	set	__fmaxf_vis3, %o1
+#  endif
+	ba	10f
+	 nop
+9:
+# endif
+# ifdef SHARED
+	sethi	%gdop_hix22(__fmaxf_generic), %o1
+	xor	%o1, %gdop_lox10(__fmaxf_generic), %o1
+# else
+	set	__fmaxf_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+	add	%o3, %o1, %o1
+# endif
+	retl
+	 mov	%o1, %o0
+END(__fmaxf)
+weak_alias (__fmaxf, fmaxf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __fmaxf __fmaxf_generic
+
+#include "../s_fmaxf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S
new file mode 100644
index 0000000000..54c32bd5b7
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S
@@ -0,0 +1,30 @@
+/* fmin function, sparc32 vis3 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+ENTRY (__fmin_vis3)
+	movwtos	%o0, %f0
+	movwtos	%o1, %f1
+	movwtos	%o2, %f2
+	movwtos	%o3, %f3
+	flcmpd	%fcc1, %f0, %f2
+	retl
+	 fmovdge %fcc1, %f2, %f0
+END (__fmin_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S
new file mode 100644
index 0000000000..ed7018b58b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+	.text
+ENTRY(__fmin)
+	.type	__fmin, @gnu_indirect_function
+# ifdef SHARED
+	SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+	set	HWCAP_SPARC_VIS3, %o1
+	andcc	%o0, %o1, %g0
+	be	9f
+	 nop
+#  ifdef SHARED
+	sethi	%gdop_hix22(__fmin_vis3), %o1
+	xor	%o1, %gdop_lox10(__fmin_vis3), %o1
+#  else
+	set	__fmin_vis3, %o1
+#  endif
+	ba	10f
+	 nop
+9:
+# endif
+# ifdef SHARED
+	sethi	%gdop_hix22(__fmin_generic), %o1
+	xor	%o1, %gdop_lox10(__fmin_generic), %o1
+# else
+	set	__fmin_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+	add	%o3, %o1, %o1
+# endif
+	retl
+	 mov	%o1, %o0
+END(__fmin)
+weak_alias (__fmin, fmin)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __fmin __fmin_generic
+
+#include "../s_fmin.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S
new file mode 100644
index 0000000000..a13f33238f
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S
@@ -0,0 +1,28 @@
+/* fminf function, sparc32 vis3 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+ENTRY (__fminf_vis3)
+	movwtos	%o0, %f0
+	movwtos	%o1, %f1
+	flcmps	%fcc1, %f0, %f1
+	retl
+	 fmovsge %fcc1, %f1, %f0
+END (__fminf_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S
new file mode 100644
index 0000000000..6c7a4928c1
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+	.text
+ENTRY(__fminf)
+	.type	__fminf, @gnu_indirect_function
+# ifdef SHARED
+	SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+	set	HWCAP_SPARC_VIS3, %o1
+	andcc	%o0, %o1, %g0
+	be	9f
+	 nop
+#  ifdef SHARED
+	sethi	%gdop_hix22(__fminf_vis3), %o1
+	xor	%o1, %gdop_lox10(__fminf_vis3), %o1
+#  else
+	set	__fminf_vis3, %o1
+#  endif
+	ba	10f
+	 nop
+9:
+# endif
+# ifdef SHARED
+	sethi	%gdop_hix22(__fminf_generic), %o1
+	xor	%o1, %gdop_lox10(__fminf_generic), %o1
+# else
+	set	__fminf_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+	add	%o3, %o1, %o1
+# endif
+	retl
+	 mov	%o1, %o0
+END(__fminf)
+weak_alias (__fminf, fminf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __fminf __fminf_generic
+
+#include "../s_fminf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S
new file mode 100644
index 0000000000..351eaaca69
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S
@@ -0,0 +1,40 @@
+/* fmax function, sparc32 v9 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+#define SIGN_BIT	%f12			/* -0.0 */
+
+ENTRY (__fmax)
+	std	%o0, [%sp + 72]
+	std	%o2, [%sp + 80]
+	ldd	[%sp + 72], %f0
+	ldd	[%sp + 80], %f2
+	fcmpd	%fcc1, %f2, %f2
+	fzero	SIGN_BIT
+	fmovdu	%fcc1, %f0, %f2
+	fnegd	SIGN_BIT, SIGN_BIT
+	fcmpd	%fcc2, %f0, %f2
+	fmovdul	%fcc2, %f2, %f0
+	fand	%f0, %f2, %f4
+	fandnot2 SIGN_BIT, %f4, %f4
+	retl
+	 fandnot2 %f0, %f4, %f0
+END (__fmax)
+weak_alias (__fmax, fmax)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S
new file mode 100644
index 0000000000..3018210566
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S
@@ -0,0 +1,40 @@
+/* fmaxf function, sparc32 v9 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+#define SIGN_BIT	%f12			/* -0.0 */
+
+ENTRY (__fmaxf)
+	st	%o0, [%sp + 72]
+	st	%o1, [%sp + 76]
+	ld	[%sp + 72], %f1
+	ld	[%sp + 76], %f3
+	fcmps	%fcc1, %f3, %f3
+	fzeros	SIGN_BIT
+	fmovsu	%fcc1, %f1, %f3
+	fnegs	SIGN_BIT, SIGN_BIT
+	fcmps	%fcc2, %f1, %f3
+	fmovsul	%fcc2, %f3, %f1
+	fands	%f1, %f3, %f4
+	fandnot2s SIGN_BIT, %f4, %f4
+	retl
+	 fandnot2s %f1, %f4, %f0
+END (__fmaxf)
+weak_alias (__fmaxf, fmaxf)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S
new file mode 100644
index 0000000000..059f15a612
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S
@@ -0,0 +1,40 @@
+/* fmin function, sparc32 v9 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+#define SIGN_BIT	%f12			/* -0.0 */
+
+ENTRY (__fmin)
+	std	%o0, [%sp + 72]
+	std	%o2, [%sp + 80]
+	ldd	[%sp + 72], %f0
+	ldd	[%sp + 80], %f2
+	fcmpd	%fcc1, %f2, %f2
+	fzero	SIGN_BIT
+	fmovdu	%fcc1, %f0, %f2
+	fnegd	SIGN_BIT, SIGN_BIT
+	fcmpd	%fcc2, %f0, %f2
+	fmovdug	%fcc2, %f2, %f0
+	for	%f0, %f2, %f4
+	fand	%f4, SIGN_BIT, %f4
+	retl
+	 for	%f0, %f4, %f0
+END (__fmin)
+weak_alias (__fmin, fmin)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S
new file mode 100644
index 0000000000..168020bb60
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S
@@ -0,0 +1,40 @@
+/* fminf function, sparc32 v9 version.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+   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>
+
+#define SIGN_BIT	%f12			/* -0.0 */
+
+ENTRY (__fminf)
+	st	%o0, [%sp + 72]
+	st	%o1, [%sp + 76]
+	ld	[%sp + 72], %f1
+	ld	[%sp + 76], %f3
+	fcmps	%fcc1, %f3, %f3
+	fzeros	SIGN_BIT
+	fmovsu	%fcc1, %f1, %f3
+	fnegs	SIGN_BIT, SIGN_BIT
+	fcmps	%fcc2, %f1, %f3
+	fmovsug	%fcc2, %f3, %f1
+	fors	%f1, %f3, %f4
+	fands	%f4, SIGN_BIT, %f4
+	retl
+	 fors	%f1, %f4, %f0
+END (__fminf)
+weak_alias (__fminf, fminf)