about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps52
-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
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/Makefile3
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S26
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S46
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S27
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S46
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S26
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S46
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S27
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S46
-rw-r--r--sysdeps/sparc/sparc64/fpu/s_fmax.S36
-rw-r--r--sysdeps/sparc/sparc64/fpu/s_fmaxf.S36
-rw-r--r--sysdeps/sparc/sparc64/fpu/s_fmin.S36
-rw-r--r--sysdeps/sparc/sparc64/fpu/s_fminf.S36
27 files changed, 945 insertions, 7 deletions
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 5add0b4b9e..eaa734ff2b 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -918,6 +918,42 @@ idouble: 1
 Test "Imaginary part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i":
 double: 1
 idouble: 1
+Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i) == 1.844674352395372953599975585936590505260e+19 + 2.710505511993121390769065968615872097053e-20 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 1.473094556905565378990473658199034571917e+154 + 6.101757441282702188537080005372547713595e+153 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 1.473094556905565378990473658199034571917e+154 + 6.101757441282702188537080005372547713595e+153 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 1.379778091031440685006200821918878702861e+154 + 3.257214233483129514781233066898042490248e+153 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i":
+double: 1
+idouble: 1
+Test "Real part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i":
+double: 1
+idouble: 1
+Test "Real part of: csqrt (0x1p-149 + 0x1p-149 i) == 4.112805464342778798097003462770175200803e-23 + 1.703579802732953750368659735601389709551e-23 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "Imaginary part of: csqrt (0x1p-149 + 0x1p-149 i) == 4.112805464342778798097003462770175200803e-23 + 1.703579802732953750368659735601389709551e-23 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
 
 # ctan
 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
@@ -1081,6 +1117,12 @@ float: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "hypot (0x1.234566p-126, 0x1.234566p-126) == 1.891441686191081936598531534017449451173e-38":
+double: 1
+float: 6
+idouble: 1
+Test "hypot (0x3p125, 0x4p125) == 0x5p125":
+float: 1
 Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
 double: 1
 float: 1
@@ -2101,17 +2143,17 @@ ldouble: 1
 
 Function: Real part of "csqrt":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "csqrt":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 
@@ -2205,7 +2247,7 @@ ldouble: 1
 
 Function: "hypot":
 double: 1
-float: 1
+float: 6
 idouble: 1
 ifloat: 1
 ildouble: 1
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)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 564ed26c3d..0aa40464e0 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -5,7 +5,8 @@ libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 s_ceilf-vis3 \
 			s_floorf-vis3 s_floor-vis3 m_isinff-vis3 \
 			m_isinf-vis3 m_isnanf-vis3 m_isnan-vis3 \
 			s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 \
-			s_rint-vis3
+			s_rint-vis3 s_fminf-vis3 s_fmin-vis3 \
+			s_fmaxf-vis3 s_fmax-vis3
 sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \
 		   s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
 		   s_isnanf-vis3 s_isnan-vis3
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S
new file mode 100644
index 0000000000..777bb6eee9
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S
@@ -0,0 +1,26 @@
+/* fmax function, sparc64 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)
+	flcmpd	%fcc1, %f0, %f2
+	retl
+	 fmovdlg %fcc1, %f2, %f0
+END (__fmax_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S
new file mode 100644
index 0000000000..f604f5b533
--- /dev/null
+++ b/sysdeps/sparc/sparc64/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/sparc64/fpu/multiarch/s_fmaxf-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S
new file mode 100644
index 0000000000..b3f2e85cd3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S
@@ -0,0 +1,27 @@
+/* fmaxf function, sparc64 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)
+	flcmps	%fcc1, %f1, %f3
+	fmovs	%f1, %f0
+	retl
+	 fmovslg %fcc1, %f3, %f0
+END (__fmaxf_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S
new file mode 100644
index 0000000000..c188f8e568
--- /dev/null
+++ b/sysdeps/sparc/sparc64/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/sparc64/fpu/multiarch/s_fmin-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S
new file mode 100644
index 0000000000..edb5823b41
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S
@@ -0,0 +1,26 @@
+/* fmin function, sparc64 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)
+	flcmpd	%fcc1, %f0, %f2
+	retl
+	 fmovdge %fcc1, %f2, %f0
+END (__fmin_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S
new file mode 100644
index 0000000000..ed7018b58b
--- /dev/null
+++ b/sysdeps/sparc/sparc64/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/sparc64/fpu/multiarch/s_fminf-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S
new file mode 100644
index 0000000000..81d5fb1781
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S
@@ -0,0 +1,27 @@
+/* fminf function, sparc64 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)
+	flcmps	%fcc1, %f1, %f3
+	fmovs	%f1, %f0
+	retl
+	 fmovsge %fcc1, %f3, %f0
+END (__fminf_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S
new file mode 100644
index 0000000000..6c7a4928c1
--- /dev/null
+++ b/sysdeps/sparc/sparc64/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/sparc64/fpu/s_fmax.S b/sysdeps/sparc/sparc64/fpu/s_fmax.S
new file mode 100644
index 0000000000..21a2c80958
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/s_fmax.S
@@ -0,0 +1,36 @@
+/* fmax function, sparc64 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)
+	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/sparc64/fpu/s_fmaxf.S b/sysdeps/sparc/sparc64/fpu/s_fmaxf.S
new file mode 100644
index 0000000000..989c5c300d
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/s_fmaxf.S
@@ -0,0 +1,36 @@
+/* fmaxf function, sparc64 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)
+	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/sparc64/fpu/s_fmin.S b/sysdeps/sparc/sparc64/fpu/s_fmin.S
new file mode 100644
index 0000000000..01105e6972
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/s_fmin.S
@@ -0,0 +1,36 @@
+/* fmin function, sparc64 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)
+	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/sparc64/fpu/s_fminf.S b/sysdeps/sparc/sparc64/fpu/s_fminf.S
new file mode 100644
index 0000000000..13a0ef40e1
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/s_fminf.S
@@ -0,0 +1,36 @@
+/* fminf function, sparc64 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)
+	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)