[PATCH] powerpc: New feature - HWCAP/HWCAP2 bits in the TCB

Richard Henderson rth@twiddle.net
Mon Jun 29 17:52:00 GMT 2015


On 06/09/2015 04:06 PM, Steven Munroe wrote:
> On Tue, 2015-06-09 at 15:47 +0100, Szabolcs Nagy wrote:
>>
>> On 08/06/15 22:03, Carlos Eduardo Seo wrote:
>>> The proposed patch adds a new feature for powerpc. In order to get
>>> faster access to the HWCAP/HWCAP2 bits, we now store them in the TCB.
>>> This enables users to write versioned code based on the HWCAP bits
>>> without going through the overhead of reading them from the auxiliary
>>> vector.
>
>> i assume this is for multi-versioning.
>
> The intent is for the compiler to implement the equivalent of
> __builtin_cpu_supports("feature"). X86 has the cpuid instruction, POWER
> is RISC so we use the HWCAP. The trick to access the HWCAP[2]
> efficiently as getauxv and scanning the auxv is too slow for inline
> optimizations.
>

There is getauxval(), which doesn't scan auxv for HWCAP[2], but rather reads 
the variables private to glibc that already contain this information.  That 
ought to be fast enough for the builtin, rather than consuming space in the TCB.



r~



More information about the Libc-alpha mailing list