From 08f335450b9809acdbe88d894449ccd6d4a9ec75 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 15 Jan 2020 17:27:15 +0100 Subject: [PATCH] lib/CMakeLists: fix neon version detection Signed-off-by: Gwenhael Goavec-Merou --- volk/lib/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f969f2e..b85a22b 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -144,7 +144,7 @@ set(HAVE_AVX_CVTPI32_PS 0) if(CPU_IS_x86) # check to see if the compiler/linker works with xgetb instruction if (NOT MSVC) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include \n unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __VOLK_ASM __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }") else (NOT MSVC) #MSVC defines an intrinsic file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include \n #include \n int main() { int avxSupported = 0; \n#if (_MSC_FULL_VER >= 160040219) \nint cpuInfo[4]; __cpuid(cpuInfo, 1);\nif ((cpuInfo[2] & (1 << 27) || 0) && (cpuInfo[2] & (1 << 28) || 0)) \n{\nunsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\n avxSupported = (xcrFeatureMask & 0x6) == 6;}\n#endif \n return 1- avxSupported; }") @@ -263,17 +263,17 @@ check_c_source_compiles("#include \nint main(){ uint8_t *dest; uint8 neon_compile_result) if(neon_compile_result) - check_c_source_compiles("int main(){asm volatile(\"vrev32.8 q0, q0\");}" + check_c_source_compiles("#include \n int main(){__VOLK_ASM volatile(\"vrev32.8 q0, q0\");}" have_neonv7_result ) - check_c_source_compiles("int main(){asm volatile(\"sub v1.4s,v1.4s,v1.4s\");}" + check_c_source_compiles("#include \n int main(){__VOLK_ASM volatile(\"sub v1.4s,v1.4s,v1.4s\");}" have_neonv8_result ) - if (have_neonv7_result) - OVERRULE_ARCH(neonv8 "CPU is armv7") + if (NOT have_neonv7_result) + OVERRULE_ARCH(neonv7 "Compiler doesn't support neonv7") endif() - if (have_neonv8_result) - OVERRULE_ARCH(neonv7 "CPU is armv8") + if (NOT have_neonv8_result) + OVERRULE_ARCH(neonv8 "Compiler doesn't support neonv8") endif() else(neon_compile_result) OVERRULE_ARCH(neon "Compiler doesn't support NEON") -- 2.24.1