Skip to content

Commit 8d44c30

Browse files
authored
Merge pull request #1165 from ACSimon33/fno-tree-loop-vectorize
Disable loop vectorization for gfortran on ARM
2 parents d502606 + 54726b8 commit 8d44c30

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CMAKE/CheckLAPACKCompilerFlags.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ macro(CheckLAPACKCompilerFlags)
5959
add_compile_definitions("$<$<COMPILE_LANGUAGE:C>:FORTRAN_STRLEN=int>")
6060
endif()
6161

62+
# Disabling loop vectorization for GNU Fortran versions affected by
63+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408. See issue
64+
# https://github.com/Reference-LAPACK/lapack/issues/1160 as well.
65+
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm|arm64|aarch64")
66+
if((CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0" AND
67+
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "14.4") OR
68+
(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0" AND
69+
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "15.2"))
70+
message(WARNING
71+
"Disabling loop vectorization for GNU Fortran (14.0-14.4, 15.0-15.2) on ARM "
72+
"due to a compiler bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408). "
73+
"For full performance, consider changing to a different compiler or compiler version.")
74+
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-fno-tree-loop-vectorize>")
75+
endif()
76+
endif()
77+
6278
# Intel Fortran
6379
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
6480
set(FPE_EXIT_FLAG "[-/]fpe(-all=|)0")

0 commit comments

Comments
 (0)