aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-02-07 00:29:43 -0300
committerJames Almer <jamrial@gmail.com>2016-02-14 20:04:06 -0300
commit1e8a75fae479c75514f1923a4d697dc07f87ca26 (patch)
tree14584740cced060631f3519ae7aa2e68a2caabe7
parent380980e0d2b3e877452d52fca937c2e96c626383 (diff)
downloadffmpeg-1e8a75fae479c75514f1923a4d697dc07f87ca26.tar.gz
x86: add some more helper macros to check for slow cpuflags
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 73a4589d4b0d97cbd6f8bf8be18b78151b657898)
-rw-r--r--libavutil/cpu_internal.h11
-rw-r--r--libavutil/x86/cpu.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/libavutil/cpu_internal.h b/libavutil/cpu_internal.h
index 2105298843..6c352abe1b 100644
--- a/libavutil/cpu_internal.h
+++ b/libavutil/cpu_internal.h
@@ -24,13 +24,16 @@
#define CPUEXT_SUFFIX(flags, suffix, cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
-#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext) \
+#define CPUEXT_SUFFIX_FAST2(flags, suffix, cpuext, slow_cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
- !((flags) & AV_CPU_FLAG_ ## cpuext ## SLOW))
+ !((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
-#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) \
+#define CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, slow_cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
- ((flags) & AV_CPU_FLAG_ ## cpuext ## SLOW))
+ ((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
+
+#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext) CPUEXT_SUFFIX_FAST2(flags, suffix, cpuext, cpuext)
+#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, cpuext)
#define CPUEXT(flags, cpuext) CPUEXT_SUFFIX(flags, , cpuext)
#define CPUEXT_FAST(flags, cpuext) CPUEXT_SUFFIX_FAST(flags, , cpuext)
diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
index dc102c6015..f171037f1c 100644
--- a/libavutil/x86/cpu.h
+++ b/libavutil/x86/cpu.h
@@ -68,8 +68,12 @@
#define EXTERNAL_AVX_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, AVX)
#define EXTERNAL_XOP(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, XOP)
#define EXTERNAL_FMA3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA3)
+#define EXTERNAL_FMA3_FAST(flags) CPUEXT_SUFFIX_FAST2(flags, _EXTERNAL, FMA3, AVX)
+#define EXTERNAL_FMA3_SLOW(flags) CPUEXT_SUFFIX_SLOW2(flags, _EXTERNAL, FMA3, AVX)
#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
#define EXTERNAL_AVX2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX2)
+#define EXTERNAL_AVX2_FAST(flags) CPUEXT_SUFFIX_FAST2(flags, _EXTERNAL, AVX2, AVX)
+#define EXTERNAL_AVX2_SLOW(flags) CPUEXT_SUFFIX_SLOW2(flags, _EXTERNAL, AVX2, AVX)
#define EXTERNAL_AESNI(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AESNI)
#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)