[FFmpeg-devel] [PATCH v4] gcc: Don't disable '-ftree-vectorize' if gcc version higher than 13.
Martin Storsjö
martin at martin.st
Thu Jun 12 14:52:17 EEST 2025
On Thu, 12 Jun 2025, Jiawei wrote:
> This patch modifies the FFmpeg build system to allow GCC to use the
> `-ftree-vectorize` flag when the compiler version is 13 or newer.
> Enabling this flag can improve performance through better loop analysis
> and auto-vectorization (SIMD) opportunities in modern GCC versions.
>
> The explicit -fno-tree-vectorize flag originally added in commit
> 973859f5230e (2009). And a previous attempt to enable '-ftree-vectorize'
> was made in commit cb8646af24bd (2016) but was reverted in
> fd6dbc53855f due to performance regressions. The regressions were
> primarily caused by the complicated inline x86 CABAC assembly code,
> which nearly exhausted all available registers under vectorization
> passes.
No, it wasn't because of performance regressions - it was because the
inline x86 CABAC caused compiler errors, when the compiler was unable to
compile functions due to running out of registers (because of the inline
assembly).
> However, in commit 182663a58a7a (2023), the problematic CABAC function
> was made non-inline. This change significantly reduces the risk of
> register exhaustion during vectorization and means the original problem
> that prompted the revert is no longer as impactful.
>
> This patch contains historical background and rationale by Martin Storsj??,
> who explained why the vectorizer is now try to re-enabled after previously
> failing. Thanks for his summary.
No need to include this paragraph in the commit message - but thanks for
considering attributing the information.
// Martin
More information about the ffmpeg-devel
mailing list