From 2135b7bcb314117957581854ee3c49ee31f8ec10 Mon Sep 17 00:00:00 2001 From: RawNuke <67506722+RawNuke@users.noreply.github.com> Date: Fri, 7 Aug 2026 21:27:59 +0530 Subject: [PATCH 1/3] Guard auto-vectorization flag for GCC only Wrap -ftree-vectorize in *-g++* qmake scope so the flag only reaches GCC compilers. MSVC ignores the unknown flag with D9002 warning, and Clang already auto-vectorizes at -O2. Closes #3863 Signed-off-by: RawNuke <67506722+RawNuke@users.noreply.github.com> --- Jamulus.pro | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jamulus.pro b/Jamulus.pro index cf37aecca8..71af171018 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -1175,8 +1175,13 @@ contains(CONFIG, "opus_shared_lib") { } } -# Always enable auto vectorization -QMAKE_CXXFLAGS+=-ftree-vectorize +# GCC enables -ftree-vectorize at -O3, and also at -O2 from GCC 12 on. Setting it +# explicitly keeps vectorization on for GCC builds that would not enable it by +# default. Clang already vectorizes and MSVC would warn on the flag, so scope it +# to GCC mkspecs (linux-g++, win32-g++, ...). (#3863) +*-g++* { + QMAKE_CXXFLAGS += -ftree-vectorize +} # disable version check if requested (#370) contains(CONFIG, "disable_version_check") { From f9d463a385ec541659571319a9c2c0ecad2d24df Mon Sep 17 00:00:00 2001 From: RawNuke <67506722+RawNuke@users.noreply.github.com> Date: Sun, 9 Aug 2026 19:51:56 +0530 Subject: [PATCH 2/3] Correct cost-model comment for -ftree-vectorize scope The explicit flag is not redundant on GCC 12+: it lifts the -O2 cost model from very-cheap to cheap. On GCC <= 11 it lands at cheap as well, not dynamic. Confirmed by mcfnord's -Q --help=optimizers measurement on gcc 11.5, 13.3, and aarch64 14.2. No -fvect-cost-model= or -ffast-math needed. (#3863) --- Jamulus.pro | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jamulus.pro b/Jamulus.pro index 71af171018..fdefc1e235 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -1175,10 +1175,12 @@ contains(CONFIG, "opus_shared_lib") { } } -# GCC enables -ftree-vectorize at -O3, and also at -O2 from GCC 12 on. Setting it -# explicitly keeps vectorization on for GCC builds that would not enable it by -# default. Clang already vectorizes and MSVC would warn on the flag, so scope it -# to GCC mkspecs (linux-g++, win32-g++, ...). (#3863) +# Scope -ftree-vectorize to GCC mkspecs (linux-g++, win32-g++, ...). Clang already +# auto-vectorizes and MSVC warns on the unknown flag (#3863). On every current GCC +# the explicit flag turns vectorization on at the 'cheap' cost model: on GCC <= 11 +# it raises -O2 from scalar, and on GCC 12+ it lifts the -O2 default from +# 'very-cheap' to 'cheap'. That vectorizes the audio mixing loops with no +# -ffast-math needed. *-g++* { QMAKE_CXXFLAGS += -ftree-vectorize } From 4124988b9f5d5908b93d74dc44e9c00a7bd1afd0 Mon Sep 17 00:00:00 2001 From: RawNuke <67506722+RawNuke@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:00:36 +0530 Subject: [PATCH 3/3] Trim the -ftree-vectorize comment to the essential reason Shorten per maintainer request: scope to GCC (Clang auto-vectorizes, MSVC warns), and note the flag raises the -O2 cost model to cheap, which is what vectorizes the mixer loops on GCC 11 through 14. (#3863) --- Jamulus.pro | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jamulus.pro b/Jamulus.pro index fdefc1e235..3c75c9906f 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -1175,12 +1175,9 @@ contains(CONFIG, "opus_shared_lib") { } } -# Scope -ftree-vectorize to GCC mkspecs (linux-g++, win32-g++, ...). Clang already -# auto-vectorizes and MSVC warns on the unknown flag (#3863). On every current GCC -# the explicit flag turns vectorization on at the 'cheap' cost model: on GCC <= 11 -# it raises -O2 from scalar, and on GCC 12+ it lifts the -O2 default from -# 'very-cheap' to 'cheap'. That vectorizes the audio mixing loops with no -# -ffast-math needed. +# Scope -ftree-vectorize to GCC mkspecs (#3863): Clang already auto-vectorizes +# and MSVC warns on the flag. At -O2 the flag raises GCC's cost model to `cheap`, +# which vectorizes the mixer loops on every current GCC (11 through 14). *-g++* { QMAKE_CXXFLAGS += -ftree-vectorize }