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.
This commit is contained in:
David S. Miller 2012-03-14 16:29:47 -07:00
parent 7bd951ff59
commit eae47a3618
19 changed files with 521 additions and 0 deletions

View File

@ -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.

View 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

View 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@

2
configure vendored
View File

@ -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

View 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)

124
sysdeps/sparc/configure vendored Normal file
View File

@ -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

View File

@ -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

View 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

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View 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

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"