From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 5DE8B3858D28 for ; Tue, 17 Jan 2023 14:31:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DE8B3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x232.google.com with SMTP id p133so10698980oig.8 for ; Tue, 17 Jan 2023 06:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=k2nuHqByQG7Cm1bhdJh5z2+H0GPxRJPieZhH62NQFLM=; b=Qsle6EQezldkihlL2aWYVB8eXX7qDT2a7YXymUVHNGBzYU9y3KMZXLRQC5vXuCpaYV rVVNfl7S/gJedxXoJbWFqL1nv8N+ZjarpFeaA3S0uTV19/qZA/ZNmiENAvALt+I4TbXo 90On/T+WX0z5QcycKq4lF4aFkji3UW4peBkwxtpj7l2bEVcKGo9RrMbJzEtpt2IqD5Jj hEQUg1PQnrDyMRikJgnKt5/K+fbKd0Ur2IxxTeDf5JWoMBuR5B1X389YLfpPPp6SDDk/ ZMT1B18sJ4OySW1LmbaTYnVxbtmRTlQ0oQ5v2DPxUYnQ3iXN8tW1WWa8LcYxfUkuENF+ gqyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k2nuHqByQG7Cm1bhdJh5z2+H0GPxRJPieZhH62NQFLM=; b=A4RoxzZosER7QVGG6jVIH2ySScMWYTdWT6UyxqZ+nlIx2m0EyX+ntWmavcdDGeDfBQ oqb7VBjL1v2niEJHxq3LUp8Fux25E2r9EYh71mL6TYux85woM10ltcvyriSc2ahOpHUw OZZ6hr0lvYP8b0CTYLyloz0vupj1NlV+qQPqS4rPFP4qA4nnpooEGURQsKdQApDbqAu4 N12QBSppslNHOcwQWS75B8xpXQQ90F0fUiV6szu376aaExcwdZM8cflrjv5Zb91xjSB6 c0Un1coe1AV2nBT1wkL7AOGF+1gXmXeFNTS2TzRwwlbLkR67eDTkAaB4ZpxHYl2DfAHC IyLA== X-Gm-Message-State: AFqh2kpMEhy9+044H0B8nHBkYCkRJ6BgIUVkqxzAwrYtkI4flj+W4dqm cJh2hB+p1+ZV75GWxhtIWDcLbSTrapy2xToFti0= X-Google-Smtp-Source: AMrXdXtGCxZ5NII2X39KlU1OyyeQxKSRoNHcc8AmLHhClIge5rDugpP0yBlg8Xl8H8N4k1PO9MJJag== X-Received: by 2002:a05:6808:138c:b0:35b:e81d:285b with SMTP id c12-20020a056808138c00b0035be81d285bmr1921799oiw.28.1673965916703; Tue, 17 Jan 2023 06:31:56 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6? ([2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6]) by smtp.gmail.com with ESMTPSA id d62-20020aca3641000000b0035ba52d0efasm14500730oia.52.2023.01.17.06.31.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 06:31:55 -0800 (PST) Message-ID: <407f62f4-bba8-9829-c854-d16ac6a444d9@linaro.org> Date: Tue, 17 Jan 2023 11:31:53 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v2] ARC:fpu: add extra capability check before use of sqrt and fma builtins Content-Language: en-US To: Pavel.Kozlov@synopsys.com, libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org References: <20221221162849.12301-1-kozlov@synopsys.com> <20230117121223.2635-1-kozlov@synopsys.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20230117121223.2635-1-kozlov@synopsys.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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,NICE_REPLY_A,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 List-Id: On 17/01/23 09:12, Pavel.Kozlov--- via Libc-alpha wrote: > From: Pavel Kozlov > > Add extra check for compiler definitions to ensure that compiler provides > sqrt and fma hw fpu instructions else use software implementation. > > As divide/sqrt and FMA hw support from CPU side is optional, > the compiler can be configured by options to generate hw FPU instructions, > but without use of FDDIV, FDSQRT, FSDIV, FSSQRT, FDMADD and FSMADD > instructions. In this case __builtin_sqrt and __builtin_sqrtf provided by > compiler can't be used inside the glibc code, as these builtins are used > in implementations of sqrt() and sqrtf() functions but at the same time > these builtins unfold to sqrt() and sqrtf(). So it is possible to receive > code like that: > > 0001c4b4 <__ieee754_sqrtf>: > 1c4b4: 0001 0000 b 0 ;1c4b4 <__ieee754_sqrtf> > > The same is also true for __builtin_fma and __builtin_fmaf. LGTM, thanks. You might need to check with Carlos O'Donnel to see it you could install this for 2.36. Reviewed-by: Adhemerval Zanella > > --- > Changes in v2: > - Fixed macros definitions for FMA > > sysdeps/arc/fpu/math-use-builtins-fma.h | 14 ++++++++++++-- > sysdeps/arc/fpu/math-use-builtins-sqrt.h | 14 ++++++++++++-- > 2 files changed, 24 insertions(+), 4 deletions(-) > > diff --git a/sysdeps/arc/fpu/math-use-builtins-fma.h b/sysdeps/arc/fpu/math-use-builtins-fma.h > index eede75aa41be..2acd8113ce2c 100644 > --- a/sysdeps/arc/fpu/math-use-builtins-fma.h > +++ b/sysdeps/arc/fpu/math-use-builtins-fma.h > @@ -1,4 +1,14 @@ > -#define USE_FMA_BUILTIN 1 > -#define USE_FMAF_BUILTIN 1 > +#if defined __ARC_FPU_DP_FMA__ > +# define USE_FMA_BUILTIN 1 > +#else > +# define USE_FMA_BUILTIN 0 > +#endif > + > +#if defined __ARC_FPU_SP_FMA__ > +# define USE_FMAF_BUILTIN 1 > +#else > +# define USE_FMAF_BUILTIN 0 > +#endif > + > #define USE_FMAL_BUILTIN 0 > #define USE_FMAF128_BUILTIN 0 > diff --git a/sysdeps/arc/fpu/math-use-builtins-sqrt.h b/sysdeps/arc/fpu/math-use-builtins-sqrt.h > index e94c915ba66a..a449bc609295 100644 > --- a/sysdeps/arc/fpu/math-use-builtins-sqrt.h > +++ b/sysdeps/arc/fpu/math-use-builtins-sqrt.h > @@ -1,4 +1,14 @@ > -#define USE_SQRT_BUILTIN 1 > -#define USE_SQRTF_BUILTIN 1 > +#if defined __ARC_FPU_DP_DIV__ > +# define USE_SQRT_BUILTIN 1 > +#else > +# define USE_SQRT_BUILTIN 0 > +#endif > + > +#if defined __ARC_FPU_SP_DIV__ > +# define USE_SQRTF_BUILTIN 1 > +#else > +# define USE_SQRTF_BUILTIN 0 > +#endif > + > #define USE_SQRTL_BUILTIN 0 > #define USE_SQRTF128_BUILTIN 0