mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-26 08:51:25 +02:00
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.
78 lines
1.6 KiB
Diff
78 lines
1.6 KiB
Diff
--- 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
|