[PATCH 2/3] powerpc64le: Check HWCAP bits against compiler build flags

Tulio Magno Quites Machado Filho tuliom@ascii.art.br
Wed May 12 14:52:23 GMT 2021


Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> writes:

> I tried to allude in the commit message that this is expected.  Maybe I
> should drop the POWER10 check?

I don't think this is necessary.
Even if you removed the P10 check, I don't think the P9 check is guaranteed to
work because when _ARCH_PWR9 is set, the compiler is allowed to use P9
instructions in this function before the test is executed.

I think this patch is trying to improve the error message to the user.

With that said, it doesn't hurt to copy your explanation as a source code
comment, i.e.:

/* This approach does not work for the POWER10 because the bootstrap
   relocation already uses PCREL instructions, so the detection code does
   not actually run.  */

>> +#ifdef __MMA__
>> +  if ((GLRO (dl_hwcap2) & PPC_FEATURE2_MMA) == 0)
>> +    _dl_fatal_printf ("\
>> +Fatal glibc error: CPU lacks MMA support (POWER10 or later required)\n");
>> +#endif
>> +}

I'm not sure it's a good idea to require MMA.
__MMA__ is enabled with -mcpu=power10.  However, I'm not aware of any compilers
able to auto-mma code.  In other words, we have to use it explicitly right now.
Which means we shouldn't have MMA instructions in glibc at the moment.

-- 
Tulio Magno


More information about the Libc-alpha mailing list