|
|
|
@@ -214,8 +214,8 @@ int cpu_support_arm_asimdhp() |
|
|
|
|
|
|
|
int cpu_support_x86_avx2() |
|
|
|
{ |
|
|
|
#if defined(__x86_64__) |
|
|
|
#ifdef _MSC_VER |
|
|
|
#if (_M_AMD64 || __x86_64__) || (_M_IX86 || __i386__) |
|
|
|
#if defined(_MSC_VER) |
|
|
|
// TODO move to init function |
|
|
|
int cpu_info[4]; |
|
|
|
__cpuid(cpu_info, 0); |
|
|
|
@@ -235,10 +235,18 @@ int cpu_support_x86_avx2() |
|
|
|
|
|
|
|
__cpuid(cpu_info, 7); |
|
|
|
return cpu_info[1] & 0x00000020; |
|
|
|
#else |
|
|
|
// TODO gcc-specific |
|
|
|
#elif defined(__clang__) |
|
|
|
#if __clang_major__ >= 6 |
|
|
|
__builtin_cpu_init(); |
|
|
|
#endif |
|
|
|
return __builtin_cpu_supports("avx2"); |
|
|
|
#elif defined(__GNUC__) |
|
|
|
__builtin_cpu_init(); |
|
|
|
return __builtin_cpu_supports("avx2"); |
|
|
|
#else |
|
|
|
// TODO: other x86 compilers checking avx2 here |
|
|
|
NCNN_LOGE("AVX2 detection method is unknown for current compiler"); |
|
|
|
return 0; |
|
|
|
#endif |
|
|
|
#else |
|
|
|
return 0; |
|
|
|
|