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 X-Patchwork-Id: 781589 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp931136wrj; Thu, 21 Mar 2024 09:51:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDfJ3IBLr1RjdQoHSrwvxmdQsBLNPm/VuKvPRHRMh8IrQfgsrcpGOyZvBfgMNkRQ9s6UzkizIo2rLTc8zy9iaT X-Google-Smtp-Source: AGHT+IE0Q2g998euEblu93lVT/EFvMHPkx34ONn3Y2KPIbfZGPh4dpPQS39MbtmtJoqQ/kIbSeFd X-Received: by 2002:a05:6808:2f07:b0:3c3:b190:9591 with SMTP id gu7-20020a0568082f0700b003c3b1909591mr1980792oib.26.1711039895286; Thu, 21 Mar 2024 09:51:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711039895; cv=pass; d=google.com; s=arc-20160816; b=uiYTIpEBNN2DfU66XF05sLzBRGeRa35fmprE9RJV19FQvNHh8gCZWyTsXntH3ROvp2 wYsOUIvLP8n1qQYTYVd/oeHBD81LTtZ8cKdtPupsf+p7828ciVS8Tok2dmGPTlmyojON okmUQL5fGsoe/z2kO4HbV2UkqUwalERQcoaosFG7Wy8ZetQQjTLpL8v7cgVOnxPf2Vtb bWKau7H0wiaHAKvBTzRENJAttC6+SSnpDABHatzuNp/07CCdL2NhYiIPbeGWjQ61xSpX KMNkebrU4GoqK9XP+c/ajAasceXjQvqmHL72VB6gzdENkbbj6OtrrVxSN17UwiQtWs3A wozw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=dcR2ma1WvOPlvqy70XySXYoVacImk32cK9Z3i7CYpHc=; fh=+6orIzRLXQY2FWXAtGF+abYflc8V+YPKzsYFuX0DJM4=; b=pVyOzYcTGdsxnq4ucqn3aijFp/U5WWUoEzjnRVj09oaDdXwNFzwfj8aH0CWWurj2i7 jLlndlYBvg/C5cX5VSrAh+4zllWLu180eeDMr6uuwvm793FjyLZwFDUhjnfT4kINYIBV 4IEV/agfvN6tS6icWtZMi3xkBMoD4FmQBLjSBY3q6tHQU86fPNrFOjq9VMoEoe4naGHx eQuFDpk5FL/qLGyukHiS2jmj7h2apEXe/UhA24sJBi1ZO9EUlubTrG1BsNql+cd9Jufp BE0F+92ZSuQr3jb609+oSFo73uzNjA2Pj7nnQoAKb9ItgFCkcl+flRt8RvV4pmGtzRfz r68g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDT2RemO; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h13-20020ac8584d000000b00430eec0fc6fsi104455qth.194.2024.03.21.09.51.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDT2RemO; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E39583858C35 for ; Thu, 21 Mar 2024 16:51:34 +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-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+patch=linaro.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