Skip to content

Commit

Permalink
Fix line ending
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Nov 11, 2024
1 parent 99536a8 commit d8b1fb1
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions cmake/auto_vectorization.cmake
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# The AND_PreSieveTables() function in PreSieve.cpp is important for
# performance and therefore it is important that this function is
# auto-vectorized by the compiler. For GCC & Clang we can enable
# auto vectorization using -ftree-vectorize.

# GCC/Clang enable auto-vectorization with -O2 and -O3, but for -O2
# GCC uses the "very-cheap" cost model which prevents our AND_PreSieveTables()
# function from getting auto vectorized. But compiling with e.g.
# "-O2 -ftree-vectorize -fvect-cost-model=dynamic" fixes this issue.

include(CheckCXXCompilerFlag)

cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS -Werror)
check_cxx_compiler_flag(-ftree-vectorize ftree_vectorize)
cmake_pop_check_state()

if(ftree_vectorize)
list(APPEND PRIMESIEVE_COMPILE_OPTIONS "-ftree-vectorize")

cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS -Werror)
check_cxx_compiler_flag(-fvect-cost-model=dynamic fvect_cost_model)
cmake_pop_check_state()

if(fvect_cost_model)
list(APPEND PRIMESIEVE_COMPILE_OPTIONS "-fvect-cost-model=dynamic")
endif()
endif()
# The AND_PreSieveTables() function in PreSieve.cpp is important for
# performance and therefore it is important that this function is
# auto-vectorized by the compiler. For GCC & Clang we can enable
# auto vectorization using -ftree-vectorize.

# GCC/Clang enable auto-vectorization with -O2 and -O3, but for -O2
# GCC uses the "very-cheap" cost model which prevents our AND_PreSieveTables()
# function from getting auto vectorized. But compiling with e.g.
# "-O2 -ftree-vectorize -fvect-cost-model=dynamic" fixes this issue.

include(CheckCXXCompilerFlag)

cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS -Werror)
check_cxx_compiler_flag(-ftree-vectorize ftree_vectorize)
cmake_pop_check_state()

if(ftree_vectorize)
list(APPEND PRIMESIEVE_COMPILE_OPTIONS "-ftree-vectorize")

cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS -Werror)
check_cxx_compiler_flag(-fvect-cost-model=dynamic fvect_cost_model)
cmake_pop_check_state()

if(fvect_cost_model)
list(APPEND PRIMESIEVE_COMPILE_OPTIONS "-fvect-cost-model=dynamic")
endif()
endif()

0 comments on commit d8b1fb1

Please sign in to comment.