We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc55b58 commit b498067Copy full SHA for b498067
src/arch/simddetect.cpp
@@ -107,14 +107,24 @@ SIMDDetect::SIMDDetect() {
107
}
108
# elif defined(_WIN32)
109
int cpuInfo[4];
110
+ int max_function_id;
111
__cpuid(cpuInfo, 0);
- if (cpuInfo[0] >= 1) {
112
+ max_function_id = cpuInfo[0];
113
+ if (max_function_id >= 1) {
114
__cpuid(cpuInfo, 1);
115
#if defined(SSE4_1)
116
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
117
#endif
118
#if defined(AVX)
119
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
120
+#endif
121
+#if defined(AVX2)
122
+ if (max_function_id >= 7) {
123
+ __cpuid(cpuInfo, 7);
124
+ avx2_available_ = (cpuInfo[1] & 0x00000020) != 0;
125
+ avx512F_available_ = (cpuInfo[1] & 0x00010000) != 0;
126
+ avx512BW_available_ = (cpuInfo[1] & 0x40000000) != 0;
127
+ }
128
129
130
#else
0 commit comments