From 33c01206f0bbc1caceaa8e2d4c498ec85a46dd18 Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Thu, 9 Mar 2023 09:21:01 +0100 Subject: [PATCH] Added option for lax vector conversions when compiling Helium code. In relation with issue #58 When HELIUM, MVEF or MVEI are used as cmake options, the option LAXVECTORCONVERSIONS can be set to ON or OFF to enable / disable lax vector conversions in GCC or ArmClang. Currently, CMSIS-DSP won't build if lax vector conversions are disabled. The option is ON by default. --- Source/CMakeLists.txt | 1 + Source/configDsp.cmake | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7d6ff350..c7479a91 100755 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -18,6 +18,7 @@ option(MVEFLOAT16 "Float16 MVE intrinsics supported" OFF) option(DISABLEFLOAT16 "Disable building float16 kernels" OFF) option(HOST "Build for host" OFF) option(AUTOVECTORIZE "Prefer autovectorizable code to one using C intrinsics" OFF) +option(LAXVECTORCONVERSIONS "Lax vector conversions" ON) # Select which parts of the CMSIS-DSP must be compiled. # There are some dependencies between the parts but they are not tracked diff --git a/Source/configDsp.cmake b/Source/configDsp.cmake index 1c047076..c7f2cd32 100644 --- a/Source/configDsp.cmake +++ b/Source/configDsp.cmake @@ -50,7 +50,13 @@ endif() if (MVEI OR MVEF OR HELIUM) # By default, GCC does not enable implicit conversion between vectors of different numbers or types of elements # which is required by some code in CMSIS-DSP - target_compile_options(${project} PRIVATE $<$:-flax-vector-conversions>) + if (LAXVECTORCONVERSIONS) + target_compile_options(${project} PRIVATE $<$:-flax-vector-conversions>) + target_compile_options(${project} PRIVATE $<$:-flax-vector-conversions=all>) + else() + target_compile_options(${project} PRIVATE $<$:-fno-lax-vector-conversions>) + target_compile_options(${project} PRIVATE $<$:-flax-vector-conversions=none>) + endif() endif() if (DISABLEFLOAT16)