Skip to content

Commit ac698ce

Browse files
authored
Add compiler options for ARM64 SVE targets in DYNAMIC_ARCH builds
1 parent 4d0b7fb commit ac698ce

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

cmake/system.cmake

+22
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,29 @@ if (DEFINED TARGET)
280280
if (${TARGET} STREQUAL POWER8)
281281
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math")
282282
endif()
283+
284+
if (${TARGET} STREQUAL NEOVERSEV1)
285+
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
286+
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4)
287+
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.4-a+sve -mtune=neoverse-v1")
288+
else ()
289+
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${GCC_VERSION} does not support Neoverse V1.")
290+
endif()
291+
endif()
292+
if (${TARGET} STREQUAL NEOVERSEN2)
293+
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
294+
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4)
295+
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2")
296+
else ()
297+
message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} {GCC_VERSION} does not support Neoverse N2.")
298+
endif()
299+
endif()
300+
if (${TARGET} STREQUAL ARMV8SVE)
301+
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.2-a+sve")
302+
endif()
303+
283304
endif()
305+
284306
if (DEFINED BINARY)
285307
message(STATUS "Compiling a ${BINARY}-bit binary.")
286308
endif ()

0 commit comments

Comments
 (0)