[v6] MIPSr6/math: Use builtin fma and fmaf

Message ID 20240620160756.71295-1-syq@debian.org
State Committed
Headers
Series [v6] MIPSr6/math: Use builtin fma and fmaf |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

YunQiang Su June 20, 2024, 4:07 p.m. UTC
  From: YunQiang Su <syq@gcc.gnu.org>

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 | 36 ++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 sysdeps/mips/fpu/math-use-builtins-fma.h
  

Comments

YunQiang Su June 25, 2024, 3:02 a.m. UTC | #1
Gently ping and CC Andreas.

YunQiang Su <syq@debian.org> 于2024年6月21日周五 00:08写道:
>
> From: YunQiang Su <syq@gcc.gnu.org>
>
> 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 | 36 ++++++++++++++++++++++++
>  1 file changed, 36 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..8528b77336
> --- /dev/null
> +++ b/sysdeps/mips/fpu/math-use-builtins-fma.h
> @@ -0,0 +1,36 @@
> +/* Copyright (C) 2024 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +/* 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.  */
> +
> +#include <sysdep.h>
> +
> +#if __mips_isa_rev >= 6
> +# ifdef __mips_single_float
> +#  define USE_FMA_BUILTIN 0
> +# else
> +#  define USE_FMA_BUILTIN 1
> +# endif
> +# define USE_FMAF_BUILTIN 1
> +#else
> +# define USE_FMA_BUILTIN 0
> +# define USE_FMAF_BUILTIN 0
> +#endif
> +#define USE_FMAL_BUILTIN 0
> +#define USE_FMAF128_BUILTIN 0
> --
> 2.39.3 (Apple Git-146)
>
  
Adhemerval Zanella June 25, 2024, 1:06 p.m. UTC | #2
On 25/06/24 00:02, YunQiang Su wrote:
> Gently ping and CC Andreas.
> 
> YunQiang Su <syq@debian.org> 于2024年6月21日周五 00:08写道:
>>
>> From: YunQiang Su <syq@gcc.gnu.org>
>>
>> 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>

LGTM.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

>> ---
>>  sysdeps/mips/fpu/math-use-builtins-fma.h | 36 ++++++++++++++++++++++++
>>  1 file changed, 36 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..8528b77336
>> --- /dev/null
>> +++ b/sysdeps/mips/fpu/math-use-builtins-fma.h
>> @@ -0,0 +1,36 @@
>> +/* Copyright (C) 2024 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +/* 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.  */
>> +
>> +#include <sysdep.h>
>> +
>> +#if __mips_isa_rev >= 6
>> +# ifdef __mips_single_float
>> +#  define USE_FMA_BUILTIN 0
>> +# else
>> +#  define USE_FMA_BUILTIN 1
>> +# endif
>> +# define USE_FMAF_BUILTIN 1
>> +#else
>> +# define USE_FMA_BUILTIN 0
>> +# define USE_FMAF_BUILTIN 0
>> +#endif
>> +#define USE_FMAL_BUILTIN 0
>> +#define USE_FMAF128_BUILTIN 0
>> --
>> 2.39.3 (Apple Git-146)
>>
  
Florian Weimer July 1, 2024, 12:31 p.m. UTC | #3
* Adhemerval Zanella Netto:

> On 25/06/24 00:02, YunQiang Su wrote:
>> Gently ping and CC Andreas.
>> 
>> YunQiang Su <syq@debian.org> 于2024年6月21日周五 00:08写道:
>>>
>>> From: YunQiang Su <syq@gcc.gnu.org>
>>>
>>> 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>
>
> LGTM.
>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Adhemerval, are you going to push this?

Thanks,
Florian
  
Adhemerval Zanella July 1, 2024, 12:47 p.m. UTC | #4
On 01/07/24 09:31, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>> On 25/06/24 00:02, YunQiang Su wrote:
>>> Gently ping and CC Andreas.
>>>
>>> YunQiang Su <syq@debian.org> 于2024年6月21日周五 00:08写道:
>>>>
>>>> From: YunQiang Su <syq@gcc.gnu.org>
>>>>
>>>> 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>
>>
>> LGTM.
>>
>> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 
> Adhemerval, are you going to push this?
> 

Yes, I am just checking some builds here.
  
Maciej W. Rozycki July 1, 2024, 3:38 p.m. UTC | #5
On Mon, 1 Jul 2024, Adhemerval Zanella Netto wrote:

> >>>>         * sysdeps/mips/fpu/math-use-builtins-fma.h
> >>>>
> >>>> Signed-off-by: YunQiang Su <syq@gcc.gnu.org>
> >>
> >> LGTM.
> >>
> >> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> > 
> > Adhemerval, are you going to push this?
> > 
> 
> Yes, I am just checking some builds here.

 Oh, I thought it had gone in already.  Then please correct the comment 
formatting issue when pushing.

  Maciej
  

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..8528b77336
--- /dev/null
+++ b/sysdeps/mips/fpu/math-use-builtins-fma.h
@@ -0,0 +1,36 @@ 
+/* Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* 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.  */
+
+#include <sysdep.h>
+
+#if __mips_isa_rev >= 6
+# ifdef __mips_single_float
+#  define USE_FMA_BUILTIN 0
+# else
+#  define USE_FMA_BUILTIN 1
+# endif
+# define USE_FMAF_BUILTIN 1
+#else
+# define USE_FMA_BUILTIN 0
+# define USE_FMAF_BUILTIN 0
+#endif
+#define USE_FMAL_BUILTIN 0
+#define USE_FMAF128_BUILTIN 0