summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2023-03-22 16:40:41 -0400
committerGravatar Morph2023-03-27 17:45:22 -0400
commit981bc8aa1c924eabc55f63f9671324c548c72d59 (patch)
treefb41c166e32bf99e2dd0f96ec92e4b59fed8ce9c
parentcore_timing: Make use of MicroSleep for x64 CPUs (diff)
downloadyuzu-981bc8aa1c924eabc55f63f9671324c548c72d59.tar.gz
yuzu-981bc8aa1c924eabc55f63f9671324c548c72d59.tar.xz
yuzu-981bc8aa1c924eabc55f63f9671324c548c72d59.zip
x64: Simplify RDTSC on non-MSVC compilers
Co-Authored-By: liamwhite <liamwhite@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r--src/common/x64/cpu_wait.cpp13
-rw-r--r--src/common/x64/native_clock.cpp13
2 files changed, 10 insertions, 16 deletions
diff --git a/src/common/x64/cpu_wait.cpp b/src/common/x64/cpu_wait.cpp
index 1fab0bfe8..cfeef6a3d 100644
--- a/src/common/x64/cpu_wait.cpp
+++ b/src/common/x64/cpu_wait.cpp
@@ -33,16 +33,13 @@ __forceinline static void TPAUSE() {
33} 33}
34#else 34#else
35static u64 FencedRDTSC() { 35static u64 FencedRDTSC() {
36 u64 result; 36 u64 eax;
37 u64 edx;
37 asm volatile("lfence\n\t" 38 asm volatile("lfence\n\t"
38 "rdtsc\n\t" 39 "rdtsc\n\t"
39 "shl $32, %%rdx\n\t" 40 "lfence\n\t"
40 "or %%rdx, %0\n\t" 41 : "=a"(eax), "=d"(edx));
41 "lfence" 42 return (edx << 32) | eax;
42 : "=a"(result)
43 :
44 : "rdx", "memory", "cc");
45 return result;
46} 43}
47 44
48static void TPAUSE() { 45static void TPAUSE() {
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 76c66e7ee..277b00662 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -27,16 +27,13 @@ __forceinline static u64 FencedRDTSC() {
27} 27}
28#else 28#else
29static u64 FencedRDTSC() { 29static u64 FencedRDTSC() {
30 u64 result; 30 u64 eax;
31 u64 edx;
31 asm volatile("lfence\n\t" 32 asm volatile("lfence\n\t"
32 "rdtsc\n\t" 33 "rdtsc\n\t"
33 "shl $32, %%rdx\n\t" 34 "lfence\n\t"
34 "or %%rdx, %0\n\t" 35 : "=a"(eax), "=d"(edx));
35 "lfence" 36 return (edx << 32) | eax;
36 : "=a"(result)
37 :
38 : "rdx", "memory", "cc");
39 return result;
40} 37}
41#endif 38#endif
42 39