From: "Ronald S. Bultje" <[email protected]>
---
configure | 3 +++
libavutil/x86/cpu.c | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/configure b/configure
index 72c4943..07dbb46 100755
--- a/configure
+++ b/configure
@@ -1120,6 +1120,7 @@ HAVE_LIST="
mkstemp
mm_empty
mmap
+ msvc_inline_asm
nanosleep
netinet_sctp_h
poll_h
@@ -2650,6 +2651,8 @@ check_code cc mmintrin.h "_mm_empty()" && enable mm_empty
check_code cc immintrin.h "xgetbv(0)" && enable xgetbv
check_code cc intrin.h "int info[4]; _cpuid(info, 0)" && enable cpuid
+check_code cc "" "__asm { __asm xor eax, eax }" && enable msvc_inline_asm
+
_restrict=
for restrict_keyword in restrict __restrict__ __restrict; do
check_cc <<EOF && _restrict=$restrict_keyword && break
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 70e3125..6521481 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,25 @@
"popfl \n" \
:: "r"(x))
+#elif HAVE_MSVC_INLINE_ASM
+
+#define get_eflags(x) \
+ __asm { \
+ __asm pushfd \
+ __asm pop x \
+ }
+
+#define set_eflags(x) \
+ do { \
+ x86_reg r = x; \
+ __asm { \
+ __asm push r \
+ __asm popfd \
+ } \
+ } while (0)
+
+#endif /* HAVE_INLINE_ASM */
+
/* Function to test if multimedia instructions are supported... */
int ff_get_cpu_flags_x86(void)
{
--
1.7.9.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel