32: Set mavx and mavx2 based on CMake checks
This commit is contained in:
@@ -2,6 +2,16 @@ include(FetchContent)
|
||||
include(FindAVX)
|
||||
add_library(trigdx reference.cpp lookup.cpp)
|
||||
|
||||
if(HAVE_AVX)
|
||||
target_compile_definitions(trigdx PUBLIC HAVE_AVX)
|
||||
target_compile_options(trigdx PUBLIC -mavx)
|
||||
endif()
|
||||
|
||||
if(HAVE_AVX2)
|
||||
target_compile_definitions(trigdx PUBLIC HAVE_AVX2)
|
||||
target_compile_options(trigdx PUBLIC -mavx2)
|
||||
endif()
|
||||
|
||||
target_include_directories(trigdx PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
if(HAVE_AVX)
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
|
||||
#include "trigdx/lookup_avx.hpp"
|
||||
|
||||
#if defined(HAVE_AVX) && !defined(__AVX__)
|
||||
static_assert(HAVE_AVX == 0, "__AVX__ should be defined when HAVE_AVX is defined, check compile flags (-mavx)");
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_AVX2) && !defined(__AVX2__)
|
||||
static_assert(HAVE_AVX2 == 0, "__AVX__2 should be defined when HAVE_AVX2 is defined, check compile flags (-mavx2)");
|
||||
#endif
|
||||
|
||||
template <std::size_t NR_SAMPLES> struct LookupAVXBackend<NR_SAMPLES>::Impl {
|
||||
std::vector<float> lookup;
|
||||
static constexpr std::size_t MASK = NR_SAMPLES - 1;
|
||||
|
||||
Reference in New Issue
Block a user