From: Ronald S. Bultje <rsbul...@gmail.com>

Signed-off-by: Diego Biurrun <di...@biurrun.de>
---
 configure           |    2 ++
 libavutil/x86/cpu.c |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 657e6d8..32270db 100755
--- a/configure
+++ b/configure
@@ -1128,6 +1128,7 @@ HAVE_LIST="
     rdtsc
     round
     roundf
+    rweflags
     sched_getaffinity
     sdl
     sdl_video_size
@@ -2750,6 +2751,7 @@ elif enabled x86; then
     check_code ld immintrin.h "_xgetbv(0)" && enable xgetbv
     check_code ld intrin.h "int info[4]; _cpuid(info, 0)" && enable cpuid
     check_code ld intrin.h "__rdtsc()" && enable rdtsc
+    check_code ld intrin.h "unsigned int x = __readeflags()" && enable rweflags
 
     check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
 
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 70e3125..6ddfebd 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -62,6 +62,8 @@
     } while (0)
 #endif /* HAVE_XGETBV */
 
+#if HAVE_INLINE_ASM
+
 #define get_eflags(x)                           \
     __asm__ volatile ("pushfl     \n"           \
                       "pop    %0  \n"           \
@@ -72,6 +74,18 @@
                       "popfl      \n"           \
                       :: "r"(x))
 
+#elif HAVE_RWEFLAGS
+
+#include <intrin.h>
+
+#define get_eflags(x)                           \
+    x = __readeflags()
+
+#define set_eflags(x)                           \
+    __writeeflags(x)
+
+#endif /* HAVE_INLINE_ASM */
+
 /* Function to test if multimedia instructions are supported...  */
 int ff_get_cpu_flags_x86(void)
 {
-- 
1.7.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to