diff mbox series

x86-64: Add sysdeps/x86_64/fpu/Makeconfig

Message ID 20211014210752.1989774-1-hjl.tools@gmail.com
State Superseded
Headers show
Series x86-64: Add sysdeps/x86_64/fpu/Makeconfig | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

H.J. Lu Oct. 14, 2021, 9:07 p.m. UTC
1. Add sysdeps/x86_64/fpu/Makeconfig to auto-generate libmvec.mk, which
contains libmvec ABI test dependencies and CFLAGS, in the build directory.
2. Include libmvec.mk for libmvec ABI test dependencies and CFLAGS.
---
 sysdeps/x86_64/fpu/Makeconfig         |  89 +++++++++++++++++++
 sysdeps/x86_64/fpu/Makefile           | 122 ++++++++------------------
 sysdeps/x86_64/fpu/multiarch/Makefile |  68 +++++---------
 3 files changed, 146 insertions(+), 133 deletions(-)
 create mode 100644 sysdeps/x86_64/fpu/Makeconfig

Comments

H.J. Lu Oct. 14, 2021, 9:45 p.m. UTC | #1
On Thu, Oct 14, 2021 at 2:07 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 1. Add sysdeps/x86_64/fpu/Makeconfig to auto-generate libmvec.mk, which
> contains libmvec ABI test dependencies and CFLAGS, in the build directory.
> 2. Include libmvec.mk for libmvec ABI test dependencies and CFLAGS.
> ---
>  sysdeps/x86_64/fpu/Makeconfig         |  89 +++++++++++++++++++
>  sysdeps/x86_64/fpu/Makefile           | 122 ++++++++------------------
>  sysdeps/x86_64/fpu/multiarch/Makefile |  68 +++++---------
>  3 files changed, 146 insertions(+), 133 deletions(-)
>  create mode 100644 sysdeps/x86_64/fpu/Makeconfig
>

Ignore it.  I am fixing it.
diff mbox series

Patch

diff --git a/sysdeps/x86_64/fpu/Makeconfig b/sysdeps/x86_64/fpu/Makeconfig
new file mode 100644
index 0000000000..b1506a4e01
--- /dev/null
+++ b/sysdeps/x86_64/fpu/Makeconfig
@@ -0,0 +1,89 @@ 
+# Generate libmvec.mk for libmvec ABI tests.
+
+# Copyright (C) 2021 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
+# <https://www.gnu.org/licenses/>.
+
+-include $(common-objpfx)libmvec.mk
+postclean-generated += libmvec.mk
+
+# Define for both math and mathvec directories.
+libmvec-funcs = \
+  cos \
+  exp \
+  log \
+  pow \
+  sin \
+  sincos \
+
+# FIXME: Add ABI tests for all libmvec functions and replace
+# libmvec-abi-funcs with libmvec-funcs.
+libmvec-abi-funcs = \
+  sincos
+
+libmvec-abi-funcs-tests = \
+  $(addprefix test-double-libmvec-,$(libmvec-abi-funcs)) \
+  $(addsuffix f,$(addprefix test-float-libmvec-,$(libmvec-abi-funcs)))
+
+empty:=
+space:=$(empty) $(empty)
+libmvec-abi-func-avx-list = $(space) -avx -avx2
+libmvec-abi-func-avx-tests = \
+  $(foreach l,$(libmvec-abi-func-avx-list), \
+    $(addsuffix $(l),$(libmvec-abi-funcs-tests)))
+libmvec-abi-func-avx512f-tests = \
+  $(addsuffix -avx512f,$(libmvec-abi-funcs-tests))
+libmvec-abi-func-tests = \
+  $(libmvec-abi-func-avx-tests) \
+  $(libmvec-abi-func-avx512f-tests)
+
+$(common-objpfx)libmvec.mk: $(common-objpfx)config.make
+	(echo "ifeq (\$$(subdir)\$$(build-mathvec),mathyes)"; \
+	 echo; \
+	 for t in $(libmvec-abi-func-tests); do \
+	   echo "\$$(objpfx)$$t: \\"; \
+	   echo "  \$$(objpfx)$$t.o \\"; \
+	   echo "  \$$(objpfx)test-libmvec.o \$$(libmvec)"; \
+	   echo; \
+	 done; \
+	 for t in $(libmvec-abi-funcs); do \
+	   echo "CFLAGS-test-double-libmvec-$$t.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags)"; \
+	   echo "CFLAGS-test-double-libmvec-$$t-avx.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(double-vlen4-arch-ext-cflags)"; \
+	   echo "CFLAGS-test-double-libmvec-$$t-avx2.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(double-vlen4-arch-ext2-cflags)"; \
+	   echo "CFLAGS-test-double-libmvec-$$t-avx512f.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(double-vlen8-arch-ext-cflags)"; \
+	   echo; \
+	   echo "CFLAGS-test-float-libmvec-$${t}f.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags)"; \
+	   echo "CFLAGS-test-float-libmvec-$${t}f-avx.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(float-vlen8-arch-ext-cflags)"; \
+	   echo "CFLAGS-test-float-libmvec-$${t}f-avx2.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(float-vlen8-arch-ext2-cflags)"; \
+	   echo "CFLAGS-test-float-libmvec-$${t}f-avx512f.c = \\"; \
+	   echo "  \$$(libmvec-abi-test-cflags) \\"; \
+	   echo "  \$$(float-vlen16-arch-ext-cflags)"; \
+	   echo; \
+	 done; \
+	 echo "endif") > $@T
+	mv -f $@T $@
diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
index e5a65750c0..d83ff7e2d4 100644
--- a/sysdeps/x86_64/fpu/Makefile
+++ b/sysdeps/x86_64/fpu/Makefile
@@ -1,87 +1,48 @@ 
 ifeq ($(subdir),mathvec)
