From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Pavel.Kozlov@synopsys.com, libc-alpha@sourceware.org
Cc: linux-snps-arc@lists.infradead.org
Subject: Re: [PATCH] ARC:fpu: add extra capability check before use of sqrt and fma builtins
Date: Mon, 16 Jan 2023 11:18:25 -0300 [thread overview]
Message-ID: <882721d2-adb1-1cbd-cd06-d7902dc9d2e7@linaro.org> (raw)
In-Reply-To: <20221221162849.12301-1-kozlov@synopsys.com>
On 21/12/22 13:28, Pavel.Kozlov--- via Libc-alpha wrote:
> From: Pavel Kozlov <pavel.kozlov@synopsys.com>
>
> 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.
> ---
> 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..082badf48201 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_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_FMAL_BUILTIN 0
> #define USE_FMAF128_BUILTIN 0
This is wrong, sqrt use macro do not belong for the fma switch file.
> 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
This is ok.
next prev parent reply other threads:[~2023-01-16 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 16:28 Pavel.Kozlov
2023-01-16 14:18 ` Adhemerval Zanella Netto [this message]
2023-01-17 12:31 ` Pavel Kozlov
2023-01-17 12:12 ` [PATCH v2] " Pavel.Kozlov
2023-01-17 14:31 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=882721d2-adb1-1cbd-cd06-d7902dc9d2e7@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=Pavel.Kozlov@synopsys.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-snps-arc@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).