From patchwork Thu Mar 21 16:43:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=aLxknaPy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0rsZ71Clz1yWs for ; Fri, 22 Mar 2024 03:44:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 011E2385828A for ; Thu, 21 Mar 2024 16:44:49 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 136283858C98 for ; Thu, 21 Mar 2024 16:43:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 136283858C98 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 136283858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039415; cv=none; b=h2ex0Gba2mjvAxqT8HUwLzB4Mz7AJni0xDTNb/XDLGyp769JgQLPCOlG5Z/iTGY8OfDDo7CdJj3I3BiF4kpt9kXSHPIVxr6I7Tyi1s3fF/FJudiWyO9rTGAOrGs9iE6WirzPA66rypGLtNA8Eyw2c6Lqe613qgdX+qgCN+v+bi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039415; c=relaxed/simple; bh=XY0tKeuvo7tc3p8hjVffqitahLb7njr+eLDkKcfVKMI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GchsYw4kaxy3jcDGr1lOPv2gfLyC98vcupAy1aHhNb/LL5FAlV/xO4AKeBgG1DB1XWWLZ+/VlPdhEYK5yc0Ng6CUWjklfUj5opN3XCW4u4WmjeTh5yAkmTFZpaUovFQ5NVfxmJnsohEP3byJHuGOvdI0sy02+Q4tPgbh8BLRvh8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1def2a1aafaso7654185ad.3 for ; Thu, 21 Mar 2024 09:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039411; x=1711644211; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cF1EAoylDooiZ6CDCnSllyd8K0h9cNvw7TN6BBjibUM=; b=aLxknaPyq40+8dvjymvO9dZYYhSDJjNmNrSKexRar/rBnMovmjJbAhcS3yqfQiZnmo ToDz4yLY+mNXP31X98tFGXjUMYl8jHB6zTG7qYegUQzXeiBpdxIeXQ2uJFCVfAgHnWpS Ha/TsAZbVRsMsPBtynzQD1MQumvuP2ctGOOFN7Of0CiNj8jCs54D4d9UVvaGvSl4AqV/ VIncqrIfx5iNSvV1mJs2QOXvc65ta/lL3X+NZtoDb30WtJ1zZFD76eFwpccdxtduQGk2 NgoUoSLgMERcS3CDJ+Q0RQ7b/xvydd+is0d5K7TG72S476ej0uStidsIBoTJ9t5Uo2Qv bNDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039411; x=1711644211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cF1EAoylDooiZ6CDCnSllyd8K0h9cNvw7TN6BBjibUM=; b=Zb41wNJcOJrY3DWFZhnELcXsaUaQDoGIklfEkTaldLm32JXBAyDW8C+aL4kjIEMrFp Xb0vTMJ16+R+1YK1KDPEsB5kOQthuZxLncv5ENiCQ62rYQWM1tJxVBLgzqFkhGa7R9Kk KWvSpLhfz2wskc5y98mIpo/4aqcayZT7q8IKTbVyQ0SraIDW9nOYcQUFry9HUQlitgMO Gpvys74D6QygfBRNMjgYbgHr8qgV5rkvESj+EDIJFkes3GH11Dl5po43uyKH6EaHn6QH Ai5xUXCjiuKrFAbVOJ5zeBkCeEw9oN33sCukE7hSmq7gHi7g7L9me1GGIf5AixPwOZfv b4Jw== X-Gm-Message-State: AOJu0YwxYGXjOn2sa7OYXHgotSA1F5S4AVq49dK5xvBBR7U0qRDnDM7p oYKfHw5ckORck7b3zCSFcq/PBlUwh8HtZZiiLBk/vtgxoYV1SMPNCqA5OBZ4bnTvRSDrOeJejUc b X-Google-Smtp-Source: AGHT+IGmWlgF7AaYRcWA+CRtNWG9PJR/YJnlWJX9enS7p5t+ywMKOW5yXguk3i7+8fEL0fKkNbMjwA== X-Received: by 2002:a17:902:b58b:b0:1dd:6765:103 with SMTP id a11-20020a170902b58b00b001dd67650103mr2535479pls.48.1711039411423; Thu, 21 Mar 2024 09:43:31 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:30 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 1/6] math: Add support for auto static math tests Date: Thu, 21 Mar 2024 13:43:20 -0300 Message-Id: <20240321164325.539976-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.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 "; \ ) > $@ +$(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 +611,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 +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" From patchwork Thu Mar 21 16:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Bclfb37M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0rrh69rKz1yWs for ; Fri, 22 Mar 2024 03:44:04 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A885138582A2 for ; Thu, 21 Mar 2024 16:44:02 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id E2AC43858C24 for ; Thu, 21 Mar 2024 16:43:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2AC43858C24 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 E2AC43858C24 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::629 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039416; cv=none; b=DPWcZWFnRnUdfvhn4+sIgBBv308Ko6vxC9WlCB2wvotxanPJLXHhHd2n+ll+7nJa3ESH4NGBnAnUQMyMQplq1dVpwK1bCmCYoQJYJYjZYX0GOdzBh800B57b1rIDcgrk3F44IRLHBuQbZj9g0X0lIP+aIT9CKazch3EgkfYe4GA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039416; c=relaxed/simple; bh=Q46ZLyNZ2n8Lh1ncNRFk98MiR7FUGUj8Mw68fwgABx4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Z2NhSmOBkPJ323B4CvJCS06WHr1EZOuhCBHgdExlCEV440k2xNTg6hWxQAL6/pzZm93CijzSVt9fvGSnOcVNj5Io05M0HE3VuVKAlVb95HqzhD9m2kkDWDJxxp+xX7TogrHsDlrYB2tcbVLcEHrsafpBZRlLTA6HxqUEgwYQWlE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e00896dfdcso8008095ad.1 for ; Thu, 21 Mar 2024 09:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039413; x=1711644213; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FvSto6S14a2dV6Tyip/F96rta66GZM4uoCiXo2KVAps=; b=Bclfb37MB1JrpBYXlyPrsk1L0pY4tLJJZKgqu2zqtrdpTA79+XHztxZUus2JVhRF62 ZDZp9vTZVI/Yw4J80yfjvoki9uJBgV+eSVxWN8OV3NtWnXee6Hs7NPBwGT38NlGLdIUZ /QGG29THbiy6PLyzUyGadVRep3u/vBoOjwYwu1n+PDGU8uP1yHuSQfs9kmGny6AHoxmr T516tMAiqpxXt9LhYW54SwAzz2QFvvgtyeSS17vi3N9h6yzMF+KSUX1TSfiGx1PTj+Me SLKeCRJ/Ic66GdjLSYrjg0oO6N9cMVmSo3OR/1puK5EmGnxKUxrkUY8CeQTUoeec4ro1 VsUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039413; x=1711644213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FvSto6S14a2dV6Tyip/F96rta66GZM4uoCiXo2KVAps=; b=C4e735wwCQTmU6Bu9hOn9VB8lxir8DwS8OLDXO6EQCnK1RUBBb3DnWBtWl9jEkX6oE nYjSt/MbN40WvUcu/ccJsKV+HD43K00sHBi1vPbeU7xzzPI7LdEMAsJatCUx+i9A9nmB KpZwzIBQkMfgX5UPQQ/kPBWFgQJ9irfOO6aHzTWjU4el0dZbDcfflZseE6EeiAgoOMGx BDQ3zKOGwASyP+ukhUw8insgH/9Og2TjV0rZLCyAxPbQL+mYlEKox5+5vl2bKRHcYmN7 jfuA8HW19d/v4qS1IxQ15fYQDFvyFpKlNPMXdOu+94Zro80VeghFvDyjqpjx6ki711rm lUfg== X-Gm-Message-State: AOJu0YyOb2HzUNfN67rs11mJEqXEjVVryf5CsLWZxSIcEbifh9Or0wbJ 47MxpSDOiBeY+9GSvyK96a7NrJvK90pyqIjePMfT9M1ZRfUDCStHGdMul9bbaupx6n0Ik5VOJeB C X-Google-Smtp-Source: AGHT+IFfVEUr66xS4cBJ4RYFZIcLb2s4bhPcuPBKLdBNAIRuzFVAiNG0EW0FZcpyrbnlGIr/VFf85w== X-Received: by 2002:a17:902:70c2:b0:1e0:e35:add1 with SMTP id l2-20020a17090270c200b001e00e35add1mr9489125plt.31.1711039413241; Thu, 21 Mar 2024 09:43:33 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:32 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 2/6] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Date: Thu, 21 Mar 2024 13:43:21 -0300 Message-Id: <20240321164325.539976-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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, KAM_SHORT, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The commit 16439f419b removed the static fmod/fmodf on i386 and m68k with and empty w_fmod.c (required for the ABIs that uses the newly implementation). This patch fixes by adding the required symbols on the arch-specific w_fmod{f}_compat.c implementation. To statically build fmod fails on some ABI (alpha, s390, sparc) because it does not export the ldexpf128, this is also fixed by this patch. Checked on i686-linux-gnu and with a build for m68k-linux-gnu. I also checked that a stack build using fmod/fmodf correctly resolves on both ABIs. --- math/Makefile | 4 +++- sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++--- sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++--- sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 ++-- sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++-- sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++--- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/math/Makefile b/math/Makefile index aef9cec1a1..fbb2987248 100644 --- a/math/Makefile +++ b/math/Makefile @@ -368,7 +368,9 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ libm-test-funcs-auto-static = -libm-test-funcs-noauto-static = +libm-test-funcs-noauto-static = \ + fmod \ + # 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) diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c index 5ac9995ffd..528bfc2a13 100644 --- a/sysdeps/i386/fpu/w_fmod_compat.c +++ b/sysdeps/i386/fpu/w_fmod_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_double (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c index cc417e07d3..5a61693e51 100644 --- a/sysdeps/i386/fpu/w_fmodf_compat.c +++ b/sysdeps/i386/fpu/w_fmodf_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_float (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c index 1afbe7d8ad..932cc4341c 100644 --- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c +++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c @@ -17,13 +17,13 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED # define declare_mgen_alias(f,t) #endif #include #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED long_double_symbol (libc, __ldexpl, ldexpl); long_double_symbol (libc, __wrap_scalbnl, scalbnl); #endif diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c index 527d4fbed2..57f38091e6 100644 --- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif #include -#ifdef SHARED libm_alias_double (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c index 5043586b91..88db07f443 100644 --- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_float (__fmod_compat, fmod) +#else +#include +#include #endif From patchwork Thu Mar 21 16:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=uDT2RemO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0s1V05YMz23r9 for ; Fri, 22 Mar 2024 03:51:41 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF09D385840E for ; Thu, 21 Mar 2024 16:51:39 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 3BEF93858C98 for ; Thu, 21 Mar 2024 16:51:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3BEF93858C98 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 3BEF93858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::82d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039887; cv=none; b=Im+A7VYoLgjL9EvHYQ8oLcksIxV6/BVID6ND3LnHKv1IP1IiPUZXL9TpiyXh0shAtPrXEJnCzz+R9xLV6xGlEcb3VxDu7bzymmERbssFb55jLYN6Ruk9Ugdp3WAiosbZFOrOzjtWOFS0QFyNmMVNLPgzd14J/gaRkWrszBz+c9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039887; c=relaxed/simple; bh=FWgJkfkwseYq7F5C+DGVquhkJLx5vPNk1M7TtjMJhC8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=hmRJ3WFnP39Jx/A0XcJdqmXkG6kWsX/nQ9ZsqKca8BOKLW1v/vZ1RAW4fYbOCqSuVkaMZGxn+vGHbqLQW246FRx4/3TGRBtWLa1yaxHFAcF6kC/+IC0TCBvU9Ts3P+jOQ+7KynkE0iQzSGsbxcjFBlWAIqQV8gyYjCRT7YzJwFo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-430a65e973bso7221791cf.3 for ; Thu, 21 Mar 2024 09:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039883; x=1711644683; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dcR2ma1WvOPlvqy70XySXYoVacImk32cK9Z3i7CYpHc=; b=uDT2RemO7ZzRsGSOFZR2jpLLrx4B2+c+iUAvPUCI3JnQ3WFywA1P6e54KXGGbAU9KV yoS2x3ObfoDspdX0Vh/uA/7AqqvUIrB94Mb73V5X3i4zIElswnblOIm7mNSQ25o0qyvC n9PxZINVAWkyPuiLUMu8xNJPwzbdFybO5bIkMpE5JzvnoLyt6p/ntsWlsrEpoNTnOUU2 f0CJpcKY9DfS0XNZOC7wpzOr4/W0zYZWIYVh+ik3hJEwmE8oj6Dr4PTCkdVr/xH58Tvl B9OLImxRPg4xYVUW3knlqEK3XL9dxL0FnDHMyB+Yp3O2+YRKtcgkv7d79Zv9++jfVW+5 MsUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039883; x=1711644683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dcR2ma1WvOPlvqy70XySXYoVacImk32cK9Z3i7CYpHc=; b=nCJumEKRnohEOUJzOn4BLWWr7a+2xgS91Ea0vQDfnUrAOygV0qnDvxJ88hN3IYoprY ZrkfHA/W1fC1C/8FFF5UuX49d3Mnpq1c9iEri7LOwk4toGPtY59TXHlYSb8NAXhiB4po aC7YbDgcq91OU3hs/tem5zSkWkUsVJ/ugWGi6xvHVYyVJH5DkHJUE7KcpEqmfulglII7 mh9QrSFxkKxBjLxcFIDOeusllU059T/uPtjGq3SDqQHbjqA/gkP39N5rSFIHTXHVxdth uEX3CZGv9dJ/TLzSAodCel3x4abYub9GkughYxRBIs3sktJAuHUXcNVjeHG/7aA4NZsa zdDQ== X-Gm-Message-State: AOJu0YxAms2WFqnQPj3MC4CMbsQLLAnnzogKI5cKvPkB42Ghnq/aH2H5 KTem5/h9uHLe1VJ6t72XlRzs4eeH/sta6Wv/9oOvK2b/Ji25D65BrgWXHxDGQXCrgmtRCdhzTOK G X-Google-Smtp-Source: AGHT+IH1Ggr1xv/7JbBaJMRqG+V0FQ2LSlM6+bFuAaW642J9i/wFijuGWIm03GiZlc9T1OVNwrv1Zw== X-Received: by 2002:a05:6a20:a88a:b0:1a3:6194:aa2b with SMTP id ca10-20020a056a20a88a00b001a36194aa2bmr48144pzb.23.1711039415007; Thu, 21 Mar 2024 09:43:35 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:34 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 3/6] i386: Use generic fmod Date: Thu, 21 Mar 2024 13:43:22 -0300 Message-Id: <20240321164325.539976-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The benchtest results shows a slight improvement (Ryzen 5900, gcc 13.2.1): * sysdeps/i386/fpu/e_fmod.S: "fmod": { "subnormals": { "duration": 3.68855e+09, "iterations": 2.12608e+08, "max": 62.012, "min": 16.798, "mean": 17.349 }, "normal": { "duration": 3.88459e+09, "iterations": 7.168e+06, "max": 2879.12, "min": 16.909, "mean": 541.934 }, "close-exponents": { "duration": 3.692e+09, "iterations": 1.96608e+08, "max": 66.452, "min": 16.835, "mean": 18.7785 } } * generic "fmod": { "subnormals": { "duration": 3.68645e+09, "iterations": 2.2848e+08, "max": 66.896, "min": 15.91, "mean": 16.1347 }, "normal": { "duration": 4.1455e+09, "iterations": 8.192e+06, "max": 3376.18, "min": 15.873, "mean": 506.043 }, "close-exponents": { "duration": 3.70197e+09, "iterations": 2.08896e+08, "max": 69.597, "min": 15.947, "mean": 17.7216 } } --- sysdeps/i386/fpu/Versions | 4 ++++ sysdeps/i386/fpu/e_fmod.S | 18 ------------------ sysdeps/i386/fpu/e_fmod.c | 2 ++ sysdeps/i386/fpu/math_err.c | 1 - sysdeps/i386/fpu/w_fmod_compat.c | 15 --------------- sysdeps/ieee754/dbl-64/e_fmod.c | 5 ++++- sysdeps/mach/hurd/i386/libm.abilist | 1 + sysdeps/unix/sysv/linux/i386/libm.abilist | 1 + 8 files changed, 12 insertions(+), 35 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_fmod.S create mode 100644 sysdeps/i386/fpu/e_fmod.c delete mode 100644 sysdeps/i386/fpu/math_err.c delete mode 100644 sysdeps/i386/fpu/w_fmod_compat.c diff --git a/sysdeps/i386/fpu/Versions b/sysdeps/i386/fpu/Versions index a2eec371f1..d37bc1eae6 100644 --- a/sysdeps/i386/fpu/Versions +++ b/sysdeps/i386/fpu/Versions @@ -3,4 +3,8 @@ libm { # functions used in inline functions or macros __expl; __expm1l; } + GLIBC_2.40 { + # No SVID compatible error handling. + fmod; + } } diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S deleted file mode 100644 index 86ac1bcfaf..0000000000 --- a/sysdeps/i386/fpu/e_fmod.S +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - -ENTRY(__ieee754_fmod) - fldl 12(%esp) - fldl 4(%esp) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_fmod) -libm_alias_finite (__ieee754_fmod, __fmod) diff --git a/sysdeps/i386/fpu/e_fmod.c b/sysdeps/i386/fpu/e_fmod.c new file mode 100644 index 0000000000..3625758f97 --- /dev/null +++ b/sysdeps/i386/fpu/e_fmod.c @@ -0,0 +1,2 @@ +#define FMOD_VERSION GLIBC_2_40 +#include diff --git a/sysdeps/i386/fpu/math_err.c b/sysdeps/i386/fpu/math_err.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/math_err.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c deleted file mode 100644 index 528bfc2a13..0000000000 --- a/sysdeps/i386/fpu/w_fmod_compat.c +++ /dev/null @@ -1,15 +0,0 @@ -/* i386 provides an optimized __ieee752_fmod. */ -#include -#ifdef SHARED -# undef SHLIB_COMPAT -# define SHLIB_COMPAT(a, b, c) 1 -# undef LIBM_SVID_COMPAT -# define LIBM_SVID_COMPAT 1 -# undef compat_symbol -# define compat_symbol(a, b, c, d) -# include -libm_alias_double (__fmod_compat, fmod) -#else -#include -#include -#endif diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c index b33cfb1223..7651cd212a 100644 --- a/sysdeps/ieee754/dbl-64/e_fmod.c +++ b/sysdeps/ieee754/dbl-64/e_fmod.c @@ -175,7 +175,10 @@ __fmod (double x, double y) strong_alias (__fmod, __ieee754_fmod) libm_alias_finite (__ieee754_fmod, __fmod) #if LIBM_SVID_COMPAT -versioned_symbol (libm, __fmod, fmod, GLIBC_2_38); +# ifndef FMOD_VERSION +# define FMOD_VERSION GLIBC_2_38 +# endif +versioned_symbol (libm, __fmod, fmod, FMOD_VERSION); libm_alias_double_other (__fmod, fmod) #else libm_alias_double (__fmod, fmod) diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist index 8f40ddb150..30665f8b1a 100644 --- a/sysdeps/mach/hurd/i386/libm.abilist +++ b/sysdeps/mach/hurd/i386/libm.abilist @@ -1181,3 +1181,4 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 fmod F diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist index 5d89aaa08e..44932f111d 100644 --- a/sysdeps/unix/sysv/linux/i386/libm.abilist +++ b/sysdeps/unix/sysv/linux/i386/libm.abilist @@ -1188,3 +1188,4 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 fmod F From patchwork Thu Mar 21 16:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Q5+1zYAL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0rtB1zd6z1yWy for ; Fri, 22 Mar 2024 03:45:22 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B7393858417 for ; Thu, 21 Mar 2024 16:45:20 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 64A763858418 for ; Thu, 21 Mar 2024 16:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 64A763858418 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 64A763858418 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=1711039420; cv=none; b=Eft1F0lMMsARy8//p/qgcJI7W8dFnuOo5yWmjZqq80pLMfBRk1/3OfQeYn8wg22bw7+18pz/AKkzK8vqVFobeiQMBz1GT1rFOCf2rGLT7m4nUyWU3T+/fJkRZ500lVowiz2jCqyktNORsTaDGauQftkqs79IvYzAHhCQspo9NMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039420; c=relaxed/simple; bh=Lj4xaog2tdjPc2qDBaWYQmFkmaPXpB5xrXtcNLqjTv8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=LQNZJjTaWnGuhy7+vCWU3l/6hOxs5MDFBl7HGCyCwPdOr5x0t3ATOFnE9EtZz7nWMjAxjKE/4B+0CfvvBScwPzAwo0oAbQsNdS5ji3G7euTMHzuK6ywi9lMyA6+9w5ynaPJqxk4A1P7dl+nMwKVMmY4Gj++8y57lvB7fCFvQRzI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1dca3951ad9so7577005ad.3 for ; Thu, 21 Mar 2024 09:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039417; x=1711644217; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xxVrNOvOe0mPi/BVXSb7kTUlPxIfJx2Q3Oom6CeE+A8=; b=Q5+1zYALq6QipDN73ADbbDOSj8cTvb7hSD7m5uU6v7ZPpOcxWBjaQc5rl5ACmPtQGH BAXedv0adqVlnknuI1651Mb6rh8REN/5skgspRqYXiThXzFfH7kYXyHTQayrxxdPnqf+ y/BszIJ8+eT9KzCMcnBClup1lEBEha6B9HvXmhmkrNntTAVqpTQV/qYOFzoBxNOQD1A7 P/K4KFekwgOGDvpYPoJqWY38h5I9/7EhXDRXLBY/wLG8G4WcwXp3sFiEBSoW5RyySMFv qBTxS9KS0u0R6gPY44IvzqaEC71OiHg3IPkuYMuXn0E7vhXGFcQmFjOGUo7Fm+AK3QSI xPNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039417; x=1711644217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xxVrNOvOe0mPi/BVXSb7kTUlPxIfJx2Q3Oom6CeE+A8=; b=MfcbdQlNb9iKirsOjwOF+2LFHZwmiNUHZZtu4gKvuUZIrHvfjmgU61FKw+LymcUAZ6 uFSlwf8C9QfOxPd/jny5IcERdaLT4yy247+bZso0ouwx3OYHhssW9g7s0foqLhyyfqkq WnJ8wr8pQKHpp+wHpMavcWoZ/GmOmJkwRIh2E002v33CQVR77GXgnCYAb+q2BSxZ0MV/ 6EnXCkOxEFY6BqJ29sWIEFYvlqu55MGuaNuRPgZ3GalHBp6uod9yAf74K6fTDz0rWlru tyMHFRAq6AO4DUhbNokm/sku8F2xBX2gwUAbuHPMQKt4fJpLhfWBPQ8nGFHx9ZMyYNyp 37Fg== X-Gm-Message-State: AOJu0YxRyIQsMHjzZrRlBb0KFx4gNP5pYSYBV6P/a+GIEugVkhD6KWE9 MVuFP55n3M4xnQDFCGxKJ1bG6N2KDaHHTf9eIkssG1OQWp1K3GZgU8+Zh2UKetSksgiEvNskj70 o X-Google-Smtp-Source: AGHT+IEKVjPwggYWpzoT6f9gXOiMdBHZqKM7RSWPUZ4I8N0E6yfp/YUrH3fv2ziPLnjLwt65wvQ74A== X-Received: by 2002:a17:902:9895:b0:1e0:1f59:d672 with SMTP id s21-20020a170902989500b001e01f59d672mr8251988plp.36.1711039416758; Thu, 21 Mar 2024 09:43:36 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:36 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 4/6] i386: Use generic fmodf Date: Thu, 21 Mar 2024 13:43:23 -0300 Message-Id: <20240321164325.539976-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The resulting performance is similiar (Ryzen 5900, gcc 13.2.1): * sysdeps/i386/fpu/e_fmodf.S "fmodf": { "subnormals": { "duration": 3.68732e+09, "iterations": 2.2912e+08, "max": 71.447, "min": 15.836, "mean": 16.0934 }, "normal": { "duration": 3.75848e+09, "iterations": 5.5296e+07, "max": 273.208, "min": 15.725, "mean": 67.9702 }, "close-exponents": { "duration": 3.69035e+09, "iterations": 2.07872e+08, "max": 64.454, "min": 15.762, "mean": 17.753 } } * master "fmodf": { "subnormals": { "duration": 3.6863e+09, "iterations": 2.23616e+08, "max": 65.453, "min": 16.243, "mean": 16.485 }, "normal": { "duration": 3.71129e+09, "iterations": 5.3248e+07, "max": 281.57, "min": 16.169, "mean": 69.6983 }, "close-exponents": { "duration": 3.70274e+09, "iterations": 2.03776e+08, "max": 81.474, "min": 16.206, "mean": 18.1706 } } --- sysdeps/i386/fpu/Versions | 2 +- sysdeps/i386/fpu/e_fmodf.S | 18 ------------------ sysdeps/i386/fpu/e_fmodf.c | 2 ++ sysdeps/i386/fpu/w_fmodf_compat.c | 15 --------------- sysdeps/ieee754/flt-32/e_fmodf.c | 5 ++++- sysdeps/mach/hurd/i386/libm.abilist | 1 + sysdeps/unix/sysv/linux/i386/libm.abilist | 1 + 7 files changed, 9 insertions(+), 35 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_fmodf.S create mode 100644 sysdeps/i386/fpu/e_fmodf.c delete mode 100644 sysdeps/i386/fpu/w_fmodf_compat.c diff --git a/sysdeps/i386/fpu/Versions b/sysdeps/i386/fpu/Versions index d37bc1eae6..9509f9b7c7 100644 --- a/sysdeps/i386/fpu/Versions +++ b/sysdeps/i386/fpu/Versions @@ -5,6 +5,6 @@ libm { } GLIBC_2.40 { # No SVID compatible error handling. - fmod; + fmod; fmodf; } } diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S deleted file mode 100644 index f73ce9da1e..0000000000 --- a/sysdeps/i386/fpu/e_fmodf.S +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - -ENTRY(__ieee754_fmodf) - flds 8(%esp) - flds 4(%esp) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END(__ieee754_fmodf) -libm_alias_finite (__ieee754_fmodf, __fmodf) diff --git a/sysdeps/i386/fpu/e_fmodf.c b/sysdeps/i386/fpu/e_fmodf.c new file mode 100644 index 0000000000..15a0f960bf --- /dev/null +++ b/sysdeps/i386/fpu/e_fmodf.c @@ -0,0 +1,2 @@ +#define FMODF_VERSION GLIBC_2_40 +#include diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c deleted file mode 100644 index 5a61693e51..0000000000 --- a/sysdeps/i386/fpu/w_fmodf_compat.c +++ /dev/null @@ -1,15 +0,0 @@ -/* i386 provides an optimized __ieee752_fmodf. */ -#include -#ifdef SHARED -# undef SHLIB_COMPAT -# define SHLIB_COMPAT(a, b, c) 1 -# undef LIBM_SVID_COMPAT -# define LIBM_SVID_COMPAT 1 -# undef compat_symbol -# define compat_symbol(a, b, c, d) -# include -libm_alias_float (__fmod_compat, fmod) -#else -#include -#include -#endif diff --git a/sysdeps/ieee754/flt-32/e_fmodf.c b/sysdeps/ieee754/flt-32/e_fmodf.c index ef95c05800..78071df756 100644 --- a/sysdeps/ieee754/flt-32/e_fmodf.c +++ b/sysdeps/ieee754/flt-32/e_fmodf.c @@ -173,7 +173,10 @@ __fmodf (float x, float y) } strong_alias (__fmodf, __ieee754_fmodf) #if LIBM_SVID_COMPAT -versioned_symbol (libm, __fmodf, fmodf, GLIBC_2_38); +# ifndef FMODF_VERSION +# define FMODF_VERSION GLIBC_2_38 +# endif +versioned_symbol (libm, __fmodf, fmodf, FMODF_VERSION); libm_alias_float_other (__fmod, fmod) #else libm_alias_float (__fmod, fmod) diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist index 30665f8b1a..88e7538e51 100644 --- a/sysdeps/mach/hurd/i386/libm.abilist +++ b/sysdeps/mach/hurd/i386/libm.abilist @@ -1182,3 +1182,4 @@ GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F GLIBC_2.40 fmod F +GLIBC_2.40 fmodf F diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist index 44932f111d..c99c60161d 100644 --- a/sysdeps/unix/sysv/linux/i386/libm.abilist +++ b/sysdeps/unix/sysv/linux/i386/libm.abilist @@ -1189,3 +1189,4 @@ GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F GLIBC_2.40 fmod F +GLIBC_2.40 fmodf F From patchwork Thu Mar 21 16:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=b17HIu89; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0rs334Wzz1yWs for ; Fri, 22 Mar 2024 03:44:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B668A38582A4 for ; Thu, 21 Mar 2024 16:44:20 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id EE206385841F for ; Thu, 21 Mar 2024 16:43:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE206385841F 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 EE206385841F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039422; cv=none; b=xM5cpnDrQdnfnAqAGZkUFfdy2ZqPzD+EuIOGq36+aSssj0vBCdJijlGm5QG1drdngQnzx4E7e1rKkP3rkzOE0GdVVdUGW/e5IO9oIUcObjn1FaULPXM+EZFTxp5BskcycMegYgEg6IcdZtjkSRRr2I9GxvB5x5TuNzfWGY1b0hw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039422; c=relaxed/simple; bh=D5RkfMc+vM701YUxI3GyXr+K6rzdCFue+1AsrrvFWFQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=XZKUC4N/Faolc63cX6RfRJRrzJZ5Etn1EOSUrRxufqiLeS4un5ridv7n5UZYeot43hu3Qf/tWKBmfsGaQGLBmagByh//5MRQj/cej4XezlHmekQvb9yM7H7psUlwJhXyWMXSe4b1lEOlB5Hgn9ws2VtJM7JKvJOBA6h1TqZAdi0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e07cd7b798so4884375ad.2 for ; Thu, 21 Mar 2024 09:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039418; x=1711644218; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ldGWTj5wNhEbNrMUzXACqwvCJbDUonQwXMVVQbV75Gk=; b=b17HIu89wA0trZCk+Vw/6h3DRfhiGkzyR93SAqZVJNUL6G5m9mQWzm4i9oBsrz+25I bHaBNatUOiZEwJK9Yxp+TQypF0y0ioKRgwZ7wSOOxZWMPq/bzlCxRs8Xdgc+/Q6VXWfU 2Kf51ZUqOLM0dYsZUqQnYICr0RNk7czSX+8wHtfj5/75pswqGdbUIKpuGpjpZsJyCtwq hxDPzU5xfu58QmGrD3waiurCHoOjn3F8wFBP4OtVHDxrtlS104/Ehe9e5j4oLitWDu2j DkSu2d+hlQkgcLjzm/TZacDocHnMWhPpkwc1hjQ8OfQHWQrThzO5LwlssUz8zBv0LuQU VjZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039418; x=1711644218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ldGWTj5wNhEbNrMUzXACqwvCJbDUonQwXMVVQbV75Gk=; b=YRNPvbH14Nw8n0VY8P9O8bueq4ff43YxiUBXwu74oeBfsK/K6eYKSqANYKrBYL8yl2 SryNMdavhHNtwgQpUcqUSZHftBJZD0hR4l6GozWkJY6dx2p4M91GrlJvmxXW4loDh5BL JSgV2cdvdhz1S8HBe/8w1kyO8EE/TKfbRphrZm5yUm/zPg65epdfJwsj8cuZTFTFZImx bsvKDhBS0YxFNsWTyFa/iO3oeI3b8867xmAi6xNFS5PYhe6sX+HBCPk5h5iv/C9XIyEP zani7wn+n4iGrOMHAZrFoPHL8OHj1UQhbOnJMi0ltTRYV6mqqh6hHNoWsHIAKci/BNkZ qmvQ== X-Gm-Message-State: AOJu0YwlGXqc0Btxm4h2+HZqVLTEOcic4VmJU7oWOjtXp6u1wQEytG5U Xi2i5+wGDhvrMvPqPDbwAuURYlH4FGA5LzPyFui0y3kRIlUEG4qd12LsTVX8NLl+zORyEVQlMaK S X-Google-Smtp-Source: AGHT+IHVuGzbFAcOaLoKd4eb9NyNN5n8hWCYNobGm0OEhEFMYK6FxPMEKDY/7OQENR6TwZvwg2pTuQ== X-Received: by 2002:a17:902:dacf:b0:1e0:26ac:8234 with SMTP id q15-20020a170902dacf00b001e026ac8234mr3205139plx.18.1711039418537; Thu, 21 Mar 2024 09:43:38 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:37 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 5/6] math: Fix i386 and m68k exp10 on static build Date: Thu, 21 Mar 2024 13:43:24 -0300 Message-Id: <20240321164325.539976-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The commit 08ddd26814 removed the static exp10 on i386 and m68k with and empty w_exp10.c (required for the ABIs that uses the newly implementation). This patch fixes by adding the required symbols on the arch-specific w_exp{f}_compat.c implementation. Checked on i686-linux-gnu and with a build for m68k-linux-gnu. --- math/Makefile | 4 +++- sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++-- sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/math/Makefile b/math/Makefile index fbb2987248..ad7fd25995 100644 --- a/math/Makefile +++ b/math/Makefile @@ -367,7 +367,9 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ -libm-test-funcs-auto-static = +libm-test-funcs-auto-static = \ + exp10 \ + # libm-test-funcs-auto-static libm-test-funcs-noauto-static = \ fmod \ # libm-test-funcs-noauto-static diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c index b53455386e..49a0e03385 100644 --- a/sysdeps/i386/fpu/w_exp10_compat.c +++ b/sysdeps/i386/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* i386 provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include +#else +# include +# include +#endif diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c index 0d3e718626..350f2e4b4d 100644 --- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* m68k provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include +#else +# include +# include +#endif From patchwork Thu Mar 21 16:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1914558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=R48UEGDl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0rtp3lmZz1yWy for ; Fri, 22 Mar 2024 03:45:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87E55385841C for ; Thu, 21 Mar 2024 16:45:52 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 05BD63858430 for ; Thu, 21 Mar 2024 16:43:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05BD63858430 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 05BD63858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039425; cv=none; b=hGLhDTZi2+JPBPgf+GRE815DaB/uJ5+HELvfFTNLWsUOigFP47rS4/866U55R6AC/DAFx/vObM0Pl4Ou2qD20QVU2K1HUJC+Z/4W/XGx48SKoiNuiINEm8FqrEvMPnzYvWF7/v0zERwF3CgbmxdeMgig8EXtxl9oK8bBsTkzuwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711039425; c=relaxed/simple; bh=7lsd+JEB6OXhLwzIRmgXKA+7kg76cGxq/9jNxZ2FcCw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Yo9kWde3+Xcg6Dwqp+PsXopgmcIyTdujgOd/Gyuq/Ro+hhMkYVduYuv+uNqIHblYFd2kWOkj40QT26LyNBSy8d4kz/Hy1V2UwLxm0H9JJqmJ0XCfT9fDzDw7c7wbgm2rgmtSDFq1vym+IuhiN5+1utcTrdytqLur0THE8SH1rBU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e034607879so8996125ad.0 for ; Thu, 21 Mar 2024 09:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711039420; x=1711644220; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3gTSKqePJhhgVkKF2Oni/s3e8N6TubY4O/UTslyMKiM=; b=R48UEGDlIuS64ZoilywrJbjD4Yp6I2/pAJylOfcGtIBgjFjBXF3zED5OH51vgcuxvV e04tX8SIioOQYgZc6Et72kusRcONHbf2e9lpu+qu/l8X90Jn/l3ONJbNkAJZ1WT7d0wD gR6nBUy3RYn7NVHDbu0CSgAbsE/l2cxaas7YZ5+qtkBWf8hOP7h7GC5EOkiVfW2EWxP+ Br1TuInZj2wRXVLDbzzevkDjRNBYyPFIJVEqpDhXJtdDalIp1SJXx4cH3ZzI/JsEczO0 gRwf4o/d6ipF7QC3Wt4K3hnkOLtInGQWn4tTLI3TgIQb4dsvZsvpMsaeOtZ55fiDundJ /6Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039420; x=1711644220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3gTSKqePJhhgVkKF2Oni/s3e8N6TubY4O/UTslyMKiM=; b=xK7HKApUYKhCAMpuXvzDII6BanG8840MNsW9Nzxn2h9aUjAHEHL/ayXnmgCOSilTHN d+dN4nAxaqRcTSfKYkkD1BK5buco5jciFjT169ZWzyIMgJWgQh9vKcXogC8V2jzw7shj qbY0M1WNzeDrRL0jolAM0R/jMdGgtzJyujHwrvBxLPqHdiriqwHUG6PHBMJsLZZLvAOa oYin55y4dSPeOOktyKrNBInw+HbgeQARKskot3izkE6uFJkM0A53t6jNviuq0RfpcCVy tHqCHioteK2BOhHro9QnNrAfd1fobqajAPy6kdp0xh2XK7HEYRk+D4kAouuuGJzvdSAU wKhQ== X-Gm-Message-State: AOJu0YxE+J3L3ALZBXmWG1at6Dx32XM55NFxJ6GamUkXb0RrCFwo2Igm PVOBLn1euepGfuuXm3Or0hdGO+QyoS0+fCBqXFBU/Gxuw5vDs107a7kPJDq/6Fjtp1BMu1uG4uh H X-Google-Smtp-Source: AGHT+IFKQxzVvmvLAqv4o12s+14aLEOk/F1pJubckE4gSORDDhxG8x9jmB197ZTAGNeUza4fIJCzJA== X-Received: by 2002:a17:903:447:b0:1e0:1a69:b000 with SMTP id iw7-20020a170903044700b001e01a69b000mr7727177plb.46.1711039420260; Thu, 21 Mar 2024 09:43:40 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:1d04:42cc:aea4:27d6:375f]) by smtp.gmail.com with ESMTPSA id q1-20020a170902bd8100b001dd75d4b408sm18074pls.302.2024.03.21.09.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:43:39 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 6/6] i386: Use generic exp10 Date: Thu, 21 Mar 2024 13:43:25 -0300 Message-Id: <20240321164325.539976-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org> References: <20240321164325.539976-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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, KAM_NUMSUBJECT, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The resulting performance is slight better (Ryzen 5900, gcc 13.2.1): * master "exp10": { "": { "duration": 3.70091e+09, "iterations": 5.8534e+07, "max": 91.279, "min": 62.6225, "mean": 63.2267 } } * patch "exp10": { "": { "duration": 3.70793e+09, "iterations": 6.328e+07, "max": 259.592, "min": 52.1145, "mean": 58.5957 } } Checked on i686-linux-gnu. --- sysdeps/i386/fpu/Versions | 1 + sysdeps/i386/fpu/e_exp10.S | 51 ----------------------- sysdeps/i386/fpu/e_exp10.c | 2 + sysdeps/i386/fpu/e_exp_data.c | 1 - sysdeps/i386/fpu/w_exp10_compat.c | 8 ---- sysdeps/ieee754/dbl-64/e_exp10.c | 7 +++- sysdeps/mach/hurd/i386/libm.abilist | 1 + sysdeps/unix/sysv/linux/i386/libm.abilist | 1 + 8 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_exp10.S create mode 100644 sysdeps/i386/fpu/e_exp10.c delete mode 100644 sysdeps/i386/fpu/e_exp_data.c delete mode 100644 sysdeps/i386/fpu/w_exp10_compat.c diff --git a/sysdeps/i386/fpu/Versions b/sysdeps/i386/fpu/Versions index 9509f9b7c7..7326f25583 100644 --- a/sysdeps/i386/fpu/Versions +++ b/sysdeps/i386/fpu/Versions @@ -5,6 +5,7 @@ libm { } GLIBC_2.40 { # No SVID compatible error handling. + exp10; fmod; fmodf; } } diff --git a/sysdeps/i386/fpu/e_exp10.S b/sysdeps/i386/fpu/e_exp10.S deleted file mode 100644 index 902f70b77f..0000000000 --- a/sysdeps/i386/fpu/e_exp10.S +++ /dev/null @@ -1,51 +0,0 @@ - -#include -#include -#include - -DEFINE_DBL_MIN - -#ifdef PIC -# define MO(op) op##@GOTOFF(%ecx) -#else -# define MO(op) op -#endif - - .text -/* 10^x = 2^(x * log2(10)) */ -ENTRY(__ieee754_exp10) -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - fldl 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2t - fmulp /* x * log2(10) */ - fld %st - frndint /* int(x * log2(10)) */ - fsubr %st,%st(1) /* fract(x * log2(10)) */ - fxch - f2xm1 /* 2^(fract(x * log2(10))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(10))) */ - fscale /* e^x */ - fstp %st(1) - DBL_NARROW_EVAL_UFLOW_NONNEG_NAN - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp10) -libm_alias_finite (__ieee754_exp10, __exp10) diff --git a/sysdeps/i386/fpu/e_exp10.c b/sysdeps/i386/fpu/e_exp10.c new file mode 100644 index 0000000000..340254fc6e --- /dev/null +++ b/sysdeps/i386/fpu/e_exp10.c @@ -0,0 +1,2 @@ +#define EXP10_VERSION GLIBC_2_40 +#include diff --git a/sysdeps/i386/fpu/e_exp_data.c b/sysdeps/i386/fpu/e_exp_data.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/e_exp_data.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c deleted file mode 100644 index 49a0e03385..0000000000 --- a/sysdeps/i386/fpu/w_exp10_compat.c +++ /dev/null @@ -1,8 +0,0 @@ -/* i386 provides an optimized __ieee754_exp10. */ -#ifdef SHARED -# define NO_COMPAT_NEEDED 1 -# include -#else -# include -# include -#endif diff --git a/sysdeps/ieee754/dbl-64/e_exp10.c b/sysdeps/ieee754/dbl-64/e_exp10.c index 225fc74c4c..c63b852f72 100644 --- a/sysdeps/ieee754/dbl-64/e_exp10.c +++ b/sysdeps/ieee754/dbl-64/e_exp10.c @@ -99,7 +99,7 @@ __exp10 (double x) /* Reduce x: z = x * N / log10(2), k = round(z). */ double_t z = __exp_data.invlog10_2N * x; - double_t kd; + double kd; int64_t ki; #if TOINT_INTRINSICS kd = roundtoint (z); @@ -147,7 +147,10 @@ __exp10 (double x) strong_alias (__exp10, __ieee754_exp10) libm_alias_finite (__ieee754_exp10, __exp10) #if LIBM_SVID_COMPAT -versioned_symbol (libm, __exp10, exp10, GLIBC_2_39); +# ifndef EXP10_VERSION +# define EXP10_VERSION GLIBC_2_39 +# endif +versioned_symbol (libm, __exp10, exp10, EXP10_VERSION); libm_alias_double_other (__exp10, exp10) #else libm_alias_double (__exp10, exp10) diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist index 88e7538e51..01c5633663 100644 --- a/sysdeps/mach/hurd/i386/libm.abilist +++ b/sysdeps/mach/hurd/i386/libm.abilist @@ -1181,5 +1181,6 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 exp10 F GLIBC_2.40 fmod F GLIBC_2.40 fmodf F diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist index c99c60161d..3413cfdbe7 100644 --- a/sysdeps/unix/sysv/linux/i386/libm.abilist +++ b/sysdeps/unix/sysv/linux/i386/libm.abilist @@ -1188,5 +1188,6 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 exp10 F GLIBC_2.40 fmod F GLIBC_2.40 fmodf F