On 05/04/2016 12:31 PM, Brian Gerst wrote: >> >> - asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) >> - : "="REG_OUT (res) >> - : REG_IN (w)); >> + if (likely(static_cpu_has(X86_FEATURE_POPCNT))) { >> + asm volatile("popcnt %[w], %[res]" : [res] "=r" (res) : [w] >> "r" (w)); > > Do all supported versions of the assembler know of the popcnt > instruction? That's why is was open coded before. The problem is > Intel and AMD are constantly adding new instructions and it's a long > cycle for the user's assembler to get updated. >
Most likely not. It would be nice to have some more uniform solution to that. I'm wondering if we could use the -Wa option to load some kind of macro package. -hpa