[5/N,x86_64] Vectorized math functions
Commit Message
This is addition of new vector math library libmvec.so to Glibc build,
install and ABI testing.
Vector math library libmvec.so enabled by default for x86_64.
ChangeLog
2014-11-21 Andrew Senkevich <andrew.n.senkevich@gmail.com>
* configure.ac: Enable/disable build of vector math library.
* configure: Regenerated.
* sysdeps/x86_64/configure.ac: Build vector math library by default.
* sysdeps/x86_64/configure: Regenerated.
* Makeconfig (rpath-dirs): Added mathvec folder.
* mathvec/Makefile: New file.
* mathvec/Depend: New file.
* sysdeps/x86_64/fpu/Makefile: New file.
* sysdeps/x86_64/fpu/Versions:
* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New file.
* shlib-versions: Added vector math library.
Attached copy.
--
WBR,
Andrew
Comments
On Fri, 21 Nov 2014, Andrew Senkevich wrote:
> This is addition of new vector math library libmvec.so to Glibc build,
> install and ABI testing.
> Vector math library libmvec.so enabled by default for x86_64.
On the whole I think it would be best to separate the
architecture-independent support for a new library, from the
architecture-specific code to enable it.
> +# Rules for the test suite are in math directory
'.' at end of comment.
> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
> index c9f9a51..349d6ca 100644
> --- a/sysdeps/x86_64/configure.ac
> +++ b/sysdeps/x86_64/configure.ac
> @@ -99,6 +99,11 @@ if test $libc_cv_cc_avx2 = yes; then
> fi
> LIBC_CONFIG_VAR([config-cflags-avx2], [$libc_cv_cc_avx2])
>
> +dnl Set build_mathvec
> +if test x"$build_mathvec" = xnotset; then
> +build_mathvec=yes
There's no point in the comment here that just repeats the plain meaning
of the code.
@@ -476,7 +476,7 @@ link-libc = $(link-libc-rpath-link)
$(link-libc-before-gnulib) $(gnulib)
link-libc-tests = $(link-libc-tests-rpath-link) \
$(link-libc-before-gnulib) $(gnulib-tests)
# This is how to find at build-time things that will be installed there.
-rpath-dirs = math elf dlfcn nss nis rt resolv crypt
+rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec
rpath-link = \
$(common-objdir):$(subst $(empty) ,:,$(patsubst
../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
else
@@ -1059,7 +1059,7 @@ all-subdirs = csu assert ctype locale intl
catgets math setjmp signal \
stdlib stdio-common libio malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
- crypt localedata timezone rt conform debug \
+ crypt localedata timezone rt conform debug mathvec \
$(add-on-subdirs) dlfcn elf
ifndef avoid-generated
@@ -774,6 +774,7 @@ enable_systemtap
enable_build_nscd
enable_nscd
enable_pt_chown
+enable_mathvec
with_cpu
'
ac_precious_vars='build_alias
@@ -1437,6 +1438,8 @@ Optional Features:
--disable-build-nscd disable building and installing the nscd daemon
--disable-nscd library functions will not contact the nscd daemon
--enable-pt_chown Enable building and installing pt_chown
+ --enable-mathvec Enable building and installing mathvec [default
+ depends on architecture]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -3730,6 +3733,14 @@ if test "$build_pt_chown" = yes; then
fi
+# Check whether --enable-mathvec was given.
+if test "${enable_mathvec+set}" = set; then :
+ enableval=$enable_mathvec; build_mathvec=$enableval
+else
+ build_mathvec=notset
+fi
+
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
@@ -7039,6 +7050,12 @@ $as_echo "running configure fragment for $dir" >&6; }
fi
done
+if test x"$build_mathvec" = xnotset; then
+ build_mathvec=no
+fi
+config_vars="$config_vars
+build-mathvec = $build_mathvec"
+
@@ -353,6 +353,12 @@ if test "$build_pt_chown" = yes; then
AC_DEFINE(HAVE_PT_CHOWN)
fi
+AC_ARG_ENABLE([mathvec],
+ [AS_HELP_STRING([--enable-mathvec],
+ [Enable building and installing mathvec @<:@default depends on
architecture@:>@])],
+ [build_mathvec=$enableval],
+ [build_mathvec=notset])
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
@@ -1939,6 +1945,11 @@ for dir in $sysnames; do
fi
done
+if test x"$build_mathvec" = xnotset; then
+ build_mathvec=no
+fi
+LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
+
AC_SUBST(libc_extra_cflags)
AC_SUBST(libc_extra_cppflags)
new file mode 100644
@@ -0,0 +1 @@
+math
new file mode 100644
@@ -0,0 +1,35 @@
+# Copyright (C) 2014 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/>.
+
+# Makefile for the vector math library.
+
+subdir := mathvec
+
+include ../Makeconfig
+
+ifeq ($(build-mathvec),yes)
+extra-libs := libmvec
+extra-libs-others = $(extra-libs)
+
+libmvec-routines = $(strip $(libmvec-support))
+
+$(objpfx)libmvec.so: $(libm)
+endif
+
+# Rules for the test suite are in math directory
+
+include ../Rules
@@ -71,3 +71,6 @@ libanl=1
# This defines the libgcc soname version this glibc is to load for
# asynchronous cancellation to work correctly.
libgcc_s=1
+
+# The vector math library
+libmvec=1
b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
new file mode 100644
@@ -0,0 +1,5 @@
+GLIBC_2.21
+ GLIBC_2.21 A
+ _ZGVbN2v_cos F
+ _ZGVcN4v_cos F
+ _ZGVdN4v_cos F
@@ -275,6 +275,10 @@ fi
config_vars="$config_vars
config-cflags-avx2 = $libc_cv_cc_avx2"
+if test x"$build_mathvec" = xnotset; then
+build_mathvec=yes
+fi
+
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
# work around problem with autoconf and empty lines at the end of files
@@ -99,6 +99,11 @@ if test $libc_cv_cc_avx2 = yes; then
fi
LIBC_CONFIG_VAR([config-cflags-avx2], [$libc_cv_cc_avx2])
+dnl Set build_mathvec
+if test x"$build_mathvec" = xnotset; then
+build_mathvec=yes
+fi
+
dnl It is always possible to access static and hidden symbols in an
dnl position independent way.
AC_DEFINE(PI_STATIC_AND_HIDDEN)
new file mode 100644
@@ -0,0 +1,4 @@
+ifeq ($(subdir),mathvec)
+libmvec-support += svml_d_cos2_core svml_d_cos4_core_avx \
+ svml_d_cos4_core_avx2 svml_d_cos_data
+endif
new file mode 100644
@@ -0,0 +1,7 @@
+libmvec {
+ GLIBC_2.21 {
+ _ZGVbN2v_cos;
+ _ZGVcN4v_cos;
+ _ZGVdN4v_cos;
+ }
+}