diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a4a9a9..22cd44c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: shell: bash run: | ./deps/PawPaw/.github/workflows/bootstrap-deps.sh linux-${{ matrix.target }} - apt-get install -yqq wget + apt-get install -yqq wget zip - name: Setup dependencies (aarch64) if: ${{ matrix.target == 'aarch64' }} shell: bash @@ -417,7 +417,7 @@ jobs: - name: Set up dependencies run: | ./deps/PawPaw/.github/workflows/bootstrap-deps.sh ${{ matrix.target }} - apt-get install -yqq wget + apt-get install -yqq wget zip apt-get clean - name: Set up ccache uses: hendrikmuhs/ccache-action@v1.2 diff --git a/.gitmodules b/.gitmodules index 7ea5657..16f700b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -212,9 +212,6 @@ [submodule "plugins/dBiz"] path = plugins/dBiz url = https://github.com/dBiz/dBiz.git -[submodule "include/simde"] - path = include/simde - url = https://github.com/simd-everywhere/simde.git [submodule "plugins/RebelTech"] path = plugins/RebelTech url = https://github.com/hemmer/rebel-tech-vcv.git diff --git a/Makefile.base.mk b/Makefile.base.mk index a12e14f..27c62b4 100644 --- a/Makefile.base.mk +++ b/Makefile.base.mk @@ -68,6 +68,12 @@ endif ifeq ($(NOSIMD),true) BASE_FLAGS += -DCARDINAL_NOSIMD +else ifeq ($(WASM),true) +BASE_FLAGS += -msse -msse2 -msse3 -msimd128 +else ifeq ($(CPU_ARM32),true) +BASE_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard +else ifeq ($(CPU_I386_OR_X86_64),true) +BASE_FLAGS += -msse -msse2 -msse3 -mfpmath=sse endif ifeq ($(SYSDEPS),true) @@ -109,10 +115,6 @@ BASE_FLAGS += -DSIMDE_FAST_NANS BASE_FLAGS += -DSIMDE_FAST_ROUND_MODE BASE_FLAGS += -DSIMDE_FAST_ROUND_TIES -# unwanted -BASE_FLAGS += -DSIMDE_X86_SSE4_1_H -BASE_FLAGS += -DSIMDE_X86_SSE4_2_H - # ----------------------------------------------------------------------------- # Rack build flags @@ -161,25 +163,8 @@ endif # needed for enabling SSE in pffft ifeq ($(CPU_I386),true) -ifneq ($(NOSIMD),true) BASE_FLAGS += -Di386 endif -endif - -# SIMD must always be enabled, even in debug builds -ifneq ($(NOSIMD),true) -ifeq ($(DEBUG),true) - -ifeq ($(WASM),true) -BASE_FLAGS += -msse -msse2 -msse3 -msimd128 -else ifeq ($(CPU_ARM32),true) -BASE_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard -else ifeq ($(CPU_I386_OR_X86_64),true) -BASE_FLAGS += -msse -msse2 -msse3 -mfpmath=sse -endif - -endif -endif BASE_FLAGS += -I$(abspath $(ROOT)/dpf/dgl/src/nanovg) BASE_FLAGS += -I$(abspath $(ROOT)/dpf/distrho) diff --git a/deps/Makefile b/deps/Makefile index 4d32cd2..cd785bc 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -269,19 +269,6 @@ endif # use custom JUCE from DISTRHO and Carla SURGE_CXX_FLAGS += -I$(abspath ../carla/source/modules) -# SIMD must always be enabled, even in debug builds -ifeq ($(NOSIMD),true) -SURGE_CXX_FLAGS += -DCARDINAL_NOSIMD -else ifeq ($(DEBUG),true) -ifeq ($(WASM),true) -SURGE_CXX_FLAGS += -msse -msse2 -msse3 -msimd128 -else ifeq ($(CPU_ARM32),true) -SURGE_CXX_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard -else ifeq ($(CPU_I386_OR_X86_64),true) -SURGE_CXX_FLAGS += -msse -msse2 -mfpmath=sse -endif -endif - # possibly use fftw? # ifeq ($(shell $(PKG_CONFIG) --exists fftw3 fftw3f && echo true),true) # SURGE_CXX_FLAGS += -DJUCE_DSP_USE_STATIC_FFTW=1 diff --git a/deps/PawPaw b/deps/PawPaw index 1369e1f..7822bb0 160000 --- a/deps/PawPaw +++ b/deps/PawPaw @@ -1 +1 @@ -Subproject commit 1369e1f84e6391df761b5ac5e143ab6841e57f7e +Subproject commit 7822bb0ba1deb75b3010d6efab63a4f854174b56 diff --git a/include/simd-compat/emmintrin.h b/include/simd-compat/emmintrin.h index 1fc6dc0..afe9803 100644 --- a/include/simd-compat/emmintrin.h +++ b/include/simd-compat/emmintrin.h @@ -1,26 +1,19 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once -#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD) +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSE2_NATIVE # include_next #else +# include "mmintrin.h" +# include "xmmintrin.h" # define SIMDE_ENABLE_NATIVE_ALIASES -# include "simde/x86/sse.h" +# include "simde/x86/sse2.h" # undef SIMDE_ENABLE_NATIVE_ALIASES #endif diff --git a/include/simd-compat/immintrin.h b/include/simd-compat/immintrin.h index 3490cb8..d10cbf9 100644 --- a/include/simd-compat/immintrin.h +++ b/include/simd-compat/immintrin.h @@ -1,27 +1,20 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once -#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD) +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSE_NATIVE # include_next #else -# define SIMDE_ENABLE_NATIVE_ALIASES -# include "../simde/simde/x86/sse.h" -# include "../simde/simde/x86/sse2.h" -# undef SIMDE_ENABLE_NATIVE_ALIASES +# include "mmintrin.h" +# include "xmmintrin.h" +# include "emmintrin.h" +# include "pmmintrin.h" +# include "tmmintrin.h" +# include "smmintrin.h" #endif diff --git a/include/simd-compat/mmintrin.h b/include/simd-compat/mmintrin.h index 3ca24af..d4cd4d0 100644 --- a/include/simd-compat/mmintrin.h +++ b/include/simd-compat/mmintrin.h @@ -1,28 +1,17 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once -#if (defined(__i386__) || defined(__x86_64__)) && !defined(CARDINAL_NOSIMD) +#include "simd-compat.h" + +#ifdef SIMDE_X86_MMX_NATIVE # include_next -#elif defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD) -# include #else # define SIMDE_ENABLE_NATIVE_ALIASES -# include "../simde/simde/x86/mmx.h" +# include "simde/x86/mmx.h" # undef SIMDE_ENABLE_NATIVE_ALIASES #endif diff --git a/include/simd-compat/pmmintrin.h b/include/simd-compat/pmmintrin.h index 261316a..e6be1f1 100644 --- a/include/simd-compat/pmmintrin.h +++ b/include/simd-compat/pmmintrin.h @@ -1,51 +1,20 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once -#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD) +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSE3_NATIVE # include_next -# if defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD) -static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) -_mm_set1_pi16(short w) -{ - return __extension__ (__m64){ static_cast(w), static_cast(w) }; -} -# endif #else +# include "mmintrin.h" +# include "xmmintrin.h" +# include "emmintrin.h" # define SIMDE_ENABLE_NATIVE_ALIASES -# include "simde/x86/sse.h" -# include "simde/x86/sse2.h" # include "simde/x86/sse3.h" # undef SIMDE_ENABLE_NATIVE_ALIASES -/* -#elif defined(__ARM_NEON) -# include "../sse2neon/sse2neon.h" - -static inline -void __builtin_ia32_pause() -{ - __asm__ __volatile__("isb\n"); -} - -static inline -__m64 _mm_set1_pi16(short w) -{ - return vreinterpret_s64_s16(vdup_n_s16(w)); -} -*/ #endif diff --git a/include/simd-compat/simd-compat.h b/include/simd-compat/simd-compat.h new file mode 100644 index 0000000..26cc93e --- /dev/null +++ b/include/simd-compat/simd-compat.h @@ -0,0 +1,52 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +// native up to SSE3 +#if (defined(_M_X64) || defined(__amd64__) || defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2)) && !defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD) +# define SIMDE_X86_MMX_NATIVE +# define SIMDE_X86_SSE_NATIVE +# define SIMDE_X86_SSE2_NATIVE +# define SIMDE_X86_SSE3_NATIVE +#else +# define SIMDE_X86_MMX_NO_NATIVE +# define SIMDE_X86_SSE_NO_NATIVE +# define SIMDE_X86_SSE2_NO_NATIVE +# define SIMDE_X86_SSE3_NO_NATIVE +#endif + +// everything else is emulated +#define SIMDE_X86_SSSE3_NO_NATIVE +#define SIMDE_X86_SSE4_1_NO_NATIVE +#define SIMDE_X86_SSE4_2_NO_NATIVE +#define SIMDE_X86_XOP_NO_NATIVE +#define SIMDE_X86_AVX_NO_NATIVE +#define SIMDE_X86_AVX2_NO_NATIVE +#define SIMDE_X86_FMA_NO_NATIVE +#define SIMDE_X86_AVX512F_NO_NATIVE +#define SIMDE_X86_AVX512BF16_NO_NATIVE +#define SIMDE_X86_AVX512BW_NO_NATIVE +#define SIMDE_X86_AVX512VL_NO_NATIVE +#define SIMDE_X86_AVX512DQ_NO_NATIVE +#define SIMDE_X86_AVX512CD_NO_NATIVE +#define SIMDE_X86_AVX5124VNNIW_NO_NATIVE +#define SIMDE_X86_AVX512VNNI_NO_NATIVE +#define SIMDE_X86_AVX512VBMI2_NO_NATIVE +#define SIMDE_X86_AVX512VBMI_NO_NATIVE +#define SIMDE_X86_AVX512BITALG_NO_NATIVE +#define SIMDE_X86_AVX512VPOPCNTDQ_NO_NATIVE +#define SIMDE_X86_AVX512VP2INTERSECT_NO_NATIVE +#define SIMDE_X86_SVML_NO_NATIVE + +// control wasm simd state +#ifdef __EMSCRIPTEN__ +# ifdef CARDINAL_NOSIMD +# define SIMDE_WASM_SIMD128_NO_NATIVE +# else +# define SIMDE_WASM_SIMD128_NATIVE +# endif +#endif diff --git a/include/simd-compat/smmintrin.h b/include/simd-compat/smmintrin.h new file mode 100644 index 0000000..5c6fb9a --- /dev/null +++ b/include/simd-compat/smmintrin.h @@ -0,0 +1,23 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSE4_1_NATIVE +# include_next +#else +# include "mmintrin.h" +# include "xmmintrin.h" +# include "emmintrin.h" +# include "pmmintrin.h" +# include "tmmintrin.h" +# define SIMDE_ENABLE_NATIVE_ALIASES +# include "simde/x86/sse4.1.h" +# include "simde/x86/sse4.2.h" +# undef SIMDE_ENABLE_NATIVE_ALIASES +#endif diff --git a/include/simd-compat/tmmintrin.h b/include/simd-compat/tmmintrin.h new file mode 100644 index 0000000..32b6476 --- /dev/null +++ b/include/simd-compat/tmmintrin.h @@ -0,0 +1,21 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSSE3_NATIVE +# include_next +#else +# include "mmintrin.h" +# include "xmmintrin.h" +# include "emmintrin.h" +# include "pmmintrin.h" +# define SIMDE_ENABLE_NATIVE_ALIASES +# include "simde/x86/ssse3.h" +# undef SIMDE_ENABLE_NATIVE_ALIASES +#endif diff --git a/include/simd-compat/xmmintrin.h b/include/simd-compat/xmmintrin.h index 3500893..237038c 100644 --- a/include/simd-compat/xmmintrin.h +++ b/include/simd-compat/xmmintrin.h @@ -1,26 +1,20 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once -#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD) +#include "simd-compat.h" + +#ifdef SIMDE_X86_SSE_NATIVE # include_next #else +# include "mmintrin.h" # define SIMDE_ENABLE_NATIVE_ALIASES -# include "simde/x86/avx.h" +# include "simde/x86/sse.h" # undef SIMDE_ENABLE_NATIVE_ALIASES +// always use SSE2 mode, as seen in gcc +# include "emmintrin.h" #endif diff --git a/include/simd/common.hpp b/include/simd/common.hpp index 3ff4c8c..0d097bc 100644 --- a/include/simd/common.hpp +++ b/include/simd/common.hpp @@ -1,27 +1,14 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once +#include "mmintrin.h" +#include "xmmintrin.h" #include "emmintrin.h" -#include "immintrin.h" #include "pmmintrin.h" - -#define SIMDE_ENABLE_NATIVE_ALIASES -#include "simde/x86/ssse3.h" -#include "simde/x86/sse4.1.h" -#include "simde/x86/sse4.2.h" +#include "tmmintrin.h" +#include "smmintrin.h" diff --git a/include/simd/functions.hpp b/include/simd/functions.hpp index d90f781..4112df4 100644 --- a/include/simd/functions.hpp +++ b/include/simd/functions.hpp @@ -1,22 +1,12 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2023 Filipe Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the LICENSE file. + * Copyright (C) 2021-2024 Filipe Coelho + * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include "simd/common.hpp" #include_next "simd/functions.hpp" -#undef SIMDE_MM_FROUND_NO_EXC +// #undef SIMDE_MM_FROUND_NO_EXC +// #undef _MM_FROUND_NO_EXC diff --git a/plugins/Makefile b/plugins/Makefile index b1ab7db..945c67b 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -284,7 +284,6 @@ endif ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true) PLUGIN_FILES += Cardinal/src/AudioToCVPitch.cpp # MINIPLUGIN_FILES += Cardinal/src/AudioToCVPitch.cpp -BASE_FLAGS += -DHAVE_FFTW3F endif # -------------------------------------------------------------- @@ -1280,6 +1279,14 @@ BASE_FLAGS += -D'aligned_alloc_16(ptr)'='aligned_alloc(16,ptr)' BASE_FLAGS += -D'aligned_free_16(ptr)'='free(ptr)' endif +ifeq ($(WASM),true) +BASE_FLAGS += -DEIGEN_DONT_VECTORIZE=1 +endif + +ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true) +BASE_FLAGS += -DHAVE_FFTW3F +endif + ifeq ($(shell $(PKG_CONFIG) --exists sndfile && echo true),true) BASE_FLAGS += -DHAVE_SNDFILE endif @@ -1329,10 +1336,6 @@ RTNEURAL_FLAGS += -DSKIP_MINGW_FORMAT RTNEURAL_FLAGS += -DRTNEURAL_DEFAULT_ALIGNMENT=16 RTNEURAL_FLAGS += -DRTNEURAL_USE_EIGEN=1 -ifeq ($(WASM),true) -RTNEURAL_FLAGS += -DEIGEN_DONT_VECTORIZE=1 -endif - RTNEURAL_FLAGS += -ICardinal/src/AIDA-X/RTNeural RTNEURAL_FLAGS += -ICardinal/src/AIDA-X/RTNeural/modules/Eigen