diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-10-02 16:48:34 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-10-11 06:01:01 -0700 |
commit | 69bf858f681588d57c1b5d9d62a7951cda1549f6 (patch) | |
tree | cd01f81bc73ecc540f144472b5fe42c1dbf24e12 | |
parent | 54a417345edca0015e70e8b360b7f83ade5a7507 (diff) | |
download | glibc-hjl/avx128.tar.gz glibc-hjl/avx128.tar.xz glibc-hjl/avx128.zip |
Compile AVX libm functions with -mavx -mprefer-avx128 hjl/avx128
-rw-r--r-- | ChangeLog.avx128 | 20 | ||||
-rw-r--r-- | config.make.in | 1 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | sysdeps/i386/configure | 20 | ||||
-rw-r--r-- | sysdeps/i386/configure.in | 7 | ||||
-rw-r--r-- | sysdeps/x86_64/configure | 20 | ||||
-rw-r--r-- | sysdeps/x86_64/configure.in | 7 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/multiarch/Makefile | 27 |
9 files changed, 94 insertions, 11 deletions
diff --git a/ChangeLog.avx128 b/ChangeLog.avx128 new file mode 100644 index 0000000000..c0f795eb24 --- /dev/null +++ b/ChangeLog.avx128 @@ -0,0 +1,20 @@ +2012-10-11 H.J. Lu <hongjiu.lu@intel.com> + + * config.make.in (config-cflags-avx128): New. + * configure.in (libc_cv_cc_avx128): AC_SUBST. + * sysdeps/i386/configure.in: Add -mavx -mprefer-avx128 check. + * sysdeps/x86_64/configure.in: Likewise. + * configure: Regenerated. + * sysdeps/i386/configure: Likewise. + * sysdeps/x86_64/configure: Likewise. + * sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-avx): New macro. + (CFLAGS-e_atan2-avx.c): Set to $(CFLAGS-avx). + (CFLAGS-e_exp-avx.c): Likewise. + (CFLAGS-e_log-avx.c): Likewise. + (CFLAGS-mpa-avx.c): Likewise. + (CFLAGS-mpexp-avx.c): Likewise. + (CFLAGS-mplog-avx.c): Likewise. + (CFLAGS-s_atan-avx.c): Likewise. + (CFLAGS-s_sin-avx.c): Likewise. + (CFLAGS-slowexp-avx.c): Likewise. + (CFLAGS-s_tan-avx.c): Likewise. diff --git a/config.make.in b/config.make.in index b6d1c945dc..0474d0ce84 100644 --- a/config.make.in +++ b/config.make.in @@ -38,6 +38,7 @@ asflags-cpu = @libc_cv_cc_submachine@ config-extra-cflags = @libc_extra_cflags@ config-cflags-sse4 = @libc_cv_cc_sse4@ config-cflags-avx = @libc_cv_cc_avx@ +config-cflags-avx128 = @libc_cv_cc_avx128@ config-cflags-sse2avx = @libc_cv_cc_sse2avx@ config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@ config-cflags-nofma = @libc_cv_cc_nofma@ diff --git a/configure b/configure index 74ff690cf9..19f8f8299f 100755 --- a/configure +++ b/configure @@ -587,6 +587,7 @@ libc_cv_cc_nofma libc_cv_cc_fma4 libc_cv_cc_novzeroupper libc_cv_cc_sse2avx +libc_cv_cc_avx128 libc_cv_cc_avx libc_cv_cc_sse4 libc_cv_forced_unwind @@ -7502,6 +7503,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 facde5e55a..7d057be9bd 100644 --- a/configure.in +++ b/configure.in @@ -2148,6 +2148,7 @@ AC_SUBST(libc_cv_forced_unwind) dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests AC_SUBST(libc_cv_cc_sse4) AC_SUBST(libc_cv_cc_avx) +AC_SUBST(libc_cv_cc_avx128) AC_SUBST(libc_cv_cc_sse2avx) AC_SUBST(libc_cv_cc_novzeroupper) AC_SUBST(libc_cv_cc_fma4) diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure index 7b3683f600..4ea7be9193 100644 --- a/sysdeps/i386/configure +++ b/sysdeps/i386/configure @@ -111,6 +111,26 @@ if test $libc_cv_cc_avx = yes; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking -mavx -mprefer-avx128 support" >&5 +$as_echo_n "checking -mavx -mprefer-avx128 support... " >&6; } +if ${libc_cv_cc_avx128+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -mavx -mprefer-avx128 -xc /dev/null -S -o /dev/null' + { { 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_cc_avx128=yes +else + libc_cv_cc_avx128=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx128" >&5 +$as_echo "$libc_cv_cc_avx128" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5 $as_echo_n "checking for AVX encoding of SSE instructions... " >&6; } if ${libc_cv_cc_sse2avx+:} false; then : diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in index 36cb3e46e0..e00d324bdd 100644 --- a/sysdeps/i386/configure.in +++ b/sysdeps/i386/configure.in @@ -28,6 +28,13 @@ if test $libc_cv_cc_avx = yes; then AC_DEFINE(HAVE_AVX_SUPPORT) fi +dnl Check if -mavx -mprefer-avx128 works. +AC_CACHE_CHECK(-mavx -mprefer-avx128 support, libc_cv_cc_avx128, [dnl +LIBC_TRY_CC_OPTION([-mavx -mprefer-avx128], + [libc_cv_cc_avx128=yes], + [libc_cv_cc_avx128=no]) +]) + dnl Check if -msse2avx works. AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl LIBC_TRY_CC_OPTION([-msse2avx], diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure index 0fa0e1ecfa..4b48c65bcc 100644 --- a/sysdeps/x86_64/configure +++ b/sysdeps/x86_64/configure @@ -91,6 +91,26 @@ if test $libc_cv_cc_avx = yes; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking -mavx -mprefer-avx128 support" >&5 +$as_echo_n "checking -mavx -mprefer-avx128 support... " >&6; } +if ${libc_cv_cc_avx128+:} false; then : + $as_echo_n "(cached) " >&6 +else + if { ac_try='${CC-cc} -mavx -mprefer-avx128 -xc /dev/null -S -o /dev/null' + { { 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_cc_avx128=yes +else + libc_cv_cc_avx128=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx128" >&5 +$as_echo "$libc_cv_cc_avx128" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5 $as_echo_n "checking for AVX encoding of SSE instructions... " >&6; } if ${libc_cv_cc_sse2avx+:} false; then : diff --git a/sysdeps/x86_64/configure.in b/sysdeps/x86_64/configure.in index 94bcd19f3c..3a38740bf0 100644 --- a/sysdeps/x86_64/configure.in +++ b/sysdeps/x86_64/configure.in @@ -21,6 +21,13 @@ if test $libc_cv_cc_avx = yes; then AC_DEFINE(HAVE_AVX_SUPPORT) fi +dnl Check if -mavx -mprefer-avx128 works. +AC_CACHE_CHECK(-mavx -mprefer-avx128 support, libc_cv_cc_avx128, [dnl +LIBC_TRY_CC_OPTION([-mavx -mprefer-avx128], + [libc_cv_cc_avx128=yes], + [libc_cv_cc_avx128=no]) +]) + dnl Check if -msse2avx works. AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl LIBC_TRY_CC_OPTION([-msse2avx], diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index 12b0526e50..03bf06f20a 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -33,21 +33,26 @@ CFLAGS-s_sin-fma4.c = -mfma4 CFLAGS-s_tan-fma4.c = -mfma4 endif -ifeq ($(config-cflags-sse2avx),yes) +ifneq ($(config-cflags-sse2avx)$(config-cflags-avx128),nono) libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \ e_atan2-avx s_sin-avx s_tan-avx \ mplog-avx mpa-avx slowexp-avx \ mpexp-avx -CFLAGS-e_atan2-avx.c = -msse2avx -DSSE2AVX -CFLAGS-e_exp-avx.c = -msse2avx -DSSE2AVX -CFLAGS-e_log-avx.c = -msse2avx -DSSE2AVX -CFLAGS-mpa-avx.c = -msse2avx -DSSE2AVX -CFLAGS-mpexp-avx.c = -msse2avx -DSSE2AVX -CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX -CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX -CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX -CFLAGS-slowexp-avx.c = -msse2avx -DSSE2AVX -CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX +ifeq ($(config-cflags-avx128),yes) +CFLAGS-avx = -mavx -mprefer-avx128 +else +CFLAGS-avx = -msse2avx -DSSE2AVX +endif +CFLAGS-e_atan2-avx.c = $(CFLAGS-avx) +CFLAGS-e_exp-avx.c = $(CFLAGS-avx) +CFLAGS-e_log-avx.c = $(CFLAGS-avx) +CFLAGS-mpa-avx.c = $(CFLAGS-avx) +CFLAGS-mpexp-avx.c = $(CFLAGS-avx) +CFLAGS-mplog-avx.c = $(CFLAGS-avx) +CFLAGS-s_atan-avx.c = $(CFLAGS-avx) +CFLAGS-s_sin-avx.c = $(CFLAGS-avx) +CFLAGS-slowexp-avx.c = $(CFLAGS-avx) +CFLAGS-s_tan-avx.c = $(CFLAGS-avx) endif endif |