On 10.03.2021 17:13, RĂ©mi Bernon wrote:
Apparently clang >= 4.0.0 has __rdtsc (but not __rdtscp). Can we just assume clang >= 4.0.0 is used and something like that would be acceptable instead?
There is __has_builtin(), which would be cleaner in this case, IMHO.
Both compilers ship __rdtscp in ia32intrin.h header (gcc also __rdtscp, which clang doesn't need). I was considering something like this inside our intrin.h:
#if defined(__i386__) || defined(__x86_64__)
# include <x86intrin.h>
#endif
I believe that this should solve your problem. This rises some compatibility concerns, but I think it may be fine. It's shipped with compilers themselves for all platforms (not by mingw-w64).
Jacek