mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Fixes related to the MSVC compiler
This commit is contained in:
parent
684073bef6
commit
99ceb30a0e
@ -88,6 +88,7 @@
|
|||||||
<param>12</param>
|
<param>12</param>
|
||||||
</check>
|
</check>
|
||||||
<flag compiler="gnu">-mfma</flag>
|
<flag compiler="gnu">-mfma</flag>
|
||||||
|
<flag compiler="msvc">/arch:AVX2</flag>
|
||||||
<alignment>32</alignment>
|
<alignment>32</alignment>
|
||||||
</arch>
|
</arch>
|
||||||
|
|
||||||
|
@ -14,23 +14,23 @@
|
|||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<machine name="sse3">
|
<machine name="sse3">
|
||||||
<archs>generic 32|64 mmx sse sse2 sse3 orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<machine name="ssse3">
|
<machine name="ssse3">
|
||||||
<archs>generic 32|64 mmx sse sse2 sse3 ssse3 orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<machine name="sse4_a">
|
<machine name="sse4_a">
|
||||||
<archs>generic 32|64 mmx sse sse2 sse3 sse4_a popcount orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 sse4_a popcount orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<machine name="sse4_1">
|
<machine name="sse4_1">
|
||||||
<archs>generic 32|64 mmx sse sse2 sse3 ssse3 sse4_1 orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<machine name="sse4_2">
|
<machine name="sse4_2">
|
||||||
<archs>generic 32|64 mmx sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
<!-- trailing | bar means generate without either for MSVC -->
|
<!-- trailing | bar means generate without either for MSVC -->
|
||||||
|
@ -150,7 +150,12 @@ set(HAVE_XGETBV 0)
|
|||||||
set(HAVE_AVX_CVTPI32_PS 0)
|
set(HAVE_AVX_CVTPI32_PS 0)
|
||||||
if(CPU_IS_x86)
|
if(CPU_IS_x86)
|
||||||
# check to see if the compiler/linker works with xgetb instruction
|
# 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 "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); }")
|
||||||
|
else (NOT MSVC)
|
||||||
|
#MSVC defines an intrinsic
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include <stdio.h> \n #include <intrin.h> \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; }")
|
||||||
|
endif(NOT MSVC)
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -o
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -o
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
|
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
|
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
|
||||||
@ -179,6 +184,7 @@ if(CPU_IS_x86)
|
|||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# check to see if the compiler/linker works with cvtpi32_ps instrinsic when using AVX
|
# check to see if the compiler/linker works with cvtpi32_ps instrinsic when using AVX
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
|
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
|
||||||
@ -201,6 +207,10 @@ if(CPU_IS_x86)
|
|||||||
endif()
|
endif()
|
||||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
|
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c)
|
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c)
|
||||||
|
else(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
|
# 64-bit compilations won't need this command so don't overrule AVX
|
||||||
|
set(HAVE_AVX_CVTPI32_PS 0)
|
||||||
|
endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
|
|
||||||
# Disable SSE4a if Clang is less than version 3.2
|
# Disable SSE4a if Clang is less than version 3.2
|
||||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
Loading…
Reference in New Issue
Block a user