diff options
author | James Almer <jamrial@gmail.com> | 2014-02-22 04:54:02 +0000 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2014-02-23 15:29:36 +0100 |
commit | d59fcdaff36eb45307a29756c5dd1852034a3f3f (patch) | |
tree | 47304bd6d5fedfb59a866443e75e1feda7155e05 /libavutil/x86 | |
parent | 1b932eb1508f550fac9e911923a0383efda53aa3 (diff) | |
download | ffmpeg-d59fcdaff36eb45307a29756c5dd1852034a3f3f.tar.gz |
x86: add detection for Bit Manipulation Instruction sets
Based on x264 code
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/x86')
-rw-r--r-- | libavutil/x86/cpu.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 95359eeb7b..8be6d94742 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -137,16 +137,21 @@ 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 (ebx&0x00000020) +#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); |