You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
x86/cpu: implement support for cpuid through intrinsics
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
committed by
Martin Storsjö
parent
3f150ffba3
commit
c0ee695bd7
2
configure
vendored
2
configure
vendored
@@ -1061,6 +1061,7 @@ HAVE_LIST="
|
|||||||
cbrtf
|
cbrtf
|
||||||
closesocket
|
closesocket
|
||||||
cmov
|
cmov
|
||||||
|
cpuid
|
||||||
dcbzl
|
dcbzl
|
||||||
dev_bktr_ioctl_bt848_h
|
dev_bktr_ioctl_bt848_h
|
||||||
dev_bktr_ioctl_meteor_h
|
dev_bktr_ioctl_meteor_h
|
||||||
@@ -2744,6 +2745,7 @@ elif enabled sparc; then
|
|||||||
elif enabled x86; then
|
elif enabled x86; then
|
||||||
|
|
||||||
check_code ld immintrin.h "__xgetbv(0)" && enable xgetbv
|
check_code ld immintrin.h "__xgetbv(0)" && enable xgetbv
|
||||||
|
check_code ld intrin.h "int info[4]; __cpuid(info, 0)" && enable cpuid
|
||||||
check_code ld intrin.h "__rdtsc()" && enable rdtsc
|
check_code ld intrin.h "__rdtsc()" && enable rdtsc
|
||||||
|
|
||||||
check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
|
check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "libavutil/x86_cpu.h"
|
#include "libavutil/x86_cpu.h"
|
||||||
#include "libavutil/cpu.h"
|
#include "libavutil/cpu.h"
|
||||||
|
|
||||||
|
#if HAVE_INLINE_ASM
|
||||||
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
|
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
|
||||||
#define cpuid(index, eax, ebx, ecx, edx) \
|
#define cpuid(index, eax, ebx, ecx, edx) \
|
||||||
__asm__ volatile ( \
|
__asm__ volatile ( \
|
||||||
@@ -33,6 +34,19 @@
|
|||||||
"xchg %%"REG_b", %%"REG_S \
|
"xchg %%"REG_b", %%"REG_S \
|
||||||
: "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
|
: "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
|
||||||
: "0" (index))
|
: "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
|
#if HAVE_INLINE_ASM
|
||||||
#define xgetbv(index, eax, edx) \
|
#define xgetbv(index, eax, edx) \
|
||||||
|
Reference in New Issue
Block a user