1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
|