-libmvec-support += svml_d_cos2_core svml_d_cos4_core_avx \
-		   svml_d_cos4_core svml_d_cos8_core \
-		   svml_d_sin2_core svml_d_sin4_core_avx \
-		   svml_d_sin4_core svml_d_sin8_core svml_d_trig_data \
-		   svml_s_cosf4_core svml_s_cosf8_core_avx \
-		   svml_s_cosf8_core svml_s_cosf16_core svml_s_trig_data \
-		   svml_s_sinf4_core svml_s_sinf8_core_avx \
-		   svml_s_sinf8_core svml_s_sinf16_core \
-		   svml_d_sincos2_core svml_d_sincos4_core_avx \
-		   svml_d_sincos4_core svml_d_sincos8_core \
-		   svml_d_log2_core svml_d_log4_core_avx svml_d_log4_core \
-		   svml_d_log8_core svml_d_log_data svml_s_logf4_core \
-		   svml_s_logf8_core_avx svml_s_logf8_core svml_s_logf16_core \
-		   svml_s_logf_data svml_d_exp2_core svml_d_exp4_core_avx \
-		   svml_d_exp4_core svml_d_exp8_core svml_d_exp_data \
-		   svml_s_expf4_core svml_s_expf8_core_avx svml_s_expf8_core \
-		   svml_s_expf16_core svml_s_expf_data svml_d_pow2_core \
-		   svml_d_pow4_core_avx svml_d_pow4_core svml_d_pow8_core \
-		   svml_d_pow_data svml_s_powf4_core svml_s_powf8_core_avx \
-		   svml_s_powf8_core svml_s_powf16_core svml_s_powf_data \
-		   svml_s_sincosf4_core svml_s_sincosf8_core_avx \
-		   svml_s_sincosf8_core svml_s_sincosf16_core
+libmvec-double-func-list = \
+  2_core \
+  4_core \
+  4_core_avx \
+  8_core
+libmvec-float-func-list = \
+  f4_core \
+  f8_core \
+  f8_core_avx \
+  f16_core
+libmvec-support += \
+  svml_d_exp_data \
+  svml_d_log_data \
+  svml_d_pow_data \
+  svml_d_trig_data \
+  svml_s_expf_data \
+  svml_s_logf_data \
+  svml_s_powf_data \
+  svml_s_trig_data \
+  $(foreach l,$(libmvec-double-func-list), \
+    $(addprefix svml_d_,$(addsuffix $(l),$(libmvec-funcs)))) \
+  $(foreach l,$(libmvec-float-func-list), \
+    $(addprefix svml_s_,$(addsuffix $(l),$(libmvec-funcs))))
 endif
 
 # Variables for libmvec tests.
-ifeq ($(subdir),math)
-ifeq ($(build-mathvec),yes)
+ifeq ($(subdir)$(build-mathvec),mathyes)
 libmvec-tests += double-vlen2 double-vlen4 double-vlen4-avx2 \
 		 float-vlen4 float-vlen8 float-vlen8-avx2
