aboutsummaryrefslogtreecommitdiffstats
path: root/community/rspamd/lua-torch-fix-simd-detection.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/rspamd/lua-torch-fix-simd-detection.patch')
-rw-r--r--community/rspamd/lua-torch-fix-simd-detection.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/community/rspamd/lua-torch-fix-simd-detection.patch b/community/rspamd/lua-torch-fix-simd-detection.patch
new file mode 100644
index 0000000000..f3df6f87de
--- /dev/null
+++ b/community/rspamd/lua-torch-fix-simd-detection.patch
@@ -0,0 +1,77 @@
+--- a/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
++++ b/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
+@@ -45,7 +45,7 @@
+ SIMDExtension_NEON = 0x1,
+ #elif defined(__PPC64__)
+ SIMDExtension_VSX = 0x1,
+-#else
++#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
+ SIMDExtension_AVX2 = 0x1,
+ SIMDExtension_AVX = 0x2,
+ SIMDExtension_SSE = 0x4,
+@@ -53,31 +53,17 @@
+ SIMDExtension_DEFAULT = 0x0
+ };
+
++#if (defined(__arm__) || defined(__aarch64__)) && defined(__NEON__)
+
+-#if defined(__arm__) || defined(__aarch64__) // incl. armel, armhf, arm64
+-
+- #if defined(__NEON__)
+-
+ static inline uint32_t detectHostSIMDExtensions()
+ {
+ return SIMDExtension_NEON;
+ }
+
+- #else //ARM without NEON
++#elif defined(__PPC64__) && defined(__VSX__)
+
+ static inline uint32_t detectHostSIMDExtensions()
+ {
+- return SIMDExtension_DEFAULT;
+-}
+-
+- #endif
+-
+-#elif defined(__PPC64__)
+-
+- #if defined(__VSX__)
+-
+-static inline uint32_t detectHostSIMDExtensions()
+-{
+ uint32_t hostSimdExts = SIMDExtension_DEFAULT;
+ char *evar;
+
+@@ -87,16 +73,8 @@
+ return hostSimdExts;
+ }
+
+- #else //PPC64 without VSX
++#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
+
+-static inline uint32_t detectHostSIMDExtensions()
+-{
+- return SIMDExtension_DEFAULT;
+-}
+-
+- #endif
+-
+-#else // x86
+ static inline void cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+ {
+ #if defined(_MSC_VER)
+@@ -158,6 +136,13 @@
+ }
+
+ return hostSimdExts;
++}
++
++#else
++
++static inline uint32_t detectHostSIMDExtensions()
++{
++ return SIMDExtension_DEFAULT;
+ }
+
+ #endif // end SIMD extension detection code