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 X-Patchwork-Id: 87718 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 772FC385C6EE for ; Wed, 27 Mar 2024 16:48:03 +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-Google-Smtp-Source: AGHT+IEIXil2l4UkK19Q5vdu102nIcVv0DXYGmc+sHCObP36bvDZTGJXzxv1cPL1OBgB8ixn03sMCQ== 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+patchwork=sourceware.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