summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-14 16:29:47 -0700
committerDavid S. Miller <davem@davemloft.net>2012-03-14 16:43:09 -0700
commiteae47a361821b60ad4274feae1d6e3fa4572cd0a (patch)
tree00abf7a0cd073fc519d074d18f1163a8f47ee0c2
parent7bd951ff59e0443ca1bdd5b0ea58f6f4f641ac73 (diff)
Add framework for using sparc VIS3 instructions, use it for copysign/signbit.
* sysdeps/sparc/configure.in: New file. * sysdeps/sparc/configure: Generate. * configure.in (libc_cv_sparc_as_vis3): Substitute. * configure: Regenerate. * config.h.in (HAVE_AS_VIS3_SUPPORT): New. * config.make.in (have-as-vis3): New. * sysdeps/sparc/sparc32/sparcv9/Makefile (ASFLAGS-*): If VIS3 is available use -Av9d instead of -Av9a. * sysdeps/sparc/sparc64/Makefile: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: New file.
-rw-r--r--ChangeLog20
-rw-r--r--config.h.in3
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure2
-rw-r--r--configure.in1
-rw-r--r--sysdeps/sparc/configure124
-rw-r--r--sysdeps/sparc/configure.in30
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/Makefile9
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile9
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S30
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S46
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S29
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S46
-rw-r--r--sysdeps/sparc/sparc64/Makefile9
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/Makefile9
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S25
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S57
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S25
-rw-r--r--sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S46
19 files changed, 521 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4983816df3..b36ecb9287 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2012-03-14 David S. Miller <davem@davemloft.net>
+ * sysdeps/sparc/configure.in: New file.
+ * sysdeps/sparc/configure: Generate.
+ * configure.in (libc_cv_sparc_as_vis3): Substitute.
+ * configure: Regenerate.
+ * config.h.in (HAVE_AS_VIS3_SUPPORT): New.
+ * config.make.in (have-as-vis3): New.
+ * sysdeps/sparc/sparc32/sparcv9/Makefile (ASFLAGS-*): If VIS3 is
+ available use -Av9d instead of -Av9a.
+ * sysdeps/sparc/sparc64/Makefile: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: New file.
+
* sysdeps/sparc/sparc64/fpu/s_copysign.S (__copysign): Use fzeros/fnegs
to load 0x80000000 into a float register instead of using the stack.
* sysdeps/sparc/sparc64/fpu/s_copysignf.S (__copysignf): Likewise.
diff --git a/config.h.in b/config.h.in
index 7e5f4d4635..3b938f8013 100644
--- a/config.h.in
+++ b/config.h.in
@@ -90,6 +90,9 @@
/* Defined on SPARC if GCC emits GOTDATA relocations. */
#undef HAVE_GCC_GOTDATA
+/* Define on SPARC if AS supports VIS3 instructions. */
+#undef HAVE_AS_VIS3_SUPPORT
+
/* Define if the linker supports the -z combreloc option. */
#undef HAVE_Z_COMBRELOC
diff --git a/config.make.in b/config.make.in
index 46a14b4f29..2b9a939e9b 100644
--- a/config.make.in
+++ b/config.make.in
@@ -58,6 +58,7 @@ enable-check-abi = @enable_check_abi@
have-forced-unwind = @libc_cv_forced_unwind@
have-fpie = @libc_cv_fpie@
have-mfma4 = @libc_cv_cc_fma4@
+have-as-vis3 = @libc_cv_sparc_as_vis3@
gnu89-inline-CFLAGS = @gnu89_inline@
have-ssp = @libc_cv_ssp@
have-selinux = @have_selinux@
diff --git a/configure b/configure
index f415389a34..94b15bbe8f 100755
--- a/configure
+++ b/configure
@@ -616,6 +616,7 @@ shared
static
ldd_rewrite_script
use_ldconfig
+libc_cv_sparc_as_vis3
libc_cv_as_i686
libc_cv_cc_fma4
libc_cv_cc_novzeroupper
@@ -7647,6 +7648,7 @@ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIC is default" >&5
$as_echo_n "checking whether -fPIC is default... " >&6; }
if ${libc_cv_pic_default+:} false; then :
diff --git a/configure.in b/configure.in
index ee9e3d8eb4..119d5be944 100644
--- a/configure.in
+++ b/configure.in
@@ -2151,6 +2151,7 @@ AC_SUBST(libc_cv_cc_sse2avx)
AC_SUBST(libc_cv_cc_novzeroupper)
AC_SUBST(libc_cv_cc_fma4)
AC_SUBST(libc_cv_as_i686)
+AC_SUBST(libc_cv_sparc_as_vis3)
AC_SUBST(use_ldconfig)
AC_SUBST(ldd_rewrite_script)
diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure
new file mode 100644
index 0000000000..9ce761b3b8
--- /dev/null
+++ b/sysdeps/sparc/configure
@@ -0,0 +1,124 @@
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/sparc.
+
+# Check for support of VIS3 et al. instructions in the assembler.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc assembler VIS3 support" >&5
+$as_echo_n "checking for sparc assembler VIS3 support... " >&6; }
+if ${libc_cv_sparc_as_vis3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat > conftest.S <<\EOF
+ .text
+foo: fmadds %f1, %f2, %f3, %f5
+ fmaddd %f2, %f4, %f8, %f10
+ fhadds %f2, %f3, %f5
+ fhaddd %f4, %f8, %f10
+ pdistn %f2, %f4, %g1
+ movdtox %f10, %o0
+ movstouw %f9, %o1
+ movstosw %f7, %o2
+ movxtod %o3, %f18
+ movwtos %o4, %f15
+ flcmps %fcc0, %f3, %f5
+ flcmpd %fcc1, %f4, %f6
+EOF
+if { ac_try='${CC-cc} -c $CFLAGS -Wa,-Av9d conftest.S'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ libc_cv_sparc_as_vis3=yes
+else
+ libc_cv_sparc_as_vis3=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_as_vis3" >&5
+$as_echo "$libc_cv_sparc_as_vis3" >&6; }
+if test $libc_cv_sparc_as_vis3 = yes; then
+ $as_echo "#define HAVE_AS_VIS3_SUPPORT 1" >>confdefs.h
+
+fi
diff --git a/sysdeps/sparc/configure.in b/sysdeps/sparc/configure.in
new file mode 100644
index 0000000000..b80d9cbf59
--- /dev/null
+++ b/sysdeps/sparc/configure.in
@@ -0,0 +1,30 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/sparc.
+
+# Check for support of VIS3 et al. instructions in the assembler.
+AC_CACHE_CHECK(for sparc assembler VIS3 support, libc_cv_sparc_as_vis3, [dnl
+cat > conftest.S <<\EOF
+ .text
+foo: fmadds %f1, %f2, %f3, %f5
+ fmaddd %f2, %f4, %f8, %f10
+ fhadds %f2, %f3, %f5
+ fhaddd %f4, %f8, %f10
+ pdistn %f2, %f4, %g1
+ movdtox %f10, %o0
+ movstouw %f9, %o1
+ movstosw %f7, %o2
+ movxtod %o3, %f18
+ movwtos %o4, %f15
+ flcmps %fcc0, %f3, %f5
+ flcmpd %fcc1, %f4, %f6
+EOF
+dnl
+if AC_TRY_COMMAND([${CC-cc} -c $CFLAGS -Wa,-Av9d conftest.S]); then
+ libc_cv_sparc_as_vis3=yes
+else
+ libc_cv_sparc_as_vis3=no
+fi
+rm -f conftest*])
+if test $libc_cv_sparc_as_vis3 = yes; then
+ AC_DEFINE(HAVE_AS_VIS3_SUPPORT)
+fi
diff --git a/sysdeps/sparc/sparc32/sparcv9/Makefile b/sysdeps/sparc/sparc32/sparcv9/Makefile
index 58f5759b3f..8a9330f7a6 100644
--- a/sysdeps/sparc/sparc32/sparcv9/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/Makefile
@@ -5,9 +5,18 @@ sysdep_routines += hp-timing
elide-routines.os += hp-timing
endif
+ifeq ($(have-as-vis3),yes)
+ASFLAGS-.o += -Wa,-Av9d
+ASFLAGS-.os += -Wa,-Av9d
+ASFLAGS-.op += -Wa,-Av9d
+ASFLAGS-.og += -Wa,-Av9d
+ASFLAGS-.ob += -Wa,-Av9d
+ASFLAGS-.oS += -Wa,-Av9d
+else
ASFLAGS-.o += -Wa,-Av9a
ASFLAGS-.os += -Wa,-Av9a
ASFLAGS-.op += -Wa,-Av9a
ASFLAGS-.og += -Wa,-Av9a
ASFLAGS-.ob += -Wa,-Av9a
ASFLAGS-.oS += -Wa,-Av9a
+endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
new file mode 100644
index 0000000000..33b03ac6aa
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -0,0 +1,9 @@
+ifeq ($(subdir),math)
+ifeq ($(have-as-vis3),yes)
+libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3
+sysdep_routines += s_copysignf-vis3 s_copysign-vis3
+
+CFLAGS-s_copysignf-vis3.S = -Wa,-Av9d
+CFLAGS-s_copysign-vis3.S = -Wa,-Av9d
+endif
+endif \ No newline at end of file
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S
new file mode 100644
index 0000000000..db27bb7f52
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S
@@ -0,0 +1,30 @@
+/* copysign 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 (__copysign_vis3)
+ sethi %hi(0x80000000), %g1
+ and %o2, %g1, %o4
+ andn %o0, %g1, %o0
+ or %o0, %o4, %o0
+ movwtos %o0, %f0
+ retl
+ movwtos %o1, %f1
+END (__copysign_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
new file mode 100644
index 0000000000..7179058f06
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__copysign)
+ .type __copysign, @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(__copysign_vis3), %o1
+ xor %o1, %gdop_lox10(__copysign_vis3), %o1
+# else
+ set __copysign_vis3, %o1
+# endif
+ ba 10f
+ nop
+9:
+# endif
+# ifdef SHARED
+ sethi %gdop_hix22(__copysign_generic), %o1
+ xor %o1, %gdop_lox10(__copysign_generic), %o1
+# else
+ set __copysign_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__copysign)
+weak_alias (__copysign, copysign)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __copysign __copysign_generic
+
+#include "../../../fpu/s_copysign.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S
new file mode 100644
index 0000000000..7cdc540842
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S
@@ -0,0 +1,29 @@
+/* float copysign 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 (__copysignf_vis3)
+ sethi %hi(0x80000000), %g1
+ and %o1, %g1, %o4
+ andn %o0, %g1, %o0
+ or %o0, %o4, %o0
+ retl
+ movwtos %o0, %f0
+END (__copysignf_vis3)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
new file mode 100644
index 0000000000..4d055f2df5
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__copysignf)
+ .type __copysignf, @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(__copysignf_vis3), %o1
+ xor %o1, %gdop_lox10(__copysignf_vis3), %o1
+# else
+ set __copysignf_vis3, %o1
+# endif
+ ba 10f
+ nop
+9:
+# endif
+# ifdef SHARED
+ sethi %gdop_hix22(__copysignf_generic), %o1
+ xor %o1, %gdop_lox10(__copysignf_generic), %o1
+# else
+ set __copysignf_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__copysignf)
+weak_alias (__copysignf, copysignf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __copysignf __copysignf_generic
+
+#include "../../../fpu/s_copysignf.S"
diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile
index fb8b011d53..2b7b83035a 100644
--- a/sysdeps/sparc/sparc64/Makefile
+++ b/sysdeps/sparc/sparc64/Makefile
@@ -6,3 +6,12 @@ endif
ifeq ($(subdir),string)
sysdep_routines += align-cpy
endif
+
+ifeq ($(have-as-vis3),yes)
+ASFLAGS-.o += -Wa,-Av9d
+ASFLAGS-.os += -Wa,-Av9d
+ASFLAGS-.op += -Wa,-Av9d
+ASFLAGS-.og += -Wa,-Av9d
+ASFLAGS-.ob += -Wa,-Av9d
+ASFLAGS-.oS += -Wa,-Av9d
+endif
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
new file mode 100644
index 0000000000..b03884de0d
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -0,0 +1,9 @@
+ifeq ($(subdir),math)
+ifeq ($(have-as-vis3),yes)
+libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3
+sysdep_routines += s_signbitf-vis3 s_signbit-vis3
+
+CFLAGS-s_signbitf-vis3.S = -Wa,-Av9d
+CFLAGS-s_signbit-vis3.S = -Wa,-Av9d
+endif
+endif \ No newline at end of file
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S
new file mode 100644
index 0000000000..8d54e32ac4
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S
@@ -0,0 +1,25 @@
+/* signbit(). sparc64 vis3 version.
+ Copyright (C) 2012 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>
+
+ENTRY (__signbit_vis3)
+ movdtox %f0, %o0
+ retl
+ srlx %o0, 63, %o0
+END (__signbit_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S
new file mode 100644
index 0000000000..a8e9728935
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S
@@ -0,0 +1,57 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__signbit)
+ .type __signbit, @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(__signbit_vis3), %o1
+ xor %o1, %gdop_lox10(__signbit_vis3), %o1
+# else
+ set __signbit_vis3, %o1
+# endif
+ ba 10f
+ nop
+9:
+# endif
+# ifdef SHARED
+ sethi %gdop_hix22(__signbit_generic), %o1
+ xor %o1, %gdop_lox10(__signbit_generic), %o1
+# else
+ set __signbit_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__signbit)
+weak_alias (__signbit, signbit)
+
+/* On 64-bit the double version will also always work for
+ long-double-precision since in both cases the word with the
+ sign bit in it is passed always in register %f0. */
+strong_alias (__signbit, __signbitl)
+hidden_def (__signbitl)
+weak_alias (__signbitl, signbitl)
+
+# undef weak_alias
+# define weak_alias(a, b)
+# undef strong_alias
+# define strong_alias(a, b)
+# undef hidden_def
+# define hidden_def(a)
+
+#define __signbit __signbit_generic
+
+#include "../s_signbit.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S
new file mode 100644
index 0000000000..004b0870d6
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S
@@ -0,0 +1,25 @@
+/* signbitf(). sparc64 vis3 version.
+ Copyright (C) 2012 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>
+
+ENTRY (__signbitf_vis3)
+ movstouw %f1, %o0
+ retl
+ srl %o0, 31, %o0
+END (__signbitf_vis3)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S
new file mode 100644
index 0000000000..721bc7fe4a
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S
@@ -0,0 +1,46 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__signbitf)
+ .type __signbitf, @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(__signbitf_vis3), %o1
+ xor %o1, %gdop_lox10(__signbitf_vis3), %o1
+# else
+ set __signbitf_vis3, %o1
+# endif
+ ba 10f
+ nop
+9:
+# endif
+# ifdef SHARED
+ sethi %gdop_hix22(__signbitf_generic), %o1
+ xor %o1, %gdop_lox10(__signbitf_generic), %o1
+# else
+ set __signbitf_generic, %o1
+# endif
+# ifdef HAVE_AS_VIS3_SUPPORT
+10:
+# endif
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__signbitf)
+weak_alias (__signbitf, signbitf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __signbitf __signbitf_generic
+
+#include "../s_signbitf.S"