From patchwork Wed Mar 27 16:45:15 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: 783140 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2300451wrt; Wed, 27 Mar 2024 09:47:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8Fal6NmVYiX1JQX+jyEm69Jk4uqtcA6LIBsRahYdrUAOEfzRCIJB4I5L1AwVkInclWf0t6k6J+5DHWbTOJPIn X-Google-Smtp-Source: AGHT+IE3C762IczLSdTAJD8jrfVtBiNmfyBEPp8IxieTUmGv/pYzv5O4X4NqdRYEw9qe24Vyfhpy X-Received: by 2002:a05:620a:37a0:b0:789:ee7a:154a with SMTP id pi32-20020a05620a37a000b00789ee7a154amr148844qkn.3.1711558069696; Wed, 27 Mar 2024 09:47:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711558069; cv=pass; d=google.com; s=arc-20160816; b=rE5ph2HRpOn3uSttLRlRultDwe+ikjQCNLec7HFCMJNIJiR9KOh/0ipYjxGRm1NypK kYDpjA4eFp6zjajLS8kcZhlw9PVcSTQoe+kJ6enaLKejPCeg1ZurTHjJG5rL6TxeWQZ8 Xns+FbsPVTy8T099ANVTv0NfZEUgoPbu1w7psEfsu7mXcWLhw4My7K7LSDeKo4ZGsbTR xwjBSHn2wEbk996Y3AkCzN/nEJ+O9m2vS6VP6Z+3mCk9wNkJr7MJrH7RLKHzZQg78AbX XRX0zr/xCJtoSZ7YYG3MvQtbjnAKNU7u9YOfTMpXa0tGKS6bUiMBmoyv15y7vHCIDCh3 MgDA== 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=WtLnUd2EuDKv+EP3BSdEI8hdivapDDAq3MY9+WgWrlk=; b=lm35N2bVgqE+FsZ5b/qUOqnnu8xWnTjAoCYTPCc7MCuFhxSQloPx+reOdFKARsUVEM pySTog+z+hPgzutv8RDU5c1J/0k3wRR/j09b54+APuN00+yhD1lHbTI/bR1Ydr2gVLN/ 0Y0JO26LwHW9IPN81BffqTI9zvGsAWMSNZexGtXWHEgR1iFMtfb+SIlHRB9GfhIhnrH3 xoslBYCjJ22wQdgEznVUDfv+U9HYP1RwV6O2HtCLmOIasbICxTGG1CwGr1TvF582Ra5X dUOjRVu09ghJM3bXKsuRzEhy0wvqc46NHMK3Te8pnHrKSeXbyuUm0yKRkLA8j3EUYgfp k2AQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="T/ag9lzp"; 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 c17-20020a05620a201100b00789d40d2417si9994730qka.1.2024.03.27.09.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:47:49 -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="T/ag9lzp"; 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 54B35385E833 for ; Wed, 27 Mar 2024 16:47:49 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 9E4973858C31 for ; Wed, 27 Mar 2024 16:45:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E4973858C31 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 9E4973858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711557942; cv=none; b=EOITG7JpkPHkXnuna3s4prxcAL2328tlauiJCuA1sttRsf89fKJ7CLwJ7MeQtvdgmI4AJna9oQNE0OWVNMDcqytKIdgFH25RxJdb9Ar8V5Y4QSfefiBiZNam1AtBT4RDwEnRIf8X5aqAYFdQfPBCHQ7BALLVhG13D77NEm+0owc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711557942; c=relaxed/simple; bh=FWgJkfkwseYq7F5C+DGVquhkJLx5vPNk1M7TtjMJhC8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=bfba0OnOFDFmfORSg32SLmynu077EYRyK07WlSKVgQspDZqzWN4yMNS3eVP6hmoLeiv5IA2LGlbICT5NgD41ytzxyYp4VkOk+80oyp1QKkKCiSu21Fr6Ky9PZb7QQzz1rN/m9sQXjRrkXQdsAd7FbBuZZUXnalO1WXluMbWVNtw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e00d1e13a2so348705ad.0 for ; Wed, 27 Mar 2024 09:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711557939; x=1712162739; 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=T/ag9lzp8BhYPPqYv/Et32+F3/qXuC51KQfFyy/ncxb1jo5WDaJNIpJMrF5P2ZdkMZ B0hdRKoy0nuvJfMqKO7jhavlEfzC2as9G626geU2B5Rv5mI/4J3FCXLo58qgCney2Vqj uPbYNDLPbM790CVtbCaC7rC8SypZ+U/F69QXaOlclhO3vSxaaiAD1dCz6vOn9q0Jwd00 7NTJKHe5JaC34eT73FCuc9ReO7OLNOQXgcIUGIxyZxYGO9pQx4ybC4VnLCabbgYh+LOl G5zJiu9oLWhneAOH0DUqyFrIQvUcRHZIkS77PZcqOuw6L8VDZScCrmY14T/NDYaBbCtY zzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711557939; x=1712162739; 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=rvBOXVw5+IZcgfl3qKtmefG5rDXWP394IB9xngjMuLS+2Ia6ZFZA7lsstMQlMgXMA6 4Pq2TxRObnYFhkYDhkyUmHaqtkaqQDxtAZShoCVTTH9+dwdL9wr70HEK+9DXSlcON6Tg nQsxyJqwR3apxrT88GJA9THtnpXntSJL8CVkE7b1F1I7jLXPqskvTNs2BwO3EWYaZfFV UWn6FF6dosgzEdvSv16CtGsF04wLWXb3W2+E3OKPRrvSX9j+SDLwCEQ6HgxG4McG/a4M ILAp31fk0j9JcqpjIz9DIVw1HWjX4USQK9Rt3g6Xvg0hFkz/4EqhbIe+hJwFgsyqYX2B gT8g== X-Gm-Message-State: AOJu0Yzl1ydRWECiSc2+tuU04ZzDud88vUH5SfQl81VGvnryo7pqD+o0 1DWbX6qDuNFGkr94p76LqkybXzU7Qwqecy6otxJBn+Yo26WX5FbblOU2JHI+MybKp7QY+YZ0x/F o X-Received: by 2002:a17:902:fc4c:b0:1e0:f6de:afae with SMTP id me12-20020a170902fc4c00b001e0f6deafaemr243936plb.57.1711557939104; Wed, 27 Mar 2024 09:45:39 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:b18e:67c4:6248:3d8a:f386]) by smtp.gmail.com with ESMTPSA id c4-20020a170903234400b001e20578b524sm858593plh.252.2024.03.27.09.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:45:38 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Joseph Myers , Florian Weimer , "H . J . Lu" Subject: [PATCH 03/15] i386: Use generic fmod Date: Wed, 27 Mar 2024 13:45:15 -0300 Message-Id: <20240327164527.3717523-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240327164527.3717523-1-adhemerval.zanella@linaro.org> References: <20240327164527.3717523-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+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