-tests += test-double-libmvec-sincos test-double-libmvec-sincos-avx \
-	 test-double-libmvec-sincos-avx2 test-float-libmvec-sincosf \
-	 test-float-libmvec-sincosf-avx test-float-libmvec-sincosf-avx2
-test-extras += test-libmvec test-libmvec-avx \
-	       test-libmvec-avx2 test-libmvec-avx512f
-extra-test-objs += test-libmvec.o test-libmvec-avx.o \
-		   test-libmvec-avx2.o test-libmvec-avx512f.o
 
-$(objpfx)test-double-libmvec-sincos: \
-  $(objpfx)test-double-libmvec-sincos.o \
-  $(objpfx)test-libmvec.o $(libmvec)
-
-$(objpfx)test-double-libmvec-sincos-avx: \
-  $(objpfx)test-double-libmvec-sincos-avx.o \
-  $(objpfx)test-libmvec-avx.o $(libmvec)
-
-$(objpfx)test-double-libmvec-sincos-avx2: \
-  $(objpfx)test-double-libmvec-sincos-avx2.o \
-  $(objpfx)test-libmvec-avx2.o $(libmvec)
-
-$(objpfx)test-float-libmvec-sincosf: \
-  $(objpfx)test-float-libmvec-sincosf.o \
-  $(objpfx)test-libmvec.o $(libmvec)
-
-$(objpfx)test-float-libmvec-sincosf-avx: \
-  $(objpfx)test-float-libmvec-sincosf-avx.o \
-  $(objpfx)test-libmvec-avx.o $(libmvec)
-
-$(objpfx)test-float-libmvec-sincosf-avx2: \
-  $(objpfx)test-float-libmvec-sincosf-avx2.o \
-  $(objpfx)test-libmvec-avx2.o $(libmvec)
+tests += $(libmvec-abi-func-avx-tests)
 
 libmvec-tests += double-vlen8 float-vlen16
-tests += test-double-libmvec-sincos-avx512f \
-	 test-float-libmvec-sincosf-avx512f
-test-extras += test-libmvec-avx512f
-extra-test-objs += test-libmvec-avx512f.o
 
-$(objpfx)test-double-libmvec-sincos-avx512f: \
-  $(objpfx)test-double-libmvec-sincos-avx512f.o \
-  $(objpfx)test-libmvec-avx512f.o $(libmvec)
+tests += $(libmvec-abi-func-avx512f-tests)
 
-$(objpfx)test-float-libmvec-sincosf-avx512f: \
-  $(objpfx)test-float-libmvec-sincosf-avx512f.o \
-  $(objpfx)test-libmvec-avx512f.o $(libmvec)
-
-double-vlen2-funcs = cos exp log pow sin sincos
-double-vlen4-funcs = cos exp log pow sin sincos
-double-vlen4-avx2-funcs = cos exp log pow sin sincos
-double-vlen8-funcs = cos exp log pow sin sincos
-float-vlen4-funcs = cos exp log pow sin sincos
-float-vlen8-funcs = cos exp log pow sin sincos
-float-vlen8-avx2-funcs = cos exp log pow sin sincos
-float-vlen16-funcs = cos exp log pow sin sincos
+double-vlen2-funcs = $(libmvec-funcs)
+double-vlen4-funcs = $(libmvec-funcs)
+double-vlen4-avx2-funcs = $(libmvec-funcs)
+double-vlen8-funcs = $(libmvec-funcs)
+float-vlen4-funcs = $(libmvec-funcs)
+float-vlen8-funcs = $(libmvec-funcs)
+float-vlen8-avx2-funcs = $(libmvec-funcs)
+float-vlen16-funcs = $(libmvec-funcs)
 
 double-vlen4-arch-ext-cflags = -mavx
 double-vlen4-arch-ext2-cflags = -mavx2
@@ -91,22 +52,13 @@  float-vlen8-arch-ext-cflags = -mavx
 float-vlen8-arch-ext2-cflags = -mavx2
 float-vlen16-arch-ext-cflags = -mavx512f
 
-libmvec-sincos-cflags = $(libm-test-fast-math-cflags) -fno-inline -fopenmp -Wno-unknown-pragmas
+libmvec-abi-test-cflags = \
+  $(libm-test-fast-math-cflags) \
+  -fno-inline -fopenmp -Wno-unknown-pragmas
 
 CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
 
 CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
-
-CFLAGS-test-double-libmvec-sincos.c = $(libmvec-sincos-cflags)
-CFLAGS-test-double-libmvec-sincos-avx.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
-CFLAGS-test-double-libmvec-sincos-avx2.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
-CFLAGS-test-double-libmvec-sincos-avx512f.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
-
-CFLAGS-test-float-libmvec-sincosf.c = $(libmvec-sincos-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx2.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx512f.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
-endif
 endif
 
 ifeq ($(subdir)$(config-cflags-mprefer-vector-width),mathyes)
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index d425ffd6d3..ec796277a5 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -59,52 +59,24 @@  CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
 endif
 
 ifeq ($(subdir),mathvec)
-libmvec-sysdep_routines += svml_d_cos2_core_sse4 svml_d_cos4_core_avx2 \
-			   svml_d_cos8_core_avx512 svml_d_sin2_core_sse4 \
-			   svml_d_sin4_core_avx2 svml_d_sin8_core_avx512 \
-			   svml_d_log2_core_sse4 svml_d_log4_core_avx2 \
-			   svml_d_log8_core_avx512 svml_d_sincos2_core_sse4 \
-			   svml_d_sincos4_core_avx2 svml_d_sincos8_core_avx512 \
-			   svml_s_cosf4_core_sse4 svml_s_cosf8_core_avx2 \
-			   svml_s_cosf16_core_avx512 svml_s_sinf4_core_sse4 \
-			   svml_s_sinf8_core_avx2 svml_s_sinf16_core_avx512 \
-			   svml_s_logf4_core_sse4 svml_s_logf8_core_avx2 \
-			   svml_s_logf16_core_avx512 svml_d_exp2_core_sse4 \
-			   svml_d_exp4_core_avx2 svml_d_exp8_core_avx512 \
-			   svml_s_expf4_core_sse4 svml_s_expf8_core_avx2 \
-			   svml_s_expf16_core_avx512 svml_d_pow2_core_sse4 \
-			   svml_d_pow4_core_avx2 svml_d_pow8_core_avx512 \
-			   svml_s_powf4_core_sse4 svml_s_powf8_core_avx2 \
-			   svml_s_powf16_core_avx512 svml_s_sincosf4_core_sse4 \
-			   svml_s_sincosf8_core_avx2 \
-			   svml_s_sincosf16_core_avx512 \
-			   svml_d_cos2_core-sse2 svml_d_cos4_core-sse \
-			   svml_d_cos8_core-avx2 svml_d_exp2_core-sse2 \
-			   svml_d_exp4_core-sse svml_d_exp8_core-avx2 \
-			   svml_d_log2_core-sse2 svml_d_log4_core-sse \
-			   svml_d_log8_core-avx2 svml_d_pow2_core-sse2 \
-			   svml_d_pow4_core-sse svml_d_pow8_core-avx2 \
-			   svml_d_sin2_core-sse2 svml_d_sin4_core-sse \
-			   svml_d_sin8_core-avx2 \
-			   svml_d_sincos2_core-sse2 \
-			   svml_d_sincos4_core-sse \
-			   svml_d_sincos8_core-avx2 \
-			   svml_s_cosf16_core-avx2 \
-			   svml_s_cosf4_core-sse2 \
-			   svml_s_cosf8_core-sse \
-			   svml_s_expf16_core-avx2 \
-			   svml_s_expf4_core-sse2 \
-			   svml_s_expf8_core-sse \
-			   svml_s_logf16_core-avx2 \
-			   svml_s_logf4_core-sse2 \
-			   svml_s_logf8_core-sse \
-			   svml_s_powf16_core-avx2 \
-			   svml_s_powf4_core-sse2 \
-			   svml_s_powf8_core-sse \
-			   svml_s_sincosf16_core-avx2 \
-			   svml_s_sincosf4_core-sse2 \
-			   svml_s_sincosf8_core-sse \
-			   svml_s_sinf16_core-avx2 \
-			   svml_s_sinf4_core-sse2 \
-			   svml_s_sinf8_core-sse
+libmvec-multiarch-double-func-list = \
+  2_core-sse2 \
+  2_core_sse4 \
+  4_core-sse \
+  4_core_avx2 \
+  8_core-avx2 \
+  8_core_avx512
+libmvec-multiarch-float-func-list = \
+  f4_core-sse2 \
+  f4_core_sse4 \
+  f8_core-sse \
+  f8_core_avx2 \
+  f16_core-avx2 \
+  f16_core_avx512
+
+libmvec-sysdep_routines += \
+  $(foreach l,$(libmvec-multiarch-double-func-list), \
+    $(addprefix svml_d_,$(addsuffix $(l),$(libmvec-funcs)))) \
+  $(foreach l,$(libmvec-multiarch-float-func-list), \
+    $(addprefix svml_s_,$(addsuffix $(l),$(libmvec-funcs))))
 endif