x86-64: Fix FMA4 detection in ifunc [BZ #26534]

Message ID 20200826022650.1952808-1-ondra.hosek@gmail.com
State Committed
Commit 23af890b3f04e80da783ba64e6b6d94822e01d54
Headers
Series x86-64: Fix FMA4 detection in ifunc [BZ #26534] |

Commit Message

Ondřej Hošek Aug. 26, 2020, 2:26 a.m. UTC
  A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
FMA4 code path to be taken on systems that support FMA, even if they do
not support FMA4. Fix this to detect FMA4.
---
 sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

H.J. Lu Aug. 26, 2020, 3:54 a.m. UTC | #1
On Tue, Aug 25, 2020 at 7:27 PM Ondřej Hošek via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
> FMA4 code path to be taken on systems that support FMA, even if they do
> not support FMA4. Fix this to detect FMA4.
> ---
>  sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
> index 7659758972..e5fd5ac9cb 100644
> --- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
> +++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
> @@ -32,7 +32,7 @@ IFUNC_SELECTOR (void)
>        && CPU_FEATURE_USABLE_P (cpu_features, AVX2))
>      return OPTIMIZE (fma);
>
> -  if (CPU_FEATURE_USABLE_P (cpu_features, FMA))
> +  if (CPU_FEATURE_USABLE_P (cpu_features, FMA4))
>      return OPTIMIZE (fma4);
>
>    return OPTIMIZE (sse2);
> --
> 2.28.0
>

LGTM.

Thanks.
  
Adhemerval Zanella Aug. 26, 2020, 12:56 p.m. UTC | #2
On 26/08/2020 00:54, H.J. Lu via Libc-alpha wrote:
> On Tue, Aug 25, 2020 at 7:27 PM Ondřej Hošek via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
>> FMA4 code path to be taken on systems that support FMA, even if they do
>> not support FMA4. Fix this to detect FMA4.
>> ---
>>  sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
>> index 7659758972..e5fd5ac9cb 100644
>> --- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
>> +++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
>> @@ -32,7 +32,7 @@ IFUNC_SELECTOR (void)
>>        && CPU_FEATURE_USABLE_P (cpu_features, AVX2))
>>      return OPTIMIZE (fma);
>>
>> -  if (CPU_FEATURE_USABLE_P (cpu_features, FMA))
>> +  if (CPU_FEATURE_USABLE_P (cpu_features, FMA4))
>>      return OPTIMIZE (fma4);
>>
>>    return OPTIMIZE (sse2);
>> --


I think it should be backported to 2.32 as well.
  
Ondřej Hošek Sept. 2, 2020, 8:19 a.m. UTC | #3
On Wed, Aug 26, 2020 at 5:54 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Aug 25, 2020 at 7:27 PM Ondřej Hošek via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
> > FMA4 code path to be taken on systems that support FMA, even if they do
> > not support FMA4. Fix this to detect FMA4.
> > [...]
>
> LGTM.
>
> Thanks.

A week has elapsed since the last comment; may I ask you to commit the patch?

Thanks!

Cheers,
~~ Ondra
  
H.J. Lu Sept. 2, 2020, 12:10 p.m. UTC | #4
On Wed, Sep 2, 2020 at 1:19 AM Ondřej Hošek <ondra.hosek@gmail.com> wrote:
>
> On Wed, Aug 26, 2020 at 5:54 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Tue, Aug 25, 2020 at 7:27 PM Ondřej Hošek via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> > >
> > > A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
> > > FMA4 code path to be taken on systems that support FMA, even if they do
> > > not support FMA4. Fix this to detect FMA4.
> > > [...]
> >
> > LGTM.
> >
> > Thanks.
>
> A week has elapsed since the last comment; may I ask you to commit the patch?
>
> Thanks!
>
> Cheers,
> ~~ Ondra

I checked it in for you.

Thanks.
  
H.J. Lu Sept. 2, 2020, 1:03 p.m. UTC | #5
On Wed, Sep 2, 2020 at 5:10 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Sep 2, 2020 at 1:19 AM Ondřej Hošek <ondra.hosek@gmail.com> wrote:
> >
> > On Wed, Aug 26, 2020 at 5:54 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Tue, Aug 25, 2020 at 7:27 PM Ondřej Hošek via Libc-alpha
> > > <libc-alpha@sourceware.org> wrote:
> > > >
> > > > A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
> > > > FMA4 code path to be taken on systems that support FMA, even if they do
> > > > not support FMA4. Fix this to detect FMA4.
> > > > [...]
> > >
> > > LGTM.
> > >
> > > Thanks.
> >
> > A week has elapsed since the last comment; may I ask you to commit the patch?
> >
> > Thanks!
> >
> > Cheers,
> > ~~ Ondra
>
> I checked it in for you.
>
> Thanks.

I am backpoing it to 2.32 branch.
  

Patch

diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
index 7659758972..e5fd5ac9cb 100644
--- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
+++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
@@ -32,7 +32,7 @@  IFUNC_SELECTOR (void)
       && CPU_FEATURE_USABLE_P (cpu_features, AVX2))
     return OPTIMIZE (fma);
 
-  if (CPU_FEATURE_USABLE_P (cpu_features, FMA))
+  if (CPU_FEATURE_USABLE_P (cpu_features, FMA4))
     return OPTIMIZE (fma4);
 
   return OPTIMIZE (sse2);