@@ -109,9 +109,6 @@ if(MSVC)
109109 set (MSVC_BOOL True )
110110else (MSVC )
111111 set (MSVC_BOOL False )
112- check_cxx_compiler_flag(-march=armv8-a+sve COMPILER_SUPPORTS_SVE)
113- check_cxx_compiler_flag(-march=armv8-a+sve2 COMPILER_SUPPORTS_SVE2)
114- check_cxx_compiler_flag(-march=armv8-a+fp16fml COMPILER_SUPPORTS_FP16FML)
115112endif (MSVC )
116113
117114################################################################################
@@ -290,6 +287,17 @@ endif()
290287################################################################################
291288
292289if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64" )
290+ check_cxx_compiler_flag(-march=armv8.2-a+fp16fml COMPILER_SUPPORTS_FP16FML)
291+ if (COMPILER_SUPPORTS_FP16FML)
292+ set (fbgemm_fml_flags "-march=armv8.2-a+fp16fml" )
293+ endif ()
294+ if (NOT COMPILER_SUPPORTS_FP16FML) # for clang
295+ check_cxx_compiler_flag(-mfp16fml COMPILER_SUPPORTS_FP16FML)
296+ if (COMPILER_SUPPORTS_FP16FML)
297+ set (fbgemm_fml_flags "-march=armv8.2 -mfp16fml" )
298+ endif ()
299+ endif ()
300+
293301 if (NOT COMPILER_SUPPORTS_FP16FML)
294302 message (FATAL_ERROR "The current compiler does not support building FP16FML code" )
295303 endif ()
@@ -309,7 +317,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
309317 -ftree-vectorize
310318 -fno-trapping-math
311319 -Wignored-qualifiers
312- -march=armv8-a+fp16fml
320+ -march=armv8.2 -a+fp16fml
313321 DEFINITIONS
314322 ${fbgemm_arm_defs}
315323 DEPS
@@ -330,6 +338,8 @@ endif()
330338
331339set (FBGEMM_BUILD_SVE False )
332340if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64" )
341+ check_cxx_compiler_flag(-march=armv8-a+sve COMPILER_SUPPORTS_SVE)
342+ check_cxx_compiler_flag(-march=armv8-a+sve2 COMPILER_SUPPORTS_SVE2)
333343 if (COMPILER_SUPPORTS_SVE2)
334344 set (FBGEMM_BUILD_SVE True )
335345 set (fbgemm_sve_flags "-march=armv8-a+sve2" )
0 commit comments