From 0d9b1654ecbf480a8ec30487b4a72b886e799474 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 8 Sep 2022 18:03:26 +0300 Subject: [PATCH] asm: Avoid ALU instructions on busy wait cycles --- rpcs3/util/asm.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index 5efe3c0fbb..b10146ff3b 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -358,9 +358,9 @@ namespace utils // Synchronization helper (cache-friendly busy waiting) inline void busy_wait(usz cycles = 3000) { - const u64 start = get_tsc(); + const u64 stop = get_tsc() + cycles; do pause(); - while (get_tsc() - start < cycles); + while (get_tsc() < stop); } // Align to power of 2