diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h index cdd67ddbb5..bb7c341341 100644 --- a/libavutil/x86/timer.h +++ b/libavutil/x86/timer.h @@ -30,7 +30,12 @@ static inline uint64_t read_time(void) { uint32_t a, d; - __asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); + __asm__ volatile( +#if ARCH_X86_64 || defined(__SSE2__) + "lfence \n\t" +#endif + "rdtsc \n\t" + : "=a" (a), "=d" (d)); return ((uint64_t)d << 32) + a; }