From patchwork Wed Mar 27 19:40:17 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: 783151 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2374713wrt; Wed, 27 Mar 2024 12:41:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSj1Z71d4rW+INFIPQKnkf63McHGqnzIi7ZMmeaEhdO7UOsamwOFnHzSZa2IeqSjejZeYlZpVmMw0C17fNH3r2 X-Google-Smtp-Source: AGHT+IER62zmELSUN9hbPlMbwux3HRteg/qlCZb3Bzv39/Kw4h91iUVPfeYymCp8u5kxxVj+aBgu X-Received: by 2002:a05:6214:580f:b0:696:b120:264 with SMTP id mk15-20020a056214580f00b00696b1200264mr446002qvb.1.1711568473043; Wed, 27 Mar 2024 12:41:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711568473; cv=pass; d=google.com; s=arc-20160816; b=R7QgESBVGbmgeJC+1j0/xxlCnJQjuOsLkVlj3z/WVsc5fiL5j6dG5I8zptYCRVMbfp vslywTR99vXQk8YWUVpu1LSrB3Htq7UOA9TBLUBUW3R7REdTjXtJLnLg1rFGbOd0rodz ilElVnmpsQp9mHclBBYOq2Qe1kMvhyRf5BRSEXyDo2PmqFhOMd8Jhq36d63lE7reA1fA fQv66OeEBT1kQwuhExZJY1naXaCf/IL3R69RyYi6bvQBA8qud2xgiq5/isVKvHA7fc7X 3AzGKNdmmvq0Iq/VK191uVV0l1odkZzDsCCvfJ9s+M4WauRHaNlPQ84hlwLtgzjcT8CT qLPA== 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=CNC6ZNuzOauKY0uHxpKDgdjN6gV1zS1XgvlkWWQ4AD9ACdUXnOZfBnSbAVOoXJZvgB P/sday/KMnYLixd3iwiLfbB1SMAEscg2bhqyEqdWHF2EBuhKQz/6LzXF1jUO0uFqagZj bgy82aGKRMlqcUQIP8c6Qcg2xcoGrNrlM4YOy5tCu/tVBz1vOS5px25AAav2MVXqh1yI eSntu1E3TGWwNFU4W/T21lCc24iOC5r9CKxj1VzqXwWnHbIKK7S/roLO2YPVB4XYbscj sHBSm/pOItfWV3MU+rEtjkiPvmVtixat13UA+5BUGO9ETIYh4rG2TpyUeSTovDHWqA8D ZEPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fpJjgSAz; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id mf9-20020a0562145d8900b00696b0d57193si1429252qvb.403.2024.03.27.12.41.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 12:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fpJjgSAz; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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 7FCCF385C6EE for ; Wed, 27 Mar 2024 19:41:12 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 4147F385E446 for ; Wed, 27 Mar 2024 19:40:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4147F385E446 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 4147F385E446 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711568439; cv=none; b=lquwqjMD50ridGY73lmnCJuDIV0Tac0MPEOllbGQQqR2CtLJhDCDR1AXk5enftg+wBXX+EePlqBmUp96sYbUrfwGt4kvpo3f4QxQXcdZU3JA5Z5bH09+1pL5Dt4EsbYrJq92WP/7gBhKzgeVfuZmq2HoUb/4/9NettoAr+dMtQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711568439; c=relaxed/simple; bh=FWgJkfkwseYq7F5C+DGVquhkJLx5vPNk1M7TtjMJhC8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=t3Cj7A3IpakMsvW2WdGzfu2xK7H7uWQ+GzFSQklqJa7M6WYRy7SJ08ZTbgJ1plTBQ6Li6h1HUzX8NyVEENcsshF1IHRRgslxUTDd9C6jmeM6TmlENb1pvArOfltcM7zl1qsPenA4FpMW/iZVM2fKRiI32GR8Tt0hV+O4/G/fsU8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so176087a12.0 for ; Wed, 27 Mar 2024 12:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711568435; x=1712173235; 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=fpJjgSAzzjcpFDCJfbmqTzNXFIzcr27LAnvI7YOJptnc69Mnnxo6HcLUdEYJ+18XQX obrpoj+RGeCbEwO/RGw0GZDgidRAyrVisb3NiVdrowFnvkG/xJ8GAhrUOtRDJBNJu2Re op+fFYQnS9fCESFKTZdDHBGwV56gHeYGE5u3JpHFJanjXDKwbufiQwHV67Ii3r3xJQ2P ULc2REKWodqGQpw3x1YuUP+79/N5kOJv/1MM7c6PsLvvms2Xb81GnXKFcAJUEF82KffC K6wAALKkwZNodkj89OF9e2Cx29ipp1KbPwHT0Hj3o1c8lbck6zIP/YHJ7D5iBhXb48v/ S8Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711568435; x=1712173235; 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=pBxhF2HgmAgWrT9y61rzA8/yjFwCofA2dJUgko+k51N862CQgCLFF0xmWZR5442tT8 jFoUYuw/saMCJ3abVLW7cvyiwYBw3e58HmavN8UKqa8z7IoGtuyqCi61bfyHq8ZL1rt/ gIXj69UFPaHB3vIeZZB2Fn2ylux3BmsRxh99159dEG+69/zeSOw+7jMhiaXwAngtXQHI ItwVsucixjurxBWl/VEZIoT5xEZnr0mTU2doO77A78SZfZ5RSDTDUeL5Fwmx+ThZ0/2k ctrhh9UDqlkLuGyVzv1OPqVgSUWeCYinfw2oBTrThczjVqIPXGNF5Do1UnWhPeeVt3x7 ffVQ== X-Gm-Message-State: AOJu0YxRKtzURdQSjm5TIIjHf6z8LOL7Ie4uUrqWA8No2d+VX+ANfShi ViT1PgLxuWFXZg6DBOH5OgfVFzWpHoj5dytAZ2fDOHjYmK82EApCsyzUUrTalhw6Ipa0nkrEvhD 6 X-Received: by 2002:a17:90b:1bc2:b0:2a1:f4ca:dfaa with SMTP id oa2-20020a17090b1bc200b002a1f4cadfaamr323501pjb.13.1711568435616; Wed, 27 Mar 2024 12:40:35 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:b18e:67c4:6248:3d8a:f386]) by smtp.gmail.com with ESMTPSA id p11-20020a17090a348b00b002a091be027esm2277357pjb.31.2024.03.27.12.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 12:40:35 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Joseph Myers , Florian Weimer , "H . J . Lu" Subject: [PATCH v2 03/10] i386: Use generic fmod Date: Wed, 27 Mar 2024 16:40:17 -0300 Message-Id: <20240327194024.1409677-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240327194024.1409677-1-adhemerval.zanella@linaro.org> References: <20240327194024.1409677-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