aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/x86
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2013-08-20 16:36:46 +0200
committerDiego Biurrun <diego@biurrun.de>2013-08-28 23:54:14 +0200
commit8410d6e93c2e074881f1c7b7e4cdefd2e497d52e (patch)
treee4c6894a2f123b57077c5cc79eeb40aec21c2069 /libavutil/x86
parentb78b10c4b78b696927f2801cf2d9f193b4eff28b (diff)
downloadffmpeg-8410d6e93c2e074881f1c7b7e4cdefd2e497d52e.tar.gz
avutil: Refactor CPU extension availability macros
Diffstat (limited to 'libavutil/x86')
-rw-r--r--libavutil/x86/cpu.h54
1 files changed, 26 insertions, 28 deletions
diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
index e4f6f0bd5a..5a3ad8a672 100644
--- a/libavutil/x86/cpu.h
+++ b/libavutil/x86/cpu.h
@@ -21,38 +21,36 @@
#include "config.h"
#include "libavutil/cpu.h"
-
-#define CPUEXT(flags, suffix, cpuext) \
- (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
+#include "libavutil/cpu_internal.h"
#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
-#define EXTERNAL_AMD3DNOW(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOW)
-#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOWEXT)
-#define EXTERNAL_MMX(flags) CPUEXT(flags, _EXTERNAL, MMX)
-#define EXTERNAL_MMXEXT(flags) CPUEXT(flags, _EXTERNAL, MMXEXT)
-#define EXTERNAL_SSE(flags) CPUEXT(flags, _EXTERNAL, SSE)
-#define EXTERNAL_SSE2(flags) CPUEXT(flags, _EXTERNAL, SSE2)
-#define EXTERNAL_SSE3(flags) CPUEXT(flags, _EXTERNAL, SSE3)
-#define EXTERNAL_SSSE3(flags) CPUEXT(flags, _EXTERNAL, SSSE3)
-#define EXTERNAL_SSE4(flags) CPUEXT(flags, _EXTERNAL, SSE4)
-#define EXTERNAL_SSE42(flags) CPUEXT(flags, _EXTERNAL, SSE42)
-#define EXTERNAL_AVX(flags) CPUEXT(flags, _EXTERNAL, AVX)
-#define EXTERNAL_FMA4(flags) CPUEXT(flags, _EXTERNAL, FMA4)
-
-#define INLINE_AMD3DNOW(flags) CPUEXT(flags, _INLINE, AMD3DNOW)
-#define INLINE_AMD3DNOWEXT(flags) CPUEXT(flags, _INLINE, AMD3DNOWEXT)
-#define INLINE_MMX(flags) CPUEXT(flags, _INLINE, MMX)
-#define INLINE_MMXEXT(flags) CPUEXT(flags, _INLINE, MMXEXT)
-#define INLINE_SSE(flags) CPUEXT(flags, _INLINE, SSE)
-#define INLINE_SSE2(flags) CPUEXT(flags, _INLINE, SSE2)
-#define INLINE_SSE3(flags) CPUEXT(flags, _INLINE, SSE3)
-#define INLINE_SSSE3(flags) CPUEXT(flags, _INLINE, SSSE3)
-#define INLINE_SSE4(flags) CPUEXT(flags, _INLINE, SSE4)
-#define INLINE_SSE42(flags) CPUEXT(flags, _INLINE, SSE42)
-#define INLINE_AVX(flags) CPUEXT(flags, _INLINE, AVX)
-#define INLINE_FMA4(flags) CPUEXT(flags, _INLINE, FMA4)
+#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
+#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
+#define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX)
+#define EXTERNAL_MMXEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT)
+#define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE)
+#define EXTERNAL_SSE2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2)
+#define EXTERNAL_SSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3)
+#define EXTERNAL_SSSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
+#define EXTERNAL_SSE4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
+#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
+#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
+#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
+
+#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)
+#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT)
+#define INLINE_MMX(flags) CPUEXT_SUFFIX(flags, _INLINE, MMX)
+#define INLINE_MMXEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, MMXEXT)
+#define INLINE_SSE(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE)
+#define INLINE_SSE2(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE2)
+#define INLINE_SSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE3)
+#define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
+#define INLINE_SSE4(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE4)
+#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
+#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX)
+#define INLINE_FMA4(flags) CPUEXT_SUFFIX(flags, _INLINE, FMA4)
void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
void ff_cpu_xgetbv(int op, int *eax, int *edx);