[FFmpeg-cvslog] x86/cpu: implement get/set_eflags using intrinsics

Ronald S. Bultje git at videolan.org
Tue Jul 10 21:35:44 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Mon Jul  9 02:21:28 2012 +0200| [358d854df80e035c9d47bae21492b51b406dbe68] | committer: Martin Storsjö

x86/cpu: implement get/set_eflags using intrinsics

Signed-off-by: Diego Biurrun <diego at biurrun.de>
Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=358d854df80e035c9d47bae21492b51b406dbe68
---

 configure           |    2 ++
 libavutil/x86/cpu.c |   14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/configure b/configure
index 0f51523..ffb1e7e 100755
--- a/configure
+++ b/configure
@@ -1126,6 +1126,7 @@ HAVE_LIST="
     rdtsc
     round
     roundf
+    rweflags
     sched_getaffinity
     sdl
     sdl_video_size
@@ -2747,6 +2748,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 7d65c60..d3b1bd5 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)
 {



More information about the ffmpeg-cvslog mailing list