]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add framework for using sparc VIS3 instructions, use it for copysign/signbit.
authorDavid S. Miller <davem@davemloft.net>
Wed, 14 Mar 2012 23:29:47 +0000 (16:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Mar 2012 23:43:09 +0000 (16:43 -0700)
* 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.

19 files changed:
ChangeLog
config.h.in
config.make.in
configure
configure.in
sysdeps/sparc/configure [new file with mode: 0644]
sysdeps/sparc/configure.in [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/Makefile
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-vis3.S [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-vis3.S [new file with mode: 0644]
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S [new file with mode: 0644]
sysdeps/sparc/sparc64/Makefile
sysdeps/sparc/sparc64/fpu/multiarch/Makefile [new file with mode: 0644]
sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-vis3.S [new file with mode: 0644]
sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S [new file with mode: 0644]
sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-vis3.S [new file with mode: 0644]
sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S [new file with mode: 0644]

index 4983816df30383777916c9815cb27a32646dc842..b36ecb9287fcb25cdfc8e830c22e613391f61a22 100644 (file)
--- 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.
index 7e5f4d4635ad3a766cfd90160262d650de2d89b8..3b938f8013a8885ca3e8ce0ceb7e819cb67dc5be 100644 (file)
@@ -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
 
index 46a14b4f29850ef4aa418215adef9b61455170c0..2b9a939e9bca010fbc6e6e3884c8536c460bd76e 100644 (file)
@@ -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@
index f415389a34e49483d81833a00d947c635493df6f..94b15bbe8fe4a0704351289d75c8c07a580eb6df 100755 (executable)
--- 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
@@ -7645,6 +7646,7 @@ fi
 
 
 
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIC is default" >&5
index ee9e3d8eb449fb22026ede3b42fdb540c2c5c9d9..119d5be94407b5a921c25b237fa165191dfd4f2a 100644 (file)
@@ -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 (file)
index 0000000..9ce761b
--- /dev/null
@@ -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 (file)
index 0000000..b80d9cb
--- /dev/null
@@ -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
index 58f5759b3f55be0866ed3b324904d8e630baf1b2..8a9330f7a63b170c04357cfd0b2a9a3ce1028f2e 100644 (file)
@@ -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 (file)
index 0000000..33b03ac
--- /dev/null
@@ -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 (file)
index 0000000..db27bb7
--- /dev/null
@@ -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 (file)
index 0000000..7179058
--- /dev/null
@@ -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 (file)
index 0000000..7cdc540
--- /dev/null
@@ -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 (file)
index 0000000..4d055f2
--- /dev/null
@@ -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"
index fb8b011d531ef5615339bd3233c0b436a97824ac..2b7b83035a1055e568eb276d4b0fa9e4c8849d41 100644 (file)
@@ -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 (file)
index 0000000..b03884d
--- /dev/null
@@ -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 (file)
index 0000000..8d54e32
--- /dev/null
@@ -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 (file)
index 0000000..a8e9728
--- /dev/null
@@ -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 (file)
index 0000000..004b087
--- /dev/null
@@ -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 (file)
index 0000000..721bc7f
--- /dev/null
@@ -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"