summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2015-06-27 12:50:09 -0300
committerJames Almer <jamrial@gmail.com>2015-06-27 12:56:55 -0300
commit1e51e517be0acf1a5386a817706d0d0f605c4688 (patch)
treebda6efa9bb0ea4827a242d852869df3d931d3d00 /libavutil
parent5cccbc3b74b2f8a838b643dec6fab5bf77918e1f (diff)
downloadffmpeg-streaming-1e51e517be0acf1a5386a817706d0d0f605c4688.zip
ffmpeg-streaming-1e51e517be0acf1a5386a817706d0d0f605c4688.tar.gz
avutil/x86/intmath: use bzhi gcc builtin in av_mod_uintp2()
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/x86/intmath.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index c42fa83..85f15a4 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -39,6 +39,12 @@
#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
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
return x;
}
}
+#endif /* AV_GCC_VERSION_AT_LEAST */
#endif /* __BMI2__ */
OpenPOWER on IntegriCloud