diff mbox series

[PATCHv2,1/6] MIPSr6/math: Use builtin fma and fmaf

Message ID 20240513081945.1842029-1-syq@gcc.gnu.org
State New
Headers show
Series [PATCHv2,1/6] MIPSr6/math: Use builtin fma and fmaf | expand

Commit Message

YunQiang Su May 13, 2024, 8:19 a.m. UTC
MIPSr6 has MADDF.s/MADDF.d instructions, which are fused.

In MIPS ISA, double support can be subsetted.  Only FMAF is enabled
for this case.

	* sysdeps/mips/fpu/math-use-builtins-fma.h

Signed-off-by: YunQiang Su <syq@gcc.gnu.org>
---
 sysdeps/mips/fpu/math-use-builtins-fma.h | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 sysdeps/mips/fpu/math-use-builtins-fma.h

Comments

Adhemerval Zanella Netto June 3, 2024, 12:34 p.m. UTC | #1
On 13/05/24 05:19, YunQiang Su wrote:
> MIPSr6 has MADDF.s/MADDF.d instructions, which are fused.
> 
> In MIPS ISA, double support can be subsetted.  Only FMAF is enabled
> for this case.
> 
> 	* sysdeps/mips/fpu/math-use-builtins-fma.h
> 
> Signed-off-by: YunQiang Su <syq@gcc.gnu.org>
> ---
>  sysdeps/mips/fpu/math-use-builtins-fma.h | 4 ++++
>  1 file changed, 4 insertions(+)
>  create mode 100644 sysdeps/mips/fpu/math-use-builtins-fma.h
> 
> diff --git a/sysdeps/mips/fpu/math-use-builtins-fma.h b/sysdeps/mips/fpu/math-use-builtins-fma.h
> new file mode 100644
> index 0000000000..176cfd259b
> --- /dev/null
> +++ b/sysdeps/mips/fpu/math-use-builtins-fma.h
> @@ -0,0 +1,4 @@
> +#define USE_FMA_BUILTIN (__mips_isa_rev >= 6 && !defined (__mips_single_float))
> +#define USE_FMAF_BUILTIN (__mips_isa_rev >= 6)
> +#define USE_FMAL_BUILTIN 0
> +#define USE_FMAF128_BUILTIN 0

I think the previous version is better, because with clang this leads to
an warning due undefined behavior:

 warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
    8 | #if USE_FMA_BUILTIN
diff mbox series

Patch

diff --git a/sysdeps/mips/fpu/math-use-builtins-fma.h b/sysdeps/mips/fpu/math-use-builtins-fma.h
new file mode 100644
index 0000000000..176cfd259b
--- /dev/null
+++ b/sysdeps/mips/fpu/math-use-builtins-fma.h
@@ -0,0 +1,4 @@ 
+#define USE_FMA_BUILTIN (__mips_isa_rev >= 6 && !defined (__mips_single_float))
+#define USE_FMAF_BUILTIN (__mips_isa_rev >= 6)
+#define USE_FMAL_BUILTIN 0
+#define USE_FMAF128_BUILTIN 0