diff options
author | James Almer <jamrial@gmail.com> | 2014-02-22 02:47:02 -0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-22 17:26:00 +0100 |
commit | 0bc3de19ffe296254f214dc7615e624d8e401bcb (patch) | |
tree | baf6c701eb1d0811e9469360c39eed5f2d9e20e6 /libavutil/x86 | |
parent | a2af8eddab75f1eac712411e4dde89823c0845e8 (diff) | |
download | ffmpeg-0bc3de19ffe296254f214dc7615e624d8e401bcb.tar.gz |
x86: add detection for Bit Manipulation Instruction sets
Based on x264 code
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/x86')
-rw-r--r-- | libavutil/x86/cpu.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 333b0f805f..e0b4c89062 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -137,16 +137,22 @@ int ff_get_cpu_flags_x86(void) rval |= AV_CPU_FLAG_FMA3; } } -#if HAVE_AVX2 +#endif /* HAVE_AVX */ +#endif /* HAVE_SSE */ if (max_std_level >= 7) { cpuid(7, eax, ebx, ecx, edx); +#if HAVE_AVX2 if (ebx&0x00000020) rval |= AV_CPU_FLAG_AVX2; - /* TODO: BMI1/2 */ - } #endif /* HAVE_AVX2 */ -#endif /* HAVE_AVX */ -#endif /* HAVE_SSE */ + /* BMI1/2 don't need OS support */ + if (ebx&0x00000008) + { + rval |= AV_CPU_FLAG_BMI1; + if (ebx&0x00000100) + rval |= AV_CPU_FLAG_BMI2; + } + } } cpuid(0x80000000, max_ext_level, ebx, ecx, edx); |