From patchwork Mon Dec 8 18:32:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Senkevich X-Patchwork-Id: 4114 Received: (qmail 18118 invoked by alias); 8 Dec 2014 18:33:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 18108 invoked by uid 89); 8 Dec 2014 18:33:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f53.google.com X-Received: by 10.112.198.1 with SMTP id iy1mr17720289lbc.13.1418063591156; Mon, 08 Dec 2014 10:33:11 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Andrew Senkevich Date: Mon, 8 Dec 2014 22:32:40 +0400 Message-ID: Subject: Re: [PATCH 5/N v2] [x86_64] Vectorized math functions To: Joseph Myers Cc: libc-alpha 2014-12-03 21:06 GMT+03:00 Joseph Myers : > I don't have any comments on the content of this patch beyond that it > should be combined with patch 6 so that a single patch enables both build > and install of this library. Here is updated patch 5/N. * Makeconfig (rpath-dirs, all-subdirs): Added mathvec folder. (libmvec): New variable. * configure.ac: Added option for mathvec build. * configure: Regenerated. * mathvec/Depend: New file. * mathvec/Makefile: New file. * shlib-versions: Added libmvec. * math/Makefile: Added rule for libm.so installation. --- WBR, Andrew diff --git a/Makeconfig b/Makeconfig index bbf5460..57d2ad8 100644 --- a/Makeconfig +++ b/Makeconfig @@ -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 @@ -1048,8 +1048,10 @@ endif ifeq ($(build-shared),yes) libm = $(common-objpfx)math/libm.so$(libm.so-version) +libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version) else libm = $(common-objpfx)math/libm.a +libmvec = $(common-objpfx)mathvec/libmvec.a endif # These are the subdirectories containing the library source. The order @@ -1059,7 +1061,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 diff --git a/configure b/configure index 0cb54ec..a3ea531 100755 --- a/configure +++ b/configure @@ -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" + diff --git a/configure.ac b/configure.ac index b2c4b1f..f6805aa 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/math/Makefile b/math/Makefile index 4a06c74..e6285e9 100644 --- a/math/Makefile +++ b/math/Makefile @@ -86,6 +86,22 @@ generated += $(foreach s,.c .S l.c l.S f.c f.S,$(calls:s_%=m_%$s)) routines = $(calls) $(calls:=f) $(long-c-$(long-double-fcts)) long-c-yes = $(calls:=l) +ifeq ($(build-mathvec),yes) +# We need to install libm.so as linker script +# for more comfortable use of vector math library. +install-lib-ldscripts := libm.so +install_subdir: $(inst_libdir)/libm.so +$(inst_libdir)/libm.so: $(common-objpfx)format.lds \ + $(libm) \ + $(libmvec) \ + $(+force) + (echo '/* GNU ld script'; echo '*/';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libm.so$(libm.so-version) ' \ + 'AS_NEEDED ( $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \ + ) > $@ +endif + # Rules for the test suite. tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ test-misc test-fpucw test-fpucw-ieee tst-definitions test-tgmath \ diff --git a/mathvec/Depend b/mathvec/Depend new file mode 100644 index 0000000..ede10ab --- /dev/null +++ b/mathvec/Depend @@ -0,0 +1 @@ +math diff --git a/mathvec/Makefile b/mathvec/Makefile new file mode 100644 index 0000000..3b670e9 --- /dev/null +++ b/mathvec/Makefile @@ -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 +# . + +# 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 diff --git a/shlib-versions b/shlib-versions index e05b248..fa3cf1d 100644 --- a/shlib-versions +++ b/shlib-versions @@ -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