diff options
author | Diego Biurrun <diego@biurrun.de> | 2012-10-03 16:46:17 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-10-04 19:29:14 +0200 |
commit | 1f6d86991f191568d45484f2b3740c2dcd0a7b45 (patch) | |
tree | e1014f6fb0443725e607d7c926337759c0cbf303 /libavutil/x86/cpu.c | |
parent | 65d12900432ac880d764edbbd36818431484a76e (diff) | |
download | ffmpeg-1f6d86991f191568d45484f2b3740c2dcd0a7b45.tar.gz |
x86: Add YASM implementations of cpuid and xgetbv from x264
This allows detecting CPU features with builds that have neither
gcc inline assembly nor the right compiler intrinsics enabled.
Diffstat (limited to 'libavutil/x86/cpu.c')
-rw-r--r-- | libavutil/x86/cpu.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 5de60147c6..fb1dd299bc 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -22,10 +22,21 @@ #include <stdlib.h> #include <string.h> + #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavutil/cpu.h" -#if HAVE_INLINE_ASM +#if HAVE_YASM + +#define cpuid(index, eax, ebx, ecx, edx) \ + ff_cpu_cpuid(index, &eax, &ebx, &ecx, &edx) + +#define xgetbv(index, eax, edx) \ + ff_cpu_xgetbv(index, &eax, &edx) + +#elif 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 ( \ @@ -90,6 +101,10 @@ #define cpuid_test() 1 +#elif HAVE_YASM + +#define cpuid_test ff_cpu_cpuid_test + #elif HAVE_INLINE_ASM || HAVE_RWEFLAGS static int cpuid_test(void) |