From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 97AB43858D1E for ; Mon, 20 May 2024 17:21:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97AB43858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 97AB43858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716225673; cv=none; b=oB3OwTEgoTpKsNKLoHtqqflNMmF8c0Jom5DVN0R3/MJFeFNe8zld3CGZ+jj6PM583LLfo4sUtogkH3Ut/S2yb6bUqxqi9qjlWPCfHZxNZXbQWIC2nE2rDYetfIXGQYyMB9R7AeeNDExgNOjak3Ic0bAM40i4zab0Q0JKjqhliO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716225673; c=relaxed/simple; bh=luYrsZn8rHkaBXO6mxYw0K64CMDlm7T94/Gem7E3lqU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Q4GCCa8yXYLMZNHv5Xq24HWIUWPSibLr3nfP+ZfZ/kwYHYPe651L/ShxKPebZetVVm0H6vQjMNNuLUh2l4BXzYdC2npC61ZWwFp+E0D35G7rIXbmnIUdjMONPBRO/OuXolvxSMd6SzG9gHKJqLgjoIPSinU9c190QGdieIH0FYA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1ecd3867556so84417915ad.0 for ; Mon, 20 May 2024 10:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716225669; x=1716830469; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=KyGDVjP9QsF/URD/DTIFGBgakLHiSZ04crypGN0hABQ=; b=P9FV/UVanPGHkLu95u5+RWhBbGI808Cz1dPvXQb8f+2A9/DFtHRlTOWHf+Mxm2aKOy DSY8Scgza81TPyqguaUPZBBH/31sPhiUvH6+/8GG/l0AkWl5ZaQV9/uYJuG+Uc/+kyPt u3W/mwrtnCykExCjYfBS5Jf/lea3yoEsTRWxcvLyvGYQqZ5BgKPyX69DcIhaghk1x8r1 b87/2B1tJaMm/che6/9UhxB2pc9e3wkILj07pYqOfbPCjTRGPocMrF4UxjoteZ2zg4PB ZjCCFehxNZhA3OwzkqoYYuMAGt1MEp24TYQOzl8wnFomHsZTNYxEMIJG4FnjVIR+DShO XMEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716225669; x=1716830469; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KyGDVjP9QsF/URD/DTIFGBgakLHiSZ04crypGN0hABQ=; b=nv+QlY3SFHiiMBYvsqk8vYSDJugiP1Ncj3TnnW0MAyxg5Jrs6gM0+kkALt2pTpqnFn msLwN+8FDLYpruR6ZnnpT9T//ZrbEvFl18s0AyXWWnikx/YdDnmG24JgyoOTBrVJmqKv /ugYvk+KCR93+t95WJWbgM7kFfJDhoZ4TI8UOJwW7XoMMxGNjZJhoB85B+W7yyXbJdQ5 h5xFDrHYMDNCPrMaPpx3KtfXgPQE+zypzOohCZTsVCk7lCi7sjJScpBTgEo3BsDr5zn0 a75pfkASrshgrgJKDFi8/JHhkDlxrNLdVjUlPz0Z+ObtPEBOJRX45pAV8n9MoX3KYqz2 1Z4A== X-Gm-Message-State: AOJu0YxCc8qke7fDqDTgWreWcCyJmpr0IrTqV/wTCWpHosWfjltvYftk U5PAiNqQjNmoIKUltIFce4AVCuidDs3pDwRvdDr3afurK6SAAFY8l/offEak2e0= X-Google-Smtp-Source: AGHT+IFfMOrAhzGObS6CkZwVZH/dyZTkfCZ+peaptOZWS9jf+xWxpwvfgqw9BkN1jG51bNJ7wNH1Hg== X-Received: by 2002:a05:6a20:8407:b0:1af:cefe:dbab with SMTP id adf61e73a8af0-1afde0b7168mr29182976637.5.1716225669507; Mon, 20 May 2024 10:21:09 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:f76a:4d8e:551e:8ee4:7221? ([2804:1b3:a7c2:f76a:4d8e:551e:8ee4:7221]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340a632823sm19426691a12.19.2024.05.20.10.21.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 May 2024 10:21:08 -0700 (PDT) Message-ID: <23180d8b-097a-4b25-8fc0-3056350ed240@linaro.org> Date: Mon, 20 May 2024 14:21:03 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/7] math: Add support for auto static math tests To: "H.J. Lu" Cc: libc-alpha@sourceware.org, Joseph Myers , Florian Weimer References: <20240402140644.2172819-1-adhemerval.zanella@linaro.org> <20240402140644.2172819-2-adhemerval.zanella@linaro.org> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 20/05/24 13:48, H.J. Lu wrote: > On Tue, Apr 2, 2024 at 7:06 AM 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 = yes >> endif >> endif >> >> +# Whether to build the static math tests >> +ifndef build-math-static-tests >> +build-math-static-tests = 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=math/test-float-exp10-static build-math-static-tests=yes >> + >> -- >> 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 = $(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)) >> @@ -305,7 +307,7 @@ libm-test-funcs-noauto = canonicalize ceil cimag conj copysign cproj creal \ >> nextup remainder remquo rint round roundeven scalb \ >> scalbln scalbn setpayload setpayloadsig signbit \ >> significand totalorder totalordermag trunc ufromfp \ >> - ufromfpx compat_totalorder compat_totalordermag >> + ufromfpx > > Please submit a separate patch to sort Makefile first. The Makefile is already sorted since c0d59e3e0da12b294b85acf055e6e75b18d8dd2a, I will rebase and send a new version. > >> libm-test-funcs-compat = compat_totalorder compat_totalordermag >> libm-test-funcs-narrow = add div fma mul sqrt sub >> libm-test-funcs-all = $(libm-test-funcs-auto) $(libm-test-funcs-noauto) >> @@ -364,6 +366,71 @@ $(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-auto) \ >> + # libm-test-funcs-auto-static >> +libm-test-funcs-noauto-static = \ >> + $(libm-test-funcs-noauto) \ >> + # libm-test-funcs-noauto-static >> +libm-test-funcs-narrow-static = \ >> + $(libm-test-funcs-narrow) \ >> + # 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)) >> + >> +ifeq ($(build-math-static-tests),yes) >> +tests-static += $(libm-tests-static) >> +generated += $(addsuffix .c,$(libm-tests)) \ >> + $(foreach t,$(test-types),libm-test-support-$(t)-static.c) >> +endif >> + >> +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 +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=$*; \ >> + type=$${type_func%%-*}; \ >> + func=$${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=$*; \ >> type_pair=$${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 := $(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 +656,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 +684,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 >> > >