diff --git a/CMakeLists.txt b/CMakeLists.txt index 5887c2d45..ffffe911e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,12 @@ endif() set(NTT_UNROOL_NUM 1 CACHE STRING "Set the unroll number for loop unrolling") add_compile_definitions(NTT_UNROOL_NUM=${NTT_UNROOL_NUM}) +# Workaroud for riscv toolchain auto vectorization bugs in O3 +if (${CMAKE_SYSTEM_PROCESSOR} MATCHES + "(riscv32)|(riscv64)") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") +endif() + include(cmake/dependencies.cmake) set(NNCASE_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/Native/include)