From: "Ronald S. Bultje" <[email protected]>
---
configure | 9 +++++++++
libavutil/x86/cpu.c | 14 ++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/configure b/configure
index 35d4406..976b59d 100755
--- a/configure
+++ b/configure
@@ -1062,6 +1062,7 @@ HAVE_LIST="
cbrtf
closesocket
cmov
+ cpuid
dcbzl
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
@@ -1095,6 +1096,7 @@ HAVE_LIST="
immintrin_h
inet_aton
inline_asm
+ intrin_h
io_h
isatty
isinf
@@ -2664,6 +2666,13 @@ int main (void) { _xgetbv(0); return 0; }
EOF
fi
+if check_header intrin.h; then
+ check_cc <<EOF && enable cpuid
+#include <intrin.h>
+int main (void) { int info[4]; _cpuid(info, 0); return 0; }
+EOF
+fi
+
_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 c6c96f0..70e3125 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -25,6 +25,7 @@
#include "libavutil/x86_cpu.h"
#include "libavutil/cpu.h"
+#if HAVE_INLINE_ASM
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
#define cpuid(index, eax, ebx, ecx, edx) \
__asm__ volatile ( \
@@ -33,6 +34,19 @@
"xchg %%"REG_b", %%"REG_S \
: "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
: "0" (index))
+#elif HAVE_CPUID
+#include <intrin.h>
+
+#define cpuid(index, eax, ebx, ecx, edx) \
+ do { \
+ int info[4]; \
+ _cpuid(info, index); \
+ eax = info[0]; \
+ ebx = info[1]; \
+ ecx = info[2]; \
+ edx = info[3]; \
+ } while (0)
+#endif /* HAVE_CPUID */
#if HAVE_INLINE_ASM
#define xgetbv(index, eax, edx) \
--
1.7.9.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel