kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 3888d41b2d5f82c5b92f10ddbf98b275e00ce6ea
parent 72429b0ac086a73e8181cb754677f72f2b77d917
Author: [email protected] <[email protected]>
Date:   Thu, 11 Nov 2021 11:14:29 +0000

CLANG_ARG_PREFIX

Diffstat:
MCMakeLists.txt | 20++++++++++++--------
Mcapi/CMakeLists.txt | 6+++---
Mexamples/CMakeLists.txt | 2+-
Minclude/kfr/dft/impl/fft-impl.hpp | 8++++++--
Minclude/kfr/io/impl/audiofile-impl.cpp | 1+
Mtests/CMakeLists.txt | 2+-
Mtests/dft_test.cpp | 2+-
Mtests/generate_data.cpp | 3---
Mtools/CMakeLists.txt | 2+-
9 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with KFR. -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) project(kfr CXX) @@ -121,6 +121,12 @@ else () set(PTHREAD_LIB pthread) endif () +if (MSVC AND CLANG) + set(CLANG_ARG_PREFIX "SHELL:-Xclang ") +else () + set(CLANG_ARG_PREFIX "") +endif () + # KFR library add_library(kfr INTERFACE) target_sources(kfr INTERFACE ${KFR_SRC}) @@ -130,10 +136,8 @@ if (APPLE) target_compile_options(kfr INTERFACE -faligned-allocation) endif () if (NOT IOS) - if (CLANG) - target_compile_options(kfr INTERFACE "SHELL:-Xclang -mstackrealign") - elseif (NOT MSVC) - target_compile_options(kfr INTERFACE -mstackrealign) + if (NOT MSVC OR CLANG) + target_compile_options(kfr INTERFACE "${CLANG_ARG_PREFIX}-mstackrealign") endif () endif () if (MSVC) @@ -148,10 +152,10 @@ if (KFR_STD_COMPLEX) target_compile_definitions(kfr INTERFACE -DKFR_STD_COMPLEX) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(kfr INTERFACE -Wno-ignored-qualifiers) + target_compile_options(kfr INTERFACE -Wno-ignored-qualifiers -Wno-psabi) endif () if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(kfr INTERFACE -Wno-c++1z-extensions) + target_compile_options(kfr INTERFACE -Wno-c++1z-extensions -Wno-psabi) endif () if (NOT ENABLE_DFT) @@ -180,7 +184,7 @@ endfunction () if (ENABLE_DFT) - set(KFR_DFT_DEFS "SHELL:-Xclang -ffp-contract=fast") + set(KFR_DFT_DEFS "${CLANG_ARG_PREFIX}-ffp-contract=fast") if (ENABLE_DFT_MULTIARCH) add_library(kfr_dft INTERFACE) diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with KFR. -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) if (WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) @@ -57,7 +57,7 @@ function (add_c_library ARCH) ${CMAKE_CURRENT_SOURCE_DIR}/../include/kfr/dsp/impl/dsp-impl.cpp) target_link_libraries(kfr_capi_${ARCH} kfr) target_set_arch(kfr_capi_${ARCH} PRIVATE ${ARCH}) - target_compile_options(kfr_capi_${ARCH} PRIVATE "SHELL:-Xclang -ffp-contract=fast") + target_compile_options(kfr_capi_${ARCH} PRIVATE "${CLANG_ARG_PREFIX}-ffp-contract=fast") target_link_libraries(kfr_capi_all INTERFACE kfr_capi_${ARCH}) if (NOT WIN32) @@ -69,7 +69,7 @@ function (add_c_library ARCH) PROPERTY POSITION_INDEPENDENT_CODE 1) target_link_libraries(kfr_capi_${ARCH}_pic kfr) target_set_arch(kfr_capi_${ARCH}_pic PRIVATE ${ARCH}) - target_compile_options(kfr_capi_${ARCH}_pic PRIVATE "SHELL:-Xclang -ffp-contract=fast") + target_compile_options(kfr_capi_${ARCH}_pic PRIVATE "${CLANG_ARG_PREFIX}-ffp-contract=fast") target_link_libraries(kfr_capi_all_pic INTERFACE kfr_capi_${ARCH}_pic) endif () diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with KFR. -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) # Binary output directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin) diff --git a/include/kfr/dft/impl/fft-impl.hpp b/include/kfr/dft/impl/fft-impl.hpp @@ -1030,9 +1030,13 @@ to_fmt(size_t real_size, const complex<T>* rtwiddle, complex<T>* out, const comp } template <typename T> -#ifdef CMT_ARCH_X32 -// Fix Clang 8.0 bug +#if (defined CMT_ARCH_X32 && defined CMT_ARCH_X86 && defined __clang__) && ((defined __APPLE__) || (__clang_major__ == 8)) +// Fix for Clang 8.0 bug (x32 with FMA instructions) +// Xcode has different versions but x86 is very rare on macOS these days, +// so disable inlining and FMA for x32 macOS and Clang 8.x __attribute__((target("no-fma"), flatten, noinline)) +#else +KFR_INTRINSIC #endif void from_fmt(size_t real_size, complex<T>* rtwiddle, complex<T>* out, const complex<T>* in, dft_pack_format fmt) diff --git a/include/kfr/io/impl/audiofile-impl.cpp b/include/kfr/io/impl/audiofile-impl.cpp @@ -27,6 +27,7 @@ #include "../audiofile.hpp" CMT_PRAGMA_GNU(GCC diagnostic push) CMT_PRAGMA_GNU(GCC diagnostic ignored "-Wimplicit-fallthrough") +CMT_PRAGMA_GNU(GCC diagnostic ignored "-Wunused-function") #ifndef KFR_DISABLE_WAV #define DR_WAV_NO_STDIO diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with KFR. -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) add_definitions(-DKFR_TESTING=1) diff --git a/tests/dft_test.cpp b/tests/dft_test.cpp @@ -24,7 +24,7 @@ constexpr ctypes_t<float, double> dft_float_types{}; constexpr ctypes_t<float> dft_float_types{}; #endif -#ifdef __clang__ +#if defined(__clang__) && defined(CMT_ARCH_X86) static void full_barrier() { asm volatile("mfence" ::: "memory"); } static void dont_optimize(const void* in) { asm volatile("" : "+m"(in)); } diff --git a/tests/generate_data.cpp b/tests/generate_data.cpp @@ -15,9 +15,6 @@ constexpr size_t points = 10000; constexpr size_t points_2arg = 100; -constexpr size_t fuzz_points = 10000; -constexpr size_t fuzz_points_2arg = 100; - using namespace kfr; using testo::test_data_entry; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with KFR. -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) # Binary output directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)