Commit 1e51e517 authored by James Almer's avatar James Almer

avutil/x86/intmath: use bzhi gcc builtin in av_mod_uintp2()

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 5cccbc3b
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
#if defined(__BMI2__) #if defined(__BMI2__)
#if AV_GCC_VERSION_AT_LEAST(5,1)
#define av_mod_uintp2 __builtin_ia32_bzhi_si
#else
/* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
* implement it using inline assembly
*/
#define av_mod_uintp2 av_mod_uintp2_bmi2 #define av_mod_uintp2 av_mod_uintp2_bmi2
static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigned p) static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigned p)
{ {
...@@ -50,6 +56,7 @@ static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigne ...@@ -50,6 +56,7 @@ static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigne
return x; return x;
} }
} }
#endif /* AV_GCC_VERSION_AT_LEAST */
#endif /* __BMI2__ */ #endif /* __BMI2__ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment