Skip to content

Commit

Permalink
Pass -fno-lax-vector-conversions for AArch64 Clang builds (#427)
Browse files Browse the repository at this point in the history
By default Clang allows implicit conversions between Arm vector types
(e.g. between `int8x16_t` and `int16x8_t`) however GCC and other
compilers do not.

To avoid accidentally adding code that breaks compatibility in this way,
pass `-fno-lax-vector-conversions` when compiling with Clang to disable
this implicit casting.
  • Loading branch information
georges-arm authored Oct 7, 2024
1 parent 0e7d4d3 commit 069013e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ if( ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64\|arm"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64\|armv" )
AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86\|x64" )
set( VVENC_ARM_SIMD_DEFAULT TRUE )

# Avoid non-portable type casting in Arm vector kernels.
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-lax-vector-conversions" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-lax-vector-conversions" )
endif()
endif()

# we enable x86 intrinsics for all target architectures, because they are implemented through simd-everywhere on non-x86
Expand Down

0 comments on commit 069013e

Please sign in to comment.