projects/guix·blob java-team · refs

109 lines · 3.6 KiB

1This patch replaces #ifndef POCKETFFT_NO_VECTORS by #if POCKETFFT_NO_VECTORS.
2It also makes it the default, as SIMD instructions are not that well-suited
3for substitutes.
4
5diff --git a/pocketfft_hdronly.h b/pocketfft_hdronly.h
6index d75ada6..b2d0a23 100644
7--- a/pocketfft_hdronly.h
8+++ b/pocketfft_hdronly.h
9@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 #ifndef POCKETFFT_HDRONLY_H
11 #define POCKETFFT_HDRONLY_H
12
13+#ifndef POCKETFFT_NO_VECTORS
14+#define POCKETFFT_NO_VECTORS 1
15+#endif
16+
17 #ifndef __cplusplus
18 #error This file is C++ and requires a C++ compiler.
19 #endif
20@@ -106,29 +110,29 @@ constexpr bool FORWARD = true,
21 BACKWARD = false;
22
23 // only enable vector support for gcc>=5.0 and clang>=5.0
24-#ifndef POCKETFFT_NO_VECTORS
25-#define POCKETFFT_NO_VECTORS
26+#if !(POCKETFFT_NO_VECTORS)
27+#define POCKETFFT_NO_VECTORS 1
28 #if defined(__INTEL_COMPILER)
29 // do nothing. This is necessary because this compiler also sets __GNUC__.
30 #elif defined(__clang__)
31 // AppleClang has their own version numbering
32 #ifdef __apple_build_version__
33 # if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 1)
34-# undef POCKETFFT_NO_VECTORS
35+#define POCKETFFT_NO_VECTORS 0
36 # endif
37 #elif __clang_major__ >= 5
38-# undef POCKETFFT_NO_VECTORS
39+#define POCKETFFT_NO_VECTORS 0
40 #endif
41 #elif defined(__GNUC__)
42 #if __GNUC__>=5
43-#undef POCKETFFT_NO_VECTORS
44+#define POCKETFFT_NO_VECTORS 0
45 #endif
46 #endif
47 #endif
48
49 template<typename T> struct VLEN { static constexpr size_t val=1; };
50
51-#ifndef POCKETFFT_NO_VECTORS
52+#if !(POCKETFFT_NO_VECTORS)
53 #if (defined(__AVX512F__))
54 template<> struct VLEN<float> { static constexpr size_t val=16; };
55 template<> struct VLEN<double> { static constexpr size_t val=8; };
56@@ -145,7 +149,7 @@ template<> struct VLEN<double> { static constexpr size_t val=2; };
57 template<> struct VLEN<float> { static constexpr size_t val=4; };
58 template<> struct VLEN<double> { static constexpr size_t val=2; };
59 #else
60-#define POCKETFFT_NO_VECTORS
61+#define POCKETFFT_NO_VECTORS 1
62 #endif
63 #endif
64
65@@ -180,7 +184,7 @@ template<typename T> class arr
66 T *p;
67 size_t sz;
68
69-#if defined(POCKETFFT_NO_VECTORS)
70+#if POCKETFFT_NO_VECTORS
71 static T *ralloc(size_t num)
72 {
73 if (num==0) return nullptr;
74@@ -3026,7 +3030,7 @@ class rev_iter
75 template<typename T> struct VTYPE {};
76 template <typename T> using vtype_t = typename VTYPE<T>::type;
77
78-#ifndef POCKETFFT_NO_VECTORS
79+#if !(POCKETFFT_NO_VECTORS)
80 template<> struct VTYPE<float>
81 {
82 using type = float __attribute__ ((vector_size (VLEN<float>::val*sizeof(float))));
83@@ -3139,7 +3143,7 @@ POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out,
84 auto storage = alloc_tmp<T0>(in.shape(), len, sizeof(T));
85 const auto &tin(iax==0? in : out);
86 multi_iter<vlen> it(tin, out, axes[iax]);
87-#ifndef POCKETFFT_NO_VECTORS
88+#if !(POCKETFFT_NO_VECTORS)
89 if (vlen>1)
90 while (it.remaining()>=vlen)
91 {
92@@ -3245,7 +3249,7 @@ template<typename T> POCKETFFT_NOINLINE void general_r2c(
93 constexpr auto vlen = VLEN<T>::val;
94 auto storage = alloc_tmp<T>(in.shape(), len, sizeof(T));
95 multi_iter<vlen> it(in, out, axis);
96-#ifndef POCKETFFT_NO_VECTORS
97+#if !(POCKETFFT_NO_VECTORS)
98 if (vlen>1)
99 while (it.remaining()>=vlen)
100 {
101@@ -3300,7 +3304,7 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
102 constexpr auto vlen = VLEN<T>::val;
103 auto storage = alloc_tmp<T>(out.shape(), len, sizeof(T));
104 multi_iter<vlen> it(in, out, axis);
105-#ifndef POCKETFFT_NO_VECTORS
106+#if !(POCKETFFT_NO_VECTORS)
107 if (vlen>1)
108 while (it.remaining()>=vlen)
109 {