2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

native_clock: Internal linkage for FencedRDTSC

__forceinline required on MSVC for function to be inlined
This commit is contained in:
Merry 2022-04-03 00:13:27 +01:00
parent fdd4d019ef
commit 4052bfb4ad

View file

@ -16,15 +16,17 @@
namespace Common { namespace Common {
inline u64 FencedRDTSC() {
#ifdef _MSC_VER #ifdef _MSC_VER
__forceinline static u64 FencedRDTSC() {
_mm_lfence(); _mm_lfence();
_ReadWriteBarrier(); _ReadWriteBarrier();
const u64 result = __rdtsc(); const u64 result = __rdtsc();
_mm_lfence(); _mm_lfence();
_ReadWriteBarrier(); _ReadWriteBarrier();
return result; return result;
}
#else #else
static u64 FencedRDTSC() {
u64 result; u64 result;
asm volatile("lfence\n\t" asm volatile("lfence\n\t"
"rdtsc\n\t" "rdtsc\n\t"
@ -35,8 +37,8 @@ inline u64 FencedRDTSC() {
: :
: "rdx", "memory", "cc"); : "rdx", "memory", "cc");
return result; return result;
#endif
} }
#endif
u64 EstimateRDTSCFrequency() { u64 EstimateRDTSCFrequency() {
// Discard the first result measuring the rdtsc. // Discard the first result measuring the rdtsc.