google / cpu_features

A cross platform C99 library to get cpu features at runtime.
Apache License 2.0
2.43k stars 258 forks source link

should use builtin_cpu_supports on gnu/linux #72

Open shawnl opened 5 years ago

shawnl commented 5 years ago

i.e. https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions

this should be a tiny bit faster than getauxval() when it is supported.

gchatelet commented 5 years ago

Thx for noticing, the code is indeed quite compact. For now I'm a bit reluctant to add optimizations based on compilers because it will make the code more complicated.

The design of this library is to pay a small price at startup to collect features, but it's not designed to pay the smallest price possible.

I'm happy to implement this change if this issue collects many :+1: reactions though.