[FFmpeg-devel] [PATCH v5] gcc: Don't disable '-ftree-vectorize' if gcc version higher than 13.
Martin Storsjö
martin at martin.st
Fri Jun 13 11:42:11 EEST 2025
On Fri, 13 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 was originally added in commit
> 973859f5230e (2009). A previous attempt to enable `-ftree-vectorize`
> was made in commit cb8646af24bd (2016), but it was reverted in
> fd6dbc53855f. The reason for the revert was that the inline x86 CABAC
> assembly code caused compiler errors ??? the compiler would run out of
> available registers during vectorization, making it unable to compile
> some functions.
>
> In commit 182663a58a7a (2023), the problematic CABAC function was made
> non-inline. This significantly reduces the risk of register exhaustion
> caused by inlining large assembly blocks, making the vectorizer safer
> to enable for other functions.
>
> Given improvements in GCC's vectorizer and the mitigation of the
> original issue, we now re-enable `-ftree-vectorize` for GCC version 13
> and above.
>
> Version log:
> Only allow GCC versions >= 13 to use -ftree-vectorize.
> Modify the commit description.
> Add historical context and rationale for the change.
>
> Disscussion see:
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20250521061750.54882-1-jiawei@iscas.ac.cn/
>
>
> Signed-off-by: Jiawei <jiawei at iscas.ac.cn>
> ---
> configure | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Thanks; I'm ok with this version. Whoever applies it can touch up the
commit message to remove the ???? word (maybe just replace it with an
"as"), it sounds reasonably right like that.
// Martin
More information about the ffmpeg-devel
mailing list