From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by sourceware.org (Postfix) with ESMTPS id 9FF353858D34 for ; Mon, 20 May 2024 16:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FF353858D34 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 9FF353858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716223735; cv=none; b=HWHBUWkbg2X8+Us8yYWsqwyqGO4rtNt0JpvV2wy1VhYsa4JwtG/G6vbZiFOt/wvGZNSWJp0RLeGZH04valt/+Gdq8kIlz3i+SlpPouN5gjcRdTOugWC5jqaF3JV35+VbhpFu2nZ6fbZoGSX0J5WeC5vQfXOHbN+A0ly8LPNsJm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716223735; c=relaxed/simple; bh=YYqu23J20T7t8V7obYx4zI0ReRtveCA74GN3o3F4B0k=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=frda3pF9LhvOI25uWZIzpVveC8FnoJVz1zOxjL+oV9rRNu+FkBrsteqW+yL5nJQwodeweqTdJZl+dxmPvAKR9bYx3OslCFDgdLbdOqVugOMJRwXJ656KawtSnRD/f9zEMyRAx/pn+/VG2PMCvN/EDAIuL/3En41O7qMMXzAErdw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-6277a2bb35fso20446547b3.1 for ; Mon, 20 May 2024 09:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716223732; x=1716828532; 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=sNfA56SOx8PosE9VATMxlx7WFhdv1apSIGvm68JU8XE=; b=S4qVtbJ7nv3VgxDhv9qfeSkxIaFzEB2Kfz5nPGYOij0T6lQniqAPTsjy0ShtcSfwy8 a0AulivajyUKuFkvJTPg5pwaCwgJg6usLczJMqI0buXVGwid8snNkh79hDkQ4HsSDa72 uelEnAKYEBviXTknoTNm7ZMfqPTfe2qByshClh3tz8OiDhSFM4NIQx3TiPvRAuvFIWq8 9y2oT19dBBuaQoF0pl/Wz8ONPGvTBfJZtO6TQX1VZWduZgArPOFrHkUS4483d8wpp03m ttQtFKDvijCX08u53/UmwifBEOiYzIJE3xFRFTXUxBFb4zzB1zKQUO59LMmyKbZUzqzE ybKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716223732; x=1716828532; 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=sNfA56SOx8PosE9VATMxlx7WFhdv1apSIGvm68JU8XE=; b=LiQk+7coyxHPOsFC2/2Bod3ikRSAn4NXj1S95qTtKuAYA29ioBBdzoOoQq/Q4d8Oaz t7lU+Hqp5UTuroB19hWFNngEhJWh9SRF+s7LduEGPeTigrK6PYrIb+iPWECHIk5V0ZmX ygZYctmm6aIMv93Vc8F5XeYxAjzhksvvjlH55HKf0hJk+8d53VgPyCiOtahEnGNz3ejA REg+LioS98626tBbisbECOz9aacjTExmJiZNgDKnlJvuRxsSY6W75uwgcLfiD2DC605b oN6IYv/xEcDRI7rG0dE6xYYCNEXnQIDOZKFy5hgSzv/ReXHOE4EysylhSYHDrxJxo1ZE DS7w== X-Gm-Message-State: AOJu0Yxvft42Z1anv+QBsohN+fsE8oMKAanJLUbKKWYX8NQZONZZn68P ZHv2ZTkoinr/EqK1LiE/lEqiGkHnw5wxzWM4YBmXBemBWhR+ksSlhFi9uphf0FHC5G6PYMJF59i GkK6U1g2yzDawwRMZVh01w6zyN0E= X-Google-Smtp-Source: AGHT+IFXfbkarCngMjWfqZElSC80VOr4CEbeKk2DMbDo8NvrpEHm1g2ykeKFbWt5bZiXbJmGRo//coNLWZ+iXSPLmqE= X-Received: by 2002:a05:690c:6004:b0:61b:e13c:e3f4 with SMTP id 00721157ae682-627971f2c6fmr46504487b3.15.1716223731789; Mon, 20 May 2024 09:48:51 -0700 (PDT) MIME-Version: 1.0 References: <20240402140644.2172819-1-adhemerval.zanella@linaro.org> <20240402140644.2172819-2-adhemerval.zanella@linaro.org> In-Reply-To: <20240402140644.2172819-2-adhemerval.zanella@linaro.org> From: "H.J. Lu" Date: Mon, 20 May 2024 09:48:15 -0700 Message-ID: Subject: Re: [PATCH v3 1/7] math: Add support for auto static math tests To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Joseph Myers , Florian Weimer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3018.9 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, Apr 2, 2024 at 7:06=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 | 113 +++++++++++++++++++++++++++++++++++- > 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, 128 insertions(+), 3 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 85e00cef94..9d287da67b 100644 > --- a/Makeconfig > +++ b/Makeconfig > @@ -742,6 +742,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 79ef4ebb65..98a98d6851 100644 > --- a/math/Makefile > +++ b/math/Makefile > @@ -274,8 +274,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)) > @@ -305,7 +307,7 @@ libm-test-funcs-noauto =3D canonicalize ceil cimag co= nj copysign cproj creal \ > nextup remainder remquo rint round roundeven sca= lb \ > scalbln scalbn setpayload setpayloadsig signbit = \ > significand totalorder totalordermag trunc ufrom= fp \ > - ufromfpx compat_totalorder compat_totalordermag > + ufromfpx Please submit a separate patch to sort Makefile first. > libm-test-funcs-compat =3D compat_totalorder compat_totalordermag > libm-test-funcs-narrow =3D add div fma mul sqrt sub > libm-test-funcs-all =3D $(libm-test-funcs-auto) $(libm-test-funcs-noauto= ) > @@ -364,6 +366,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) \ > + # 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. > @@ -505,6 +572,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%-*}; \ > @@ -539,6 +618,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 > @@ -548,6 +634,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: \ > @@ -563,6 +656,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) > @@ -584,6 +684,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.34.1 > --=20 H.J.