[FFmpeg-devel] 6c6ac9cb "avutil/x86/intmath: Use tzcnt in place of bsf."

Hans Wennborg hans at chromium.org
Tue Nov 17 02:12:42 CET 2015


Hello ffmpeg developers,

This commit [1] is causing problems when compiling with Clang on Windows:

..\..\third_party\ffmpeg\libavutil/x86/intmath.h(53,33) :  error:
always_inline function '__tzcnt_u32' requires target feature 'bmi',
but would be inlined into function 'ff_ctzll_x86' that is compiled
without support for 'bmi'
    return ((uint32_t)v == 0) ? _tzcnt_u32((uint32_t)(v >> 32)) + 32 :
_tzcnt_u32((uint32_t)v);
                                ^

Essentially the compiler is saying that it won't allow using this
intrinsic unless compiling for a target that supports BMI.

Is there a performance reason for using __tzcnt_u32 instead of
_BitScanForward, or was it mainly to simplify the code?

We're working around this in Chromium by #define'ing __tzcnt_u32 to
__builtin_ctz at the moment, but it would be good if we could find a
nicer solution that could be applied upstream.

Cheers,
Hans

 [1]. https://github.com/FFmpeg/FFmpeg/commit/6c6ac9cb17c4944514bde833f2fa8aa8dafa974a


More information about the ffmpeg-devel mailing list