aboutsummaryrefslogtreecommitdiffstats
path: root/community/rspamd/lua-torch-fix-simd-detection.patch
diff options
context:
space:
mode:
authoralpine-mips-patches <info@mobile-stream.com>2019-01-15 05:18:12 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2019-02-05 11:17:47 +0000
commitcb4af3360e5299f02ddf651a59184b77ecb35571 (patch)
tree72ff77667823ffad5fe354b55f3cab4ed96a7946 /community/rspamd/lua-torch-fix-simd-detection.patch
parent3b689f550008673cf843f7ad759512fde81e7981 (diff)
downloadaports-cb4af3360e5299f02ddf651a59184b77ecb35571.tar.bz2
aports-cb4af3360e5299f02ddf651a59184b77ecb35571.tar.xz
community/rspamd: enable build on mips*
This is a generic fix really, nothing specific to mips*. It just makes the bundled lua-torch aware of architectures besides x86/power/arm so it might be reasonable to try s390x as well.
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