diff options
author | Andrew Senkevich <andrew.senkevich@intel.com> | 2016-02-16 22:44:52 +0300 |
---|---|---|
committer | Andrew Senkevich <andrew.senkevich@intel.com> | 2016-02-16 22:44:52 +0300 |
commit | b21680a49e5baf4ca2425d6ae109d2bff50c2cc2 (patch) | |
tree | 35993365ff169f772de4c435b6ee18d84e8122db | |
parent | f0701438166a9232c0738247cbf74bbf228e6bce (diff) | |
download | glibc-b21680a49e5baf4ca2425d6ae109d2bff50c2cc2.tar.gz glibc-b21680a49e5baf4ca2425d6ae109d2bff50c2cc2.tar.xz glibc-b21680a49e5baf4ca2425d6ae109d2bff50c2cc2.zip |
Another way for test of aliases.
16 files changed, 88 insertions, 228 deletions
diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile index 1db35323e7..16c99d26ea 100644..100755 --- a/sysdeps/x86_64/fpu/Makefile +++ b/sysdeps/x86_64/fpu/Makefile @@ -28,23 +28,35 @@ endif # Variables for libmvec tests. ifeq ($(subdir),math) ifeq ($(build-mathvec),yes) -libmvec-tests += double-vlen2 double-vlen4 double-vlen4-avx2 \ - float-vlen4 float-vlen8 float-vlen8-avx2 libmvec-alias -modules-names += test-libmvec-alias-mod +libmvec-tests += double-vlen2 double-vlen4 double-vlen4-avx2 double-libmvec-alias \ + double-libmvec-alias-avx double-libmvec-alias-avx2 \ + float-vlen4 float-vlen8 float-vlen8-avx2 # float-libmvec-alias +modules-names += test-double-libmvec-alias-mod test-double-libmvec-alias-avx-mod \ + test-double-libmvec-alias-avx2-mod test-libmvec-alias-mod.so-no-z-defs = yes +test-libmvec-alias-avx-mod.so-no-z-defs = yes +test-libmvec-alias-avx2-mod.so-no-z-defs = yes -$(objpfx)test-libmvec-alias: $(objpfx)test-libmvec-alias-mod.so -$(objpfx)test-libmvec-alias-mod.so: $(objpfx)../mathvec/libmvec_nonshared.a \ - $(libmvec) +$(objpfx)test-double-libmvec-alias: $(objpfx)test-double-libmvec-alias-mod.so +$(objpfx)test-double-libmvec-alias-mod.so: $(objpfx)../mathvec/libmvec_nonshared.a \ + $(libmvec) + +$(objpfx)test-double-libmvec-alias-avx: $(objpfx)test-double-libmvec-alias-avx-mod.so +$(objpfx)test-double-libmvec-alias-avx-mod.so: $(objpfx)../mathvec/libmvec_nonshared.a \ + $(libmvec) + +$(objpfx)test-double-libmvec-alias-avx2: $(objpfx)test-double-libmvec-alias-avx2-mod.so +$(objpfx)test-double-libmvec-alias-avx2-mod.so: $(objpfx)../mathvec/libmvec_nonshared.a \ + $(libmvec) ifeq (yes,$(config-cflags-avx512)) -libmvec-tests += double-vlen8 float-vlen16 libmvec-alias-avx512 -modules-names += test-libmvec-alias-avx512-mod -test-libmvec-alias-avx512-mod.so-no-z-defs = yes +libmvec-tests += double-vlen8 float-vlen16 double-libmvec-alias-avx512 +modules-names += test-double-libmvec-alias-avx512-mod +test-double-libmvec-alias-avx512-mod.so-no-z-defs = yes -$(objpfx)test-libmvec-alias-avx512: $(objpfx)test-libmvec-alias-avx512-mod.so -$(objpfx)test-libmvec-alias-avx512-mod.so: \ - $(objpfx)../mathvec/libmvec_nonshared.a $(libmvec) +$(objpfx)test-double-libmvec-alias-avx512: $(objpfx)test-double-libmvec-alias-avx512-mod.so +$(objpfx)test-double-libmvec-alias-avx512-mod.so: \ + $(objpfx)../mathvec/libmvec_nonshared.a $(libmvec) endif double-vlen4-arch-ext-cflags = -mavx @@ -55,8 +67,12 @@ float-vlen8-arch-ext-cflags = -mavx float-vlen8-arch-ext2-cflags = -mavx2 float-vlen16-arch-ext-cflags = -mavx512f -CFLAGS-test-libmvec-alias-mod.c = $(double-vlen4-arch-ext2-cflags) -CFLAGS-test-libmvec-alias-avx512-mod.c = $(double-vlen8-arch-ext-cflags) +libmvec-alias-cflags = $(libm-test-vec-cflags) -ffinite-math-only -fopenmp + +CFLAGS-test-double-libmvec-alias-mod.c = $(libmvec-alias-cflags) +CFLAGS-test-double-libmvec-alias-avx-mod.c = $(double-vlen4-arch-ext-cflags) $(libmvec-alias-cflags) -DREQUIRE_AVX +CFLAGS-test-double-libmvec-alias-avx2-mod.c = $(double-vlen4-arch-ext2-cflags) $(libmvec-alias-cflags) -DREQUIRE_AVX2 +CFLAGS-test-double-libmvec-alias-avx512-mod.c = $(double-vlen8-arch-ext-cflags) $(libmvec-alias-cflags) -DREQUIRE_AVX512F CFLAGS-test-double-vlen4-avx2.c = $(libm-test-vec-cflags) CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags) diff --git a/sysdeps/x86_64/fpu/svml_finite_alias.S b/sysdeps/x86_64/fpu/svml_finite_alias.S index 8314cf4a9a..2dcfc37590 100644..100755 --- a/sysdeps/x86_64/fpu/svml_finite_alias.S +++ b/sysdeps/x86_64/fpu/svml_finite_alias.S @@ -23,7 +23,7 @@ #define ALIAS_IMPL(alias, target) \ ENTRY (alias); \ - jmp target@PLT; \ + jmp *target@GOTPCREL(%rip); \ END (alias) .text diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx-mod.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx-mod.c new file mode 100644 index 0000000000..514883dcf9 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx-mod.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias-mod.c" diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512-wrappers.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx-wrappers.c index 9d841c9fd1..9d841c9fd1 100644 --- a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512-wrappers.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx-wrappers.c diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx.c new file mode 100755 index 0000000000..43914ef0e7 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias.c" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2-mod.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2-mod.c new file mode 100644 index 0000000000..514883dcf9 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2-mod.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias-mod.c" diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias-wrappers.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2-wrappers.c index 9d841c9fd1..9d841c9fd1 100644 --- a/sysdeps/x86_64/fpu/test-libmvec-alias-wrappers.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2-wrappers.c diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2.c new file mode 100755 index 0000000000..43914ef0e7 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx2.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias.c" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-mod.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-mod.c new file mode 100755 index 0000000000..514883dcf9 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-mod.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias-mod.c" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-wrappers.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-wrappers.c new file mode 100644 index 0000000000..9d841c9fd1 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512-wrappers.c @@ -0,0 +1 @@ +/* Dummy file. */ diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512.c new file mode 100755 index 0000000000..43914ef0e7 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-avx512.c @@ -0,0 +1 @@ +#include "test-double-libmvec-alias.c" diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512-mod.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-mod.c index 64218f8f3b..c111b2af1c 100644..100755 --- a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512-mod.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-mod.c @@ -17,30 +17,50 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <immintrin.h> - -#include "test-double-vlen8.h" -#define VEC_TYPE __m512d - -VECTOR_WRAPPER (WRAPPER_NAME (log), _ZGVeN8v___log_finite) -VECTOR_WRAPPER (WRAPPER_NAME (exp), _ZGVeN8v___exp_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (pow), _ZGVeN8vv___pow_finite) - -#undef FUNC -#undef FLOAT -#undef BUILD_COMPLEX -#undef TEST_MSG -#undef CHOOSE -#undef FUNC_TEST -#undef VEC_TYPE -#undef VECTOR_WRAPPER -#undef VECTOR_WRAPPER_ff -#undef VEC_SUFF -#undef VEC_LEN - -#include "test-float-vlen16.h" -#define VEC_TYPE __m512 - -VECTOR_WRAPPER (WRAPPER_NAME (logf), _ZGVeN16v___logf_finite) -VECTOR_WRAPPER (WRAPPER_NAME (expf), _ZGVeN16v___expf_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (powf), _ZGVeN16vv___powf_finite) +#include <math.h> +#include <stdlib.h> +#include <math-tests-arch.h> + +#define N 3000 +double log_arg[N]; +double log_res[N]; +double exp_arg[N]; +double exp_res[N]; +double pow_res[N]; + +static void init(void) +{ + int i; + + for (i = 0; i < N; i += 1) + { + log_arg[i] = 1.0; + exp_arg[i] = 0.0; + } +} + +static void check(void) +{ + if (log_res[0] != 0.0) abort (); + if (exp_res[0] != 1.0) abort (); + if (pow_res[0] != 1.0) abort (); +} + +void test_finite_alias (void) +{ + int i; + + CHECK_ARCH_EXT; + + init(); + +#pragma omp simd + for (i = 0; i < N; i += 1) + { + log_res[i] = log (log_arg[i]); + exp_res[i] = exp (exp_arg[i]); + pow_res[i] = pow (log_arg[i], log_arg[i]); + } + + check(); +} diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-alias-wrappers.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias-wrappers.c new file mode 100644 index 0000000000..9d841c9fd1 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias-wrappers.c @@ -0,0 +1 @@ +/* Dummy file. */ diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512.c b/sysdeps/x86_64/fpu/test-double-libmvec-alias.c index 8d112344c2..9928cb08b2 100644..100755 --- a/sysdeps/x86_64/fpu/test-libmvec-alias-avx512.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-alias.c @@ -16,28 +16,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <init-arch.h> - -extern double log_vlen8 (double); -extern double exp_vlen8 (double); -extern double pow_vlen8 (double, double); - -extern float logf_vlen16 (float); -extern float expf_vlen16 (float); -extern float powf_vlen16 (float, float); +extern void test_finite_alias(void); int main(void) { - if (!HAS_ARCH_FEATURE (AVX512F_Usable)) return 0; - - if (log_vlen8(1.0) != 0.0 - || logf_vlen16(1.0) != 0.0) abort(); - - if (exp_vlen8(0.0) != 1.0 - || expf_vlen16(0.0) != 1.0) abort(); - - if (pow_vlen8(1.0, 1.0) != 1.0 - || powf_vlen16(1.0, 1.0) != 1.0) abort(); + test_finite_alias(); return 0; } diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias-mod.c b/sysdeps/x86_64/fpu/test-libmvec-alias-mod.c deleted file mode 100644 index 37c2d75150..0000000000 --- a/sysdeps/x86_64/fpu/test-libmvec-alias-mod.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Part of test to build shared library to ensure link against - *_finite aliases from libmvec. - Copyright (C) 2016 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 <immintrin.h> - -#include "test-double-vlen2.h" -#define VEC_TYPE __m128d - -VECTOR_WRAPPER (WRAPPER_NAME (log), _ZGVbN2v___log_finite) -VECTOR_WRAPPER (WRAPPER_NAME (exp), _ZGVbN2v___exp_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (pow), _ZGVbN2vv___pow_finite) - -#undef VEC_TYPE -#undef VECTOR_WRAPPER -#undef VECTOR_WRAPPER_ff -#undef VEC_SUFF -#undef VEC_LEN - -#include "test-double-vlen4.h" -#define VEC_TYPE __m256d - -VECTOR_WRAPPER (WRAPPER_NAME (log), _ZGVcN4v___log_finite) -VECTOR_WRAPPER (WRAPPER_NAME (exp), _ZGVcN4v___exp_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (pow), _ZGVcN4vv___pow_finite) - -#undef VEC_SUFF -#define VEC_SUFF _vlen4_avx2 - -VECTOR_WRAPPER (WRAPPER_NAME (log), _ZGVdN4v___log_finite) -VECTOR_WRAPPER (WRAPPER_NAME (exp), _ZGVdN4v___exp_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (pow), _ZGVdN4vv___pow_finite) - -#undef FUNC -#undef FLOAT -#undef BUILD_COMPLEX -#undef TEST_MSG -#undef CHOOSE -#undef FUNC_TEST -#undef VEC_TYPE -#undef VECTOR_WRAPPER -#undef VECTOR_WRAPPER_ff -#undef VEC_SUFF -#undef VEC_LEN - -#include "test-float-vlen4.h" -#define VEC_TYPE __m128 - -VECTOR_WRAPPER (WRAPPER_NAME (logf), _ZGVbN4v___logf_finite) -VECTOR_WRAPPER (WRAPPER_NAME (expf), _ZGVbN4v___expf_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (powf), _ZGVbN4vv___powf_finite) - -#undef VEC_TYPE -#undef VECTOR_WRAPPER -#undef VECTOR_WRAPPER_ff -#undef VEC_SUFF -#undef VEC_LEN - -#include "test-float-vlen8.h" -#define VEC_TYPE __m256 - -VECTOR_WRAPPER (WRAPPER_NAME (logf), _ZGVcN8v___logf_finite) -VECTOR_WRAPPER (WRAPPER_NAME (expf), _ZGVcN8v___expf_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (powf), _ZGVcN8vv___powf_finite) - -#undef VEC_SUFF -#define VEC_SUFF _vlen8_avx2 - -VECTOR_WRAPPER (WRAPPER_NAME (logf), _ZGVdN8v___logf_finite) -VECTOR_WRAPPER (WRAPPER_NAME (expf), _ZGVdN8v___expf_finite) -VECTOR_WRAPPER_ff (WRAPPER_NAME (powf), _ZGVdN8vv___powf_finite) diff --git a/sysdeps/x86_64/fpu/test-libmvec-alias.c b/sysdeps/x86_64/fpu/test-libmvec-alias.c deleted file mode 100644 index 429b19eb6a..0000000000 --- a/sysdeps/x86_64/fpu/test-libmvec-alias.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Part of test to ensure link against *_finite aliases from libmvec. - Copyright (C) 2016 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 <init-arch.h> - -extern double log_vlen2 (double); -extern double exp_vlen2 (double); -extern double pow_vlen2 (double, double); - -extern double log_vlen4 (double); -extern double exp_vlen4 (double); -extern double pow_vlen4 (double, double); - -extern double log_vlen4_avx2 (double); -extern double exp_vlen4_avx2 (double); -extern double pow_vlen4_avx2 (double, double); - -extern float logf_vlen4 (float); -extern float expf_vlen4 (float); -extern float powf_vlen4 (float, float); - -extern float logf_vlen8 (float); -extern float expf_vlen8 (float); -extern float powf_vlen8 (float, float); - -extern float logf_vlen8_avx2 (float); -extern float expf_vlen8_avx2 (float); -extern float powf_vlen8_avx2 (float, float); - -int main(void) -{ - if (log_vlen2(1.0) != 0.0 - || logf_vlen4(1.0) != 0.0) abort(); - - if (exp_vlen2(0.0) != 1.0 - || expf_vlen4(0.0) != 1.0) abort(); - - if (pow_vlen2(1.0, 1.0) != 1.0 - || powf_vlen4(1.0, 1.0) != 1.0) abort(); - - if (HAS_ARCH_FEATURE (AVX_Usable)) - { - if (log_vlen4(1.0) != 0.0 - || logf_vlen8(1.0) != 0.0) abort(); - - if (exp_vlen4(0.0) != 1.0 - || expf_vlen8(0.0) != 1.0) abort(); - - if (pow_vlen4(1.0, 1.0) != 1.0 - || powf_vlen8(1.0, 1.0) != 1.0) abort(); - } - - if (HAS_ARCH_FEATURE (AVX2_Usable)) - { - if (log_vlen4_avx2(1.0) != 0.0 - || logf_vlen8_avx2(1.0) != 0.0) abort(); - - if (exp_vlen4_avx2(0.0) != 1.0 - || expf_vlen8_avx2(0.0) != 1.0) abort(); - - if (pow_vlen4_avx2(1.0, 1.0) != 1.0 - || powf_vlen8_avx2(1.0, 1.0) != 1.0) abort(); - } - - return 0; -} |