From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: "H . J . Lu" <hjl.tools@gmail.com>
Subject: [PATCH v2 1/6] math: Add support for auto static math tests
Date: Thu, 21 Mar 2024 13:43:20 -0300 [thread overview]
Message-ID: <20240321164325.539976-2-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org>
It basically copy the already in place rules for dynamic tests
for auto-generated math tests for all support types. To avoid
the need to duplicate .inc files, a .SECONDEXPANSION rules is
adeed for the gen-libm-test.py generation.
---
math/Makefile | 104 +++++++++++++++++++++++++++++++++++-
math/test-double-static.h | 1 +
math/test-float-static.h | 1 +
math/test-float128-static.h | 1 +
math/test-float32-static.h | 1 +
math/test-float32x-static.h | 1 +
math/test-float64-static.h | 1 +
math/test-float64x-static.h | 1 +
math/test-ibm128-static.h | 1 +
math/test-ldouble-static.h | 1 +
10 files changed, 111 insertions(+), 2 deletions(-)
create mode 100644 math/test-double-static.h
create mode 100644 math/test-float-static.h
create mode 100644 math/test-float128-static.h
create mode 100644 math/test-float32-static.h
create mode 100644 math/test-float32x-static.h
create mode 100644 math/test-float64-static.h
create mode 100644 math/test-float64x-static.h
create mode 100644 math/test-ibm128-static.h
create mode 100644 math/test-ldouble-static.h
diff --git a/math/Makefile b/math/Makefile
index 79ef4ebb65..aef9cec1a1 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -274,8 +274,10 @@ endif
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
-test-extras += $(libm-test-support)
-extra-test-objs += $(addsuffix .o, $(libm-test-support))
+libm-test-support-static = $(foreach t,$(test-types),libm-test-support-$(t)-static)
+test-extras += $(libm-test-support) $(libm-test-support-static)
+extra-test-objs += $(addsuffix .o, $(libm-test-support)) \
+ $(addsuffix .o, $(libm-test-support-static))
libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
test-extras += $(libm-vec-test-wrappers)
extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
@@ -364,6 +366,64 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
$(make-target-directory)
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
+
+libm-test-funcs-auto-static =
+libm-test-funcs-noauto-static =
+libm-test-funcs-compat-static =
+libm-test-funcs-narrow-static =
+libm-test-funcs-all-static = $(libm-test-funcs-auto-static) $(libm-test-funcs-noauto-static)
+
+libm-test-c-auto-static = $(foreach f,$(libm-test-funcs-auto-static),libm-test-$(f)-static.c)
+libm-test-c-noauto-static = $(foreach f,$(libm-test-funcs-noauto-static),libm-test-$(f)-static.c)
+libm-test-c-narrow-static = $(foreach f,$(libm-test-funcs-narrow-static),\
+ libm-test-narrow-$(f)-static.c)
+generated += $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $(libm-test-c-narrow-static)
+
+libm-tests-normal-static = $(foreach t,$(libm-tests-base-normal),\
+ $(foreach f,$(libm-test-funcs-all-static),\
+ $(t)-$(f)-static))
+libm-tests-narrow-static = $(foreach t,$(libm-tests-base-narrow-static),\
+ $(foreach f,$(libm-test-funcs-narrow-static),\
+ $(t)-$(f)-static))
+libm-tests-vector-static = $(foreach t,$(libmvec-tests-static),\
+ $(foreach f,$($(t)-funcs),test-$(t)-$(f)-static))
+libm-tests-static = $(libm-tests-normal-static) $(libm-tests-narrow-static) $(libm-tests-vector-static)
+libm-tests-for-type-static = $(foreach f,$(libm-test-funcs-all-static),\
+ test-$(1)-$(f)-static test-i$(1)-$(f)-static) \
+ $(filter test-$(1)-%,$(libm-tests-vector-static) \
+ $(libm-tests-narrow-static))
+
+libm-tests.o += $(addsuffix .o,$(libm-tests-static))
+
+tests-static += $(libm-tests-static)
+generated += $(addsuffix .c,$(libm-tests)) \
+ $(foreach t,$(test-types),libm-test-support-$(t)-static.c)
+
+libm-test-c-auto-obj-static = $(addprefix $(objpfx),$(libm-test-c-auto-static))
+libm-test-c-noauto-obj-static = $(addprefix $(objpfx),$(libm-test-c-noauto-static))
+libm-test-c-narrow-obj-static = $(addprefix $(objpfx),$(libm-test-c-narrow-static))
+
+# Use the same input test definitions for both dynamic and static tests.
+.SECONDEXPANSION:
+$(libm-test-c-noauto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
+
+.SECONDEXPANSION:
+$(libm-test-c-auto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py \
+ auto-libm-test-out$$(subst -static,,%)
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
+
+.SECONDEXPANSION:
+$(libm-test-c-narrow-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py \
+ auto-libm-test-out$$(subst -static,,%)
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
+
# Tests for totalorder compat symbols reuse the table of tests as
# processed by gen-libm-test.py, so add dependencies on the generated
# .c files.
@@ -505,6 +565,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
echo "#include <libm-test-$$func.c>"; \
) > $@
+$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-%.c:
+ type_func=$*; \
+ type=$${type_func%%-*}; \
+ func=$${type_func#*-}; \
+ ( \
+ echo "#include <test-$$type.h>"; \
+ echo "#include <test-math-exceptions.h>"; \
+ echo "#include <test-math-errno.h>"; \
+ echo "#include <test-math-scalar.h>"; \
+ echo "#include <libm-test-$$func.c>"; \
+ ) > $@
+
$(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
type_pair_func=$*; \
type_pair=$${type_pair_func%-*}; \
@@ -539,6 +611,13 @@ $(foreach t,$(test-types),\
echo "#include <libm-test-support.c>"; \
) > $@
+$(foreach t,$(test-types),\
+ $(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test-support-%.c:
+ ( \
+ echo "#include <test-$*.h>"; \
+ echo "#include <libm-test-support.c>"; \
+ ) > $@
+
$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
define o-iterator-doit
@@ -548,6 +627,13 @@ endef
object-suffixes-left := $(libm-tests-base)
include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(libm-test-funcs-all-static),\
+ $(objpfx)$(o)-$(f)-static.o): $(objpfx)$(o)%.o: $(objpfx)libm-test%.c
+endef
+object-suffixes-left := $(libm-tests-base)
+include $(o-iterator)
+
define o-iterator-doit
$(foreach f,$(libm-test-funcs-narrow),\
$(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
@@ -563,6 +649,13 @@ endef
object-suffixes-left := $(libm-tests-base-normal)
include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(libm-test-funcs-all-static),\
+ $(objpfx)$(o)-$(f)-static.o): CFLAGS += $(libm-test-no-inline-cflags)
+endef
+object-suffixes-left := $(libm-tests-base-normal)
+include $(o-iterator)
+
define o-iterator-doit
$(foreach f,$(libm-test-funcs-narrow),\
$(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
@@ -584,6 +677,13 @@ endef
object-suffixes-left := $(test-types)
include $(o-iterator)
+define o-iterator-doit
+$(addprefix $(objpfx),\
+ $(call libm-tests-for-type-static,$(o))): $(objpfx)libm-test-support-$(o)-static.o
+endef
+object-suffixes-left := $(test-types)
+include $(o-iterator)
+
define o-iterator-doit
$(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
endef
diff --git a/math/test-double-static.h b/math/test-double-static.h
new file mode 100644
index 0000000000..d53f46819f
--- /dev/null
+++ b/math/test-double-static.h
@@ -0,0 +1 @@
+#include "test-double.h"
diff --git a/math/test-float-static.h b/math/test-float-static.h
new file mode 100644
index 0000000000..7834c9e1f1
--- /dev/null
+++ b/math/test-float-static.h
@@ -0,0 +1 @@
+#include "test-float.h"
diff --git a/math/test-float128-static.h b/math/test-float128-static.h
new file mode 100644
index 0000000000..5f8206456a
--- /dev/null
+++ b/math/test-float128-static.h
@@ -0,0 +1 @@
+#include "test-float128.h"
diff --git a/math/test-float32-static.h b/math/test-float32-static.h
new file mode 100644
index 0000000000..2df27d1ca0
--- /dev/null
+++ b/math/test-float32-static.h
@@ -0,0 +1 @@
+#include "test-float32.h"
diff --git a/math/test-float32x-static.h b/math/test-float32x-static.h
new file mode 100644
index 0000000000..62f78b49d8
--- /dev/null
+++ b/math/test-float32x-static.h
@@ -0,0 +1 @@
+#include "test-float32x.h"
diff --git a/math/test-float64-static.h b/math/test-float64-static.h
new file mode 100644
index 0000000000..807c174df1
--- /dev/null
+++ b/math/test-float64-static.h
@@ -0,0 +1 @@
+#include "test-float64.h"
diff --git a/math/test-float64x-static.h b/math/test-float64x-static.h
new file mode 100644
index 0000000000..a7801dbc10
--- /dev/null
+++ b/math/test-float64x-static.h
@@ -0,0 +1 @@
+#include "test-float64x.h"
diff --git a/math/test-ibm128-static.h b/math/test-ibm128-static.h
new file mode 100644
index 0000000000..b66a57050b
--- /dev/null
+++ b/math/test-ibm128-static.h
@@ -0,0 +1 @@
+#include "test-ibm128.h"
diff --git a/math/test-ldouble-static.h b/math/test-ldouble-static.h
new file mode 100644
index 0000000000..beabedb817
--- /dev/null
+++ b/math/test-ldouble-static.h
@@ -0,0 +1 @@
+#include "test-ldouble.h"
--
2.34.1
next prev parent reply other threads:[~2024-03-21 16:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 16:43 [PATCH v2 0/6] Math static build fixes Adhemerval Zanella
2024-03-21 16:43 ` Adhemerval Zanella [this message]
2024-03-21 23:35 ` [PATCH v2 1/6] math: Add support for auto static math tests Joseph Myers
2024-03-22 6:46 ` Florian Weimer
2024-03-22 14:14 ` Adhemerval Zanella Netto
2024-03-22 15:51 ` Florian Weimer
2024-03-22 17:46 ` Adhemerval Zanella Netto
2024-03-25 13:34 ` H.J. Lu
2024-03-25 14:13 ` Adhemerval Zanella Netto
2024-03-25 14:25 ` H.J. Lu
2024-03-25 14:29 ` Adhemerval Zanella Netto
2024-03-25 14:52 ` H.J. Lu
2024-03-25 17:41 ` Adhemerval Zanella Netto
2024-03-26 13:40 ` H.J. Lu
2024-03-26 17:37 ` Joseph Myers
2024-03-26 17:55 ` Adhemerval Zanella Netto
2024-03-26 17:59 ` H.J. Lu
2024-03-21 16:43 ` [PATCH v2 2/6] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 3/6] i386: Use generic fmod Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 4/6] i386: Use generic fmodf Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 5/6] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 6/6] i386: Use generic exp10 Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240321164325.539976-2-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).