Skip to content

Commit 521999f

Browse files
add fftw3 patch for neon as seen in this source repository local PR FFTW/fftw3#275 that will never be merged
1 parent 760bfd0 commit 521999f

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

ports/fftw3/neon.patch

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index db20caa7..48e724f3 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -25,6 +25,7 @@ option (ENABLE_SSE "Compile with SSE instruction set support" OFF)
6+
option (ENABLE_SSE2 "Compile with SSE2 instruction set support" OFF)
7+
option (ENABLE_AVX "Compile with AVX instruction set support" OFF)
8+
option (ENABLE_AVX2 "Compile with AVX2 instruction set support" OFF)
9+
+option (ENABLE_NEON "Compile with NEON instruction set support" OFF)
10+
11+
option (DISABLE_FORTRAN "Disable Fortran wrapper routines" OFF)
12+
13+
@@ -203,9 +204,20 @@ if (ENABLE_AVX2)
14+
endforeach ()
15+
endif ()
16+
17+
+if (ENABLE_NEON)
18+
+ if (ENABLE_LONG_DOUBLE)
19+
+ message (FATAL_ERROR "NEON only works in single or double precision, please disable long double support")
20+
+ endif ()
21+
+ if (ENABLE_QUAD_PRECISION)
22+
+ message (FATAL_ERROR "NEON only works in single or double precision, please disable quad precision support")
23+
+ endif ()
24+
+ set (HAVE_NEON TRUE)
25+
+endif ()
26+
+
27+
if (HAVE_SSE2 OR HAVE_AVX)
28+
set (HAVE_SIMD TRUE)
29+
endif ()
30+
+
31+
file(GLOB fftw_api_SOURCE api/*.c api/*.h)
32+
file(GLOB fftw_dft_SOURCE dft/*.c dft/*.h)
33+
file(GLOB fftw_dft_scalar_SOURCE dft/scalar/*.c dft/scalar/*.h)
34+
@@ -215,6 +227,7 @@ file(GLOB fftw_dft_simd_SOURCE dft/simd/*.c dft/simd
35+
file(GLOB fftw_dft_simd_sse2_SOURCE dft/simd/sse2/*.c dft/simd/sse2/*.h)
36+
file(GLOB fftw_dft_simd_avx_SOURCE dft/simd/avx/*.c dft/simd/avx/*.h)
37+
file(GLOB fftw_dft_simd_avx2_SOURCE dft/simd/avx2/*.c dft/simd/avx2/*.h dft/simd/avx2-128/*.c dft/simd/avx2-128/*.h)
38+
+file(GLOB fftw_dft_simd_neon_SOURCE dft/simd/neon/*.c dft/simd/neon/*.h)
39+
file(GLOB fftw_kernel_SOURCE kernel/*.c kernel/*.h)
40+
file(GLOB fftw_rdft_SOURCE rdft/*.c rdft/*.h)
41+
file(GLOB fftw_rdft_scalar_SOURCE rdft/scalar/*.c rdft/scalar/*.h)
42+
@@ -230,6 +243,7 @@ file(GLOB fftw_rdft_simd_SOURCE rdft/simd/*.c rdft/sim
43+
file(GLOB fftw_rdft_simd_sse2_SOURCE rdft/simd/sse2/*.c rdft/simd/sse2/*.h)
44+
file(GLOB fftw_rdft_simd_avx_SOURCE rdft/simd/avx/*.c rdft/simd/avx/*.h)
45+
file(GLOB fftw_rdft_simd_avx2_SOURCE rdft/simd/avx2/*.c rdft/simd/avx2/*.h rdft/simd/avx2-128/*.c rdft/simd/avx2-128/*.h)
46+
+file(GLOB fftw_rdft_simd_neon_SOURCE rdft/simd/neon/*.c rdft/simd/neon/*.h)
47+
48+
file(GLOB fftw_reodft_SOURCE reodft/*.c reodft/*.h)
49+
file(GLOB fftw_simd_support_SOURCE simd-support/*.c simd-support/*.h)
50+
@@ -283,6 +297,10 @@ if (HAVE_AVX2)
51+
list (APPEND SOURCEFILES ${fftw_dft_simd_avx2_SOURCE} ${fftw_rdft_simd_avx2_SOURCE})
52+
endif ()
53+
54+
+if (HAVE_NEON)
55+
+ list (APPEND SOURCEFILES ${fftw_dft_simd_neon_SOURCE} ${fftw_rdft_simd_neon_SOURCE})
56+
+endif ()
57+
+
58+
set (FFTW_VERSION 3.3.10)
59+
60+
set (PREC_SUFFIX)
61+
diff --git a/cmake.config.h.in b/cmake.config.h.in
62+
index 1f4c5055..8c61b38f 100644
63+
--- a/cmake.config.h.in
64+
+++ b/cmake.config.h.in
65+
@@ -211,7 +211,7 @@
66+
/* #undef HAVE_MPI */
67+
68+
/* Define to enable ARM NEON optimizations. */
69+
-/* #undef HAVE_NEON */
70+
+#cmakedefine HAVE_NEON 1
71+
72+
/* Define if OpenMP is enabled */
73+
#cmakedefine HAVE_OPENMP

ports/fftw3/portfile.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ vcpkg_extract_source_archive(
1414
fix-openmp.patch
1515
install-subtargets.patch
1616
fix-wrong-version.patch # https://github.com/FFTW/fftw3/commit/0842f00ae6b6e1f3aade155bc0edd17a7313fa6a
17+
neon.patch # add neon
1718
)
1819

1920
vcpkg_check_features(
@@ -27,12 +28,13 @@ vcpkg_check_features(
2728
avx ENABLE_AVX
2829
sse2 ENABLE_SSE2
2930
sse ENABLE_SSE
31+
neon ENABLE_NEON # add neon
3032
)
3133

3234
set(package_names fftw3 fftw3f fftw3l)
3335
set(fftw3_options "")
3436
set(fftw3f_options -DENABLE_FLOAT=ON)
35-
set(fftw3l_options -DENABLE_LONG_DOUBLE=ON -DENABLE_AVX2=OFF -DENABLE_AVX=OFF -DENABLE_SSE2=OFF)
37+
set(fftw3l_options -DENABLE_LONG_DOUBLE=ON -DENABLE_AVX2=OFF -DENABLE_AVX=OFF -DENABLE_SSE2=OFF -DENABLE_NEON=OFF)
3638

3739
foreach(package_name IN LISTS package_names)
3840
message(STATUS "${package_name}...")

ports/fftw3/vcpkg.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
"description": "Builds part of the library with sse2, sse",
3636
"supports": "!arm"
3737
},
38+
"neon": {
39+
"description": "Builds part of the library with neon",
40+
"supports": "arm"
41+
},
3842
"threads": {
3943
"description": "Enable threads in fftw3"
4044
}

0 commit comments

Comments
 (0)