[PATCH 5/6] include: Add __rdtsc and __rdtscp intrinsics.

Rémi Bernon rbernon at codeweavers.com
Thu Mar 11 04:47:11 CST 2021


On 3/10/21 10:20 PM, Rémi Bernon wrote:
> On 3/10/21 9:44 PM, Jacek Caban wrote:
>> 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
>>
> 
> Ah yes sure, I didn't know these were available in intel intrinsic 
> headers. I guess that would be perfect then.

Except that it has some conflicts with msvcrt _(l)rot[r|l] functions in 
stdlib.h. Can we remove the definitions from there?
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list