From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6C2B61F44D for ; Thu, 28 Mar 2024 18:22:41 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=TkVYSWYl; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 240873858C5E for ; Thu, 28 Mar 2024 18:22:39 +0000 (GMT) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 5A92F3858D1E for ; Thu, 28 Mar 2024 18:22:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A92F3858D1E 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 5A92F3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711650135; cv=none; b=QTjJQDLyKdhhgc4SXJ8QbU09tPJbcHJk8RyFjGxy+soo4HVG4foYjZaxUCH7XHofv2Qno2tILKCKQaAUw83HITy73moyTqA8hPKktFJH758AUZAQ1ZMfYImIEaxzg71UELdYLfOaijDdvdriSUHPUFQ2tb5qCy831NNIrgMeN8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711650135; c=relaxed/simple; bh=iYEZSQV/TL6sRAhV1rwya07GbYcYQGh7nlvqsCex60s=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=qhqsLIpKXXrQ/YN2IbhrvrF95NVv6+6gUIItH1oPw9yBJ6FTvNRBecd7sd5L9Kdq0cygpCHsYKOMoK+qC2JTzhuW5JyKUkKX7gK/2bi0XQ6tTEIXTrEerby5wg7O/mIcn4Zg/QqxahmzyBscR58yKpfhmYXMHuey22hga8dVVx0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e6f4ad4c57so1071460b3a.2 for ; Thu, 28 Mar 2024 11:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711650132; x=1712254932; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=kEyI3mOIgcbzrTA4J1yhEpy4amD3bw3iwvM/ickUwYA=; b=TkVYSWYlvV7dwSOiAAO5E+IIJ2zWA7En/8Bnxh6nrN3EYGBqSgRN4hvs7+V1ICyTvJ BGgnFKc09mYGDXmURAIvtSQm0T157UpISQvoUyZnQsGLq7oF170V3/DgRgQP4DmNmUQX 0g1WIhMmlHZimWKSUq+tHJ7jh7wmMRLiONh8d6mLwjSIMTELrSDku7J00tijC5KjaUNE KEYWYBx8kPuASSXzGBI/2HqdPb8Bbr7MRJvujiDCF1urGJUI++AAIDYYtHwQbvZgib8u p1ymdmpnjsaR1kXsRKqK8XgeuYMhmBE2E1mG+/GyUYnfm6j3Fwb2yeQ0Loi9BnNeOv0D 6yxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711650132; x=1712254932; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kEyI3mOIgcbzrTA4J1yhEpy4amD3bw3iwvM/ickUwYA=; b=FOyXU/JKJP6ZzBjKJC1RxloPVh4TQ8sZyEQ3WNPsZKay49pJjZxAE6N5vqNdvEFpTa hub0wAG+WKtfJ4bL5+6Y0k0ihaBEnMCr3d2cuTeUVYJpqQYSGyFiOUJuDpMJigc36EWn mtNaNp+ScTv7CXCmeeygLf8SIgR/pCpdb8wbdj+8tO+1Q7dHBDVs/7QZKZEWYdkU/9zm EI/PF5sGxrXk5Dqt1ziAA6pt0Rd/SY0VjX/ICVTdXV4vUc7neC+fewQ+VhULlZdIWyML Zwgn54UYC6x6oeOzS47YW12S5RXs+oowCHW8D6of27M6xLjygRxQAf3W/TO19W6+MtpH /rnQ== X-Forwarded-Encrypted: i=1; AJvYcCVgNIv19r69SuTXd9AmEsdkuo62Q354X0exGlbE24DUi1tqCoTuW5f+tGRWe28SKeODIMZIrPVImcWXoPqQSI5P0CXk/elf+JGg X-Gm-Message-State: AOJu0YwYuPaQBSrmxye8G2WyGMzZtjSh46n5J8UKwVPTLCnUumohlI+S K6qmiyz4zkR9/zamGxhIxKokntb/2n+m+x/Y7QLc8992+nUO8ynEft1vOipHs/4= X-Google-Smtp-Source: AGHT+IFX5SH3kdESfUwkpkYq2AiiJVT9cLnRok5jQ/AOUHsz/86MeSKjYMP3e4LiQuUnFRKC+UN0Zw== X-Received: by 2002:a05:6a20:72aa:b0:1a3:4635:6aab with SMTP id o42-20020a056a2072aa00b001a346356aabmr4674725pzk.62.1711650132237; Thu, 28 Mar 2024 11:22:12 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c3:b18e:f80b:dc91:dea1:d972? ([2804:1b3:a7c3:b18e:f80b:dc91:dea1:d972]) by smtp.gmail.com with ESMTPSA id d21-20020a634f15000000b005dbd0facb4dsm1572934pgb.61.2024.03.28.11.22.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Mar 2024 11:22:11 -0700 (PDT) Message-ID: <1c27a80e-30f9-48fb-b608-8f2387621f5e@linaro.org> Date: Thu, 28 Mar 2024 15:22:08 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 03/10] i386: Use generic fmod To: "H.J. Lu" , GNU C Library References: <20240327194024.1409677-1-adhemerval.zanella@linaro.org> <20240327194024.1409677-4-adhemerval.zanella@linaro.org> <1936623e-b6c1-40ef-b7c8-249eef54d071@linaro.org> <1048273f-c636-4c2b-83f6-7535839bce03@linaro.org> <9bf7af32-afa3-439c-84c0-76e76b220e44@linaro.org> <0e4733a3-d569-4a73-b2d3-001cc6c3d751@linaro.org> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+e=80x24.org@sourceware.org On 28/03/24 13:00, H.J. Lu wrote: > On Thu, Mar 28, 2024 at 8:57 AM Adhemerval Zanella Netto > wrote: >> >> >> >> On 28/03/24 12:55, H.J. Lu wrote: >>> On Thu, Mar 28, 2024 at 8:48 AM Adhemerval Zanella Netto >>> wrote: >>>> >>>> >>>> >>>> On 28/03/24 12:42, H.J. Lu wrote: >>>>> On Thu, Mar 28, 2024 at 8:14 AM Adhemerval Zanella Netto >>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> On 28/03/24 11:51, H.J. Lu wrote: >>>>>>> On Thu, Mar 28, 2024 at 7:11 AM Adhemerval Zanella Netto >>>>>>> wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 27/03/24 18:38, H.J. Lu wrote: >>>>>>>>> On Wed, Mar 27, 2024 at 1:37 PM Adhemerval Zanella Netto >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 27/03/24 16:55, H.J. Lu wrote: >>>>>>>>>>> On Wed, Mar 27, 2024 at 12:40 PM Adhemerval Zanella >>>>>>>>>>> wrote: >>>>>>>>>>>> >>>>>>>>>>>> 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; >>>>>>>>>>>> + } >>>>>>>>>>> >>>>>>>>>>> This changes the ABI. I assume that it fixes a real bug. Is there a bug >>>>>>>>>>> report open for this? >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> The new version is the way to provide the system without the SVID compat >>>>>>>>>> support, which we for all ABIs but i386 on 2.38. For instance: >>>>>>>>>> >>>>>>>>>> find . -iname libm.abilist | xargs grep -w fmod >>>>>>>>>> ./sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist:GLIBC_2.0 fmod F >>>>>>>>>> ./sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist:GLIBC_2.38 fmod F >>>>>>>>>> [...] >>>>>>>>>> >>>>>>>>>> For i386 specifically, the old SVID symbol will be kept as fmod@GLIBC_2.0. >>>>>>>>>> >>>>>>>>> >>>>>>>>> Does it fix a run-time test which fails without the fix? >>>>>>>>> >>>>>>>> >>>>>>>> Not really, but it is one less assembly implementation in favor a generic one >>>>>>>> (which also shows a slight improvement on recent chips) and it sync i386 >>>>>>>> with generic code (so less possible issues, such as the static lib in this >>>>>>>> patchset). >>>>>>> >>>>>>> Why do we need a new symbol? >>>>>> >>>>>> Because the new fmod@GLIBC_2.40 for i386 won't have the SVID handling, >>>>>> similar to what has been done for other architectures with >>>>>> 16439f419b270184ec501c531bf20d83b6745fb0; >>>>> >>>>> Does it change i386 fmod behavior? If yes, we need a testcase to verify it. >>>>> If not, why is it needed? >>>>> >>>> >>>> It is not strictly required, but it makes i386 has one less assembly optimization >>>> that do not follow the rest of the code and it optimizes it slight because. Since >>>> we do actually have check for SVID, the default math tests already check the >>>> required symbol semantic. >>> >>> fmod@GLIBC_2.40 is added because of the SVID handling. But there is no >>> user visible behavior change. Is this correct? >> >> The user visible is the missing SVID handling (which I think noone actually uses >> it). That's the main reason we need the compat dance and this extra complexity. >> Maybe one day we just can drop this for good... > > If we want to provide the SVID compatibility, 2 testcases are needed: > > 1. A testcase to show that the new implementation is incompatible with SVID. > 2. A testcase to show that the compat symbol provides the SVID compatibility. We don't really have SVID compatibility tests for any other optimization/simplification, and although I don't really oppose on adding I also thinking that this is making this change even more complicated than it would require. I can drop the i386 changes to use generic implementations if you think it would simplify this patchset.