From: "Ronald S. Bultje" <[email protected]>

---
 configure            |    9 +++++++++
 libavutil/internal.h |    7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 351d8a0..4fc20a2 100755
--- a/configure
+++ b/configure
@@ -1118,7 +1118,9 @@ HAVE_LIST="
     MapViewOfFile
     memalign
     mkstemp
+    mm_empty
     mmap
+    mmintrin_h
     nanosleep
     netinet_sctp_h
     poll_h
@@ -2646,6 +2648,13 @@ check_cc <<EOF && enable inline_asm
 void foo(void) { __asm__ volatile ("" ::); }
 EOF
 
+if check_header mmintrin.h; then
+    check_cc <<EOF && enable mm_empty
+#include <mmintrin.h>
+int main (void) { _mm_empty(); return 0; }
+EOF
+fi
+
 _restrict=
 for restrict_keyword in restrict __restrict__ __restrict; do
     check_cc <<EOF && _restrict=$restrict_keyword && break
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 41e8a9a..e8bcca5 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -231,7 +231,7 @@ struct AVDictionary {
 #   define ONLY_IF_THREADS_ENABLED(x) NULL
 #endif
 
-#if HAVE_MMX
+#if HAVE_MMX && HAVE_INLINE_ASM
 /**
  * Empty mmx state.
  * this must be called between any dsp function and float/double code.
@@ -241,8 +241,11 @@ static av_always_inline void emms_c(void)
 {
     __asm__ volatile ("emms" ::: "memory");
 }
+#elif HAVE_MMX && HAVE_MM_EMPTY
+#   include <mmintrin.h>
+#   define emms_c _mm_empty
 #else /* HAVE_MMX */
-#define emms_c()
+#   define emms_c()
 #endif /* HAVE_MMX */
 
 #endif /* AVUTIL_INTERNAL_H */
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to