[FFmpeg-cvslog] avutil/x86/intmath: use bzhi gcc builtin in av_mod_uintp2()

James Almer git at videolan.org
Sat Jun 27 17:57:37 CEST 2015


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Jun 27 12:50:09 2015 -0300| [1e51e517be0acf1a5386a817706d0d0f605c4688] | committer: James Almer

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

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e51e517be0acf1a5386a817706d0d0f605c4688
---

 libavutil/x86/intmath.h |    7 +++++++
 1 file changed, 7 insertions(+)

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__ */
 



More information about the ffmpeg-cvslog mailing list