From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by sourceware.org (Postfix) with ESMTPS id 67C973858D1E for ; Tue, 21 May 2024 19:13:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67C973858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 67C973858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716318797; cv=none; b=TxqBFNNPXJF8Fe9FvBJeTtPw1ftKOIO1RyTSmIf8nxqsJXX/RUZ9Yni8CQ1IC4TiHyke+vBusg1m8Zt7/B/AuSToS1VezwTJtcDkkEAc2Y6t5q8qnSA6UKsrdCwHXyo34EbfET2y1jg0vNz0zPtjI3q6AwSqmH2TJcPYlOEBxSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716318797; c=relaxed/simple; bh=aY8G2RMF8PCrl4fpDdK+egX2nPv2lflqMzezcNDL5Q4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Q8S/OZag1QecF8CnGmo9xeezS9z3UNrPD84BpF6ZLGKgHfHuvIY1y4RSZd6u2rDzhCV3tsD5Fb2wQxHmowx7in7SDsdJyAsp9dAkUz9Z3Bz7+OLtmhvVN6TuwRV3giM/CeA5qYjTHjqSSl+LN2ZMEYiA78NTJClI27/SsSItMzg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-61b4cbb8834so132007b3.0 for ; Tue, 21 May 2024 12:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716318794; x=1716923594; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=psi4J3G2c0yg+uYsTlWZfQ/H8h5Rc+ce7wjSDY2d7PE=; b=XOWOTvwlCVfGDq5y8kgzeSf6G7qJu5IePQpLuLlZzDwhBsVmD4FonWc7iVHqVO3OGD VhBu/996iqjO6K6Y/I6qdQAByXac8ZTAQCiEuHYmLto4CaY8Vr8W68HqAA/8KatKL5kb /bOi50QWvDyhP9vay23gyo1FrpdKTOJrM+vvQ6YWYS+W5BQEH5rJRulZGh800RLMXcTD Qff9Ky6BXLUqgL65QQikwJG4OiV21XZ/SX6p/vOWHyuSOtjvkuQtBBjyJlgrQCfCUvI5 QzuVal5v3S51niUK3fZmRn7KX23yJdoZa7CXwC00MzoLr2pdpI70t2S8pd20RJqEp0VK TBJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716318794; x=1716923594; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=psi4J3G2c0yg+uYsTlWZfQ/H8h5Rc+ce7wjSDY2d7PE=; b=ByF1/taRCTKUCF/SgQNunvpwhDh7t27sdv1lyR63iTTV8KRFlYAq1a7zJYqaeaMcKn qdCfRxcDIvqHBFndPYaAFL2NXs/txjATVu2ruWmkGuqzEkKW8e0UHbgHCG3HyNFxjm7B 0Z9/0YLI3dbErkoOOZwY8HOdxRL8x08HZFVlXco3/2t4HEG3v0LfUxZJxMM/PtjcO8iS ShMdfBJ6jn7ukJFt2WUqBhVoA1gYJjez7hlt7dBSxpe8Bi3wRhCOW0GCiQgayPvlFNn4 hJes6DnCWrjMlkf3P/C35/DoHzfB4B0RAcyjjO8duuRMUb4cu7WmIP7K82jRjmJcjGNz motA== X-Gm-Message-State: AOJu0YyXjBkqRy1xGIvkkBVe28TdRraZ0fyEtnsOGhRKsw2ArXInmJkb oX97EsPiCXpS2kbP7eoMUGNPz2SCGBy64j40UOC+uXwd7nZIy28o7TzYyKyVESiX6E11PXeaEOz 8ElrmbJc/tndUMS7kV1hBUFUK0C8= X-Google-Smtp-Source: AGHT+IGH4LSt6SIwqa1FoUrwOZwS+5LUsJTnydzF2xIyj5vCcYxyVlvndkPJVh0GGA0CyUaK3dAy+dxW7JouAU4rnBM= X-Received: by 2002:a0d:d814:0:b0:615:3332:f352 with SMTP id 00721157ae682-627e489ed5emr111667b3.52.1716318792693; Tue, 21 May 2024 12:13:12 -0700 (PDT) MIME-Version: 1.0 References: <20240521165430.2998944-1-adhemerval.zanella@linaro.org> <20240521165430.2998944-2-adhemerval.zanella@linaro.org> In-Reply-To: <20240521165430.2998944-2-adhemerval.zanella@linaro.org> From: "H.J. Lu" Date: Tue, 21 May 2024 12:12:35 -0700 Message-ID: Subject: Re: [PATCH v4 1/5] math: Add support for auto static math tests To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3019.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, May 21, 2024 at 9:54=E2=80=AFAM Adhemerval Zanella wrote: > > It basically copy the already in place rules for dynamic tests for > auto-generated math functions for all support types. To avoid the > need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for > the gen-libm-test.py generation. > > New tests are added on the new rules 'libm-test-funcs-auto-static', > 'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static'; > similar to the non-static counterparts. > > To avoid add extra build and disk requirement, the new math static > tests are only enable with a new define 'build-math-static-tests'. > --- > Makeconfig | 5 ++ > Makefile.help | 4 ++ > math/Makefile | 120 ++++++++++++++++++++++++++++++++++-- > 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 + > 12 files changed, 133 insertions(+), 5 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/Makeconfig b/Makeconfig > index 9fe664ae3a..29819363da 100644 > --- a/Makeconfig > +++ b/Makeconfig > @@ -768,6 +768,11 @@ run-built-tests =3D yes > endif > endif > > +# Whether to build the static math tests > +ifndef build-math-static-tests > +build-math-static-tests =3D no > +endif > + > # Whether to stop immediately when a test fails. Nonempty means to > # stop, empty means not to stop. > ifndef stop-on-test-failure > diff --git a/Makefile.help b/Makefile.help > index b49df9c5c9..17e7154797 100644 > --- a/Makefile.help > +++ b/Makefile.help > @@ -33,6 +33,10 @@ test > Note that this will rebuild the test if needed, but will not > rebuild what "make all" would have rebuilt. > > +build-math-static-tests > + Enable extra math tests for static linking. Use like this: > + make test t=3Dmath/test-float-exp10-static build-math-sta= tic-tests=3Dyes > + > -- > Other useful hints: > > diff --git a/math/Makefile b/math/Makefile > index 36024a5039..58e5c070cf 100644 > --- a/math/Makefile > +++ b/math/Makefile > @@ -593,8 +593,10 @@ endif > > libm-vec-tests =3D $(addprefix test-,$(libmvec-tests)) > libm-test-support =3D $(foreach t,$(test-types),libm-test-support-$(t)) > -test-extras +=3D $(libm-test-support) > -extra-test-objs +=3D $(addsuffix .o, $(libm-test-support)) > +libm-test-support-static =3D $(foreach t,$(test-types),libm-test-support= -$(t)-static) > +test-extras +=3D $(libm-test-support) $(libm-test-support-static) > +extra-test-objs +=3D $(addsuffix .o, $(libm-test-support)) \ > + $(addsuffix .o, $(libm-test-support-static)) > libm-vec-test-wrappers =3D $(addsuffix -wrappers, $(libm-vec-tests)) > test-extras +=3D $(libm-vec-test-wrappers) > extra-test-objs +=3D $(addsuffix .o, $(libm-vec-test-wrappers)) > @@ -664,12 +666,10 @@ libm-test-funcs-auto =3D \ > y1 \ > yn \ > # libm-test-funcs-auto > -libm-test-funcs-noauto =3D \ > +libm-test-funcs-noauto-base =3D \ > canonicalize \ > ceil \ > cimag \ > - compat_totalorder \ > - compat_totalordermag \ > conj \ > copysign \ > cproj \ > @@ -740,6 +740,11 @@ libm-test-funcs-noauto =3D \ > trunc \ > ufromfp \ > ufromfpx \ > + # libm-test-funcs-noauto-base > +libm-test-funcs-noauto =3D \ > + $(libm-test-funcs-noauto-base) \ > + compat_totalorder \ > + compat_totalordermag \ > # libm-test-funcs-noauto > libm-test-funcs-compat =3D \ > compat_totalorder \ > @@ -816,6 +821,71 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: li= bm-test%.inc \ > $(make-target-directory) > $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ > > + > +libm-test-funcs-auto-static =3D \ > + $(libm-test-funcs-auto) \ > + # libm-test-funcs-auto-static > +libm-test-funcs-noauto-static =3D \ > + $(libm-test-funcs-noauto-base) \ > + # libm-test-funcs-noauto-static > +libm-test-funcs-narrow-static =3D \ > + $(libm-test-funcs-narrow) \ > + # libm-test-funcs-narrow-static > +libm-test-funcs-all-static =3D $(libm-test-funcs-auto-static) $(libm-tes= t-funcs-noauto-static) > + > +libm-test-c-auto-static =3D $(foreach f,$(libm-test-funcs-auto-static),l= ibm-test-$(f)-static.c) > +libm-test-c-noauto-static =3D $(foreach f,$(libm-test-funcs-noauto-stati= c),libm-test-$(f)-static.c) > +libm-test-c-narrow-static =3D $(foreach f,$(libm-test-funcs-narrow-stati= c),\ > + libm-test-narrow-$(f)-static.c) > +generated +=3D $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $= (libm-test-c-narrow-static) > + > +libm-tests-normal-static =3D $(foreach t,$(libm-tests-base-normal),\ > + $(foreach f,$(libm-test-funcs-all-static)= ,\ > + $(t)-$(f)-static)) > +libm-tests-narrow-static =3D $(foreach t,$(libm-tests-base-narrow-static= ),\ > + $(foreach f,$(libm-test-funcs-narrow-stat= ic),\ > + $(t)-$(f)-static)) > +libm-tests-vector-static =3D $(foreach t,$(libmvec-tests-static),\ > + $(foreach f,$($(t)-funcs),test-$(t)-$(f)-= static)) > +libm-tests-static =3D $(libm-tests-normal-static) $(libm-tests-narrow-st= atic) $(libm-tests-vector-static) > +libm-tests-for-type-static =3D $(foreach f,$(libm-test-funcs-all-static)= ,\ > + test-$(1)-$(f)-static test-i$(1)= -$(f)-static) \ > + $(filter test-$(1)-%,$(libm-tests-vector-sta= tic) \ > + $(libm-tests-narrow-sta= tic)) > + > +libm-tests.o +=3D $(addsuffix .o,$(libm-tests-static)) > + > +ifeq ($(build-math-static-tests),yes) > +tests-static +=3D $(libm-tests-static) > +generated +=3D $(addsuffix .c,$(libm-tests)) \ > + $(foreach t,$(test-types),libm-test-support-$(t)-static.c) > +endif > + > +libm-test-c-auto-obj-static =3D $(addprefix $(objpfx),$(libm-test-c-auto= -static)) > +libm-test-c-noauto-obj-static =3D $(addprefix $(objpfx),$(libm-test-c-no= auto-static)) > +libm-test-c-narrow-obj-static =3D $(addprefix $(objpfx),$(libm-test-c-na= rrow-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$$(sub= st -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$$(sub= st -static,,%).inc \ > + gen-libm-test.py= \ > + auto-libm-test-o= ut$$(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. > @@ -1044,6 +1114,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c):= $(objpfx)test-%.c: > echo "#include "; \ > ) > $@ > > +$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-= %.c: > + type_func=3D$*; \ > + type=3D$${type_func%%-*}; \ > + func=3D$${type_func#*-}; \ > + ( \ > + echo "#include "; \ > + echo "#include "; \ > + echo "#include "; \ > + echo "#include "; \ > + echo "#include "; \ > + ) > $@ > + > $(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c: > type_pair_func=3D$*; \ > type_pair=3D$${type_pair_func%-*}; \ > @@ -1078,6 +1160,13 @@ $(foreach t,$(test-types),\ > echo "#include "; \ > ) > $@ > > +$(foreach t,$(test-types),\ > + $(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test= -support-%.c: > + ( \ > + echo "#include "; \ > + echo "#include "; \ > + ) > $@ > + > $(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h > > define o-iterator-doit > @@ -1087,6 +1176,13 @@ endef > object-suffixes-left :=3D $(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 :=3D $(libm-tests-base) > +include $(o-iterator) > + > define o-iterator-doit > $(foreach f,$(libm-test-funcs-narrow),\ > $(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \ > @@ -1102,6 +1198,13 @@ endef > object-suffixes-left :=3D $(libm-tests-base-normal) > include $(o-iterator) > > +define o-iterator-doit > +$(foreach f,$(libm-test-funcs-all-static),\ > + $(objpfx)$(o)-$(f)-static.o): CFLAGS +=3D $(libm-test-no-inli= ne-cflags) > +endef > +object-suffixes-left :=3D $(libm-tests-base-normal) > +include $(o-iterator) > + > define o-iterator-doit > $(foreach f,$(libm-test-funcs-narrow),\ > $(objpfx)$(o)-$(f).o): CFLAGS +=3D $(libm-test-no-inline-cfla= gs) > @@ -1123,6 +1226,13 @@ endef > object-suffixes-left :=3D $(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 :=3D $(test-types) > +include $(o-iterator) > + > define o-iterator-doit > $(objpfx)libm-test-support-$(o).o: CFLAGS +=3D $(libm-test-no-inline-cfl= ags) > 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.43.0 > LGTM. Reviewed-by: H.J. Lu Thanks. --=20 H.J.