diff --git a/libavutil/internal.h b/libavutil/internal.h
index cf18bdb700d5f264fa503fac095493d9db32bb64..4bb6b05d526cd31197a3ac4495f88ffbb37c7c67 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -39,6 +39,10 @@
 #include "timer.h"
 #include "dict.h"
 
+#if ARCH_X86
+#   include "x86/emms.h"
+#endif
+
 #ifndef attribute_align_arg
 #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
 #    define attribute_align_arg __attribute__((force_align_arg_pointer))
@@ -154,24 +158,4 @@
 #   define ONLY_IF_THREADS_ENABLED(x) NULL
 #endif
 
-#if HAVE_MMX_INLINE
-/**
- * Empty mmx state.
- * this must be called between any dsp function and float/double code.
- * for example sin(); dsp->idct_put(); emms_c(); cos()
- */
-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
-#elif HAVE_MMX && HAVE_YASM
-#   include "libavutil/x86/emms.h"
-#   define emms_c avpriv_emms_yasm
-#else
-#   define emms_c()
-#endif /* HAVE_MMX_INLINE */
-
 #endif /* AVUTIL_INTERNAL_H */
diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
index 6bb8ca31958af8e72155f2d879caa90efdba9873..56068e581fb8ac157436df7eb7e0c09f9f483a7e 100644
--- a/libavutil/x86/emms.h
+++ b/libavutil/x86/emms.h
@@ -19,6 +19,28 @@
 #ifndef AVUTIL_X86_EMMS_H
 #define AVUTIL_X86_EMMS_H
 
+#include "config.h"
+#include "libavutil/attributes.h"
+
 void avpriv_emms_yasm(void);
 
+#if HAVE_MMX_INLINE
+/**
+ * Empty mmx state.
+ * this must be called between any dsp function and float/double code.
+ * for example sin(); dsp->idct_put(); emms_c(); cos()
+ */
+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
+#elif HAVE_MMX && HAVE_YASM
+#   define emms_c avpriv_emms_yasm
+#else
+#   define emms_c()
+#endif /* HAVE_MMX_INLINE */
+
 #endif /* AVUTIL_X86_EMMS_H */