From 018f69b69b000d356d6215c505dde104c30aaf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 16 Jun 2023 15:35:29 +0200 Subject: [PATCH] Windows package: stronger compiler optimization flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit – enable maximum optimization (-O3), which in particular triggers code auto-vectorization – raise the minimal architectural requirement to match MSYS2 policy (roughly requires CPUs from ~2006/7+) --- windows/build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/windows/build.sh b/windows/build.sh index 2fbf1b2411..d2c858f6d1 100755 --- a/windows/build.sh +++ b/windows/build.sh @@ -54,6 +54,11 @@ BASENAME=dynare-$VERSION LIB64="$ROOT_DIRECTORY"/deps/lib64 LIB64_MSYS2="$ROOT_DIRECTORY"/deps/lib64-msys2 +# Set compilation flags +# For the architectural baseline, we follow MSYS2: +# https://www.msys2.org/news/#2022-10-18-new-minimum-hardware-requirements-cpus-from-20067 +arch_flags="-march=nocona -msahf -mtune=generic" +export CFLAGS="-O3 $arch_flags" # MSYS2 libraries are now built with -fstack-protector-strong, see: # https://www.msys2.org/news/#2022-10-23-mingw-packages-now-built-with-d_fortify_source2-and-fstack-protector-strong # As of 2023-01-03, when linking against HDF5 (and possibly other libraries), @@ -64,7 +69,8 @@ LIB64_MSYS2="$ROOT_DIRECTORY"/deps/lib64-msys2 # and there seems to be no easy way of linking it statically. # Also note that adding this flag is not necessary when building from MSYS2 shell. # Maybe revisit this once our runners are upgraded to Debian “Bookworm†12. -export CXXFLAGS="-O2 -fstack-protector" +export CXXFLAGS="-O3 $arch_flags -fstack-protector" +export FCFLAGS="-O3 $arch_flags" # Go to source root directory cd .. -- GitLab