Skip to content

Commit f31ecce

Browse files
committed
Fixed MSVC build
1 parent a79a4b9 commit f31ecce

File tree

8 files changed

+63
-18
lines changed

8 files changed

+63
-18
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ install:
3838
- conda install cmake xtl -c conda-forge
3939
- cmake -G "NMake Makefiles" -D DOWNLOAD_GTEST=1 -D ENABLE_XTL_COMPLEX=1 -D CMAKE_INSTALL_PREFIX=%MINICONDA%\\LIBRARY -D CMAKE_BUILD_TYPE=Release .
4040
- nmake test_xsimd
41-
- cd test
41+
- cd test-refactoring
4242

4343
build_script:
4444
- "%RUNTEST%"

include-refactoring/xsimd/arch/xsimd_avx2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ namespace xsimd {
134134
case 2: return _mm256_cmpeq_epi16(self, other);
135135
case 4: return _mm256_cmpeq_epi32(self, other);
136136
case 8: return _mm256_cmpeq_epi64(self, other);
137-
default: eq(self, other, avx{});
137+
default: return eq(self, other, avx{});
138138
}
139139
}
140140

include-refactoring/xsimd/config/xsimd_config.hpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,42 @@
211211
#define XSIMD_WITH_NEON 0
212212
#define XSIMD_WITH_NEON64 0
213213
#endif
214+
215+
// Workaround for MSVC compiler
216+
#ifdef _MSC_VER
217+
218+
#if XSIMD_WITH_AVX512
219+
#define XSIMD_WITH_AVX2 1
220+
#endif
221+
222+
#if XSIMD_WITH_AVX2
223+
#define XSIMD_WITH_AVX 1
224+
#endif
225+
226+
#if XSIMD_WITH_AVX
227+
#define XSIMD_WITH_SSE4_2 1
228+
#endif
229+
230+
#if XSIMD_WITH_SSE4_2
231+
#define XSIMD_WITH_SSE4_1 1
232+
#endif
233+
234+
#if XSIMD_WITH_SSE4_1
235+
#define XSIMD_WITH_SSSE3 1
236+
#endif
237+
238+
#if XSIMD_WITH_SSSE3
239+
#define XSIMD_WITH_SSE3 1
240+
#endif
241+
242+
#if XSIMD_WITH_SSE3
243+
#define XSIMD_WITH_SSE2 1
244+
#endif
245+
246+
#if XSIMD_WITH_SSE2
247+
#define XSIMD_WITH_SSE 1
248+
#endif
249+
250+
#endif
251+
214252
#endif

include-refactoring/xsimd/config/xsimd_cpuid.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#include <algorithm>
66
#include <array>
77

8+
#if defined(_MSC_VER)
9+
// Contains the definition of __cpuidex
10+
#include <intrin.h>
11+
#endif
12+
813
#include "../types/xsimd_all_registers.hpp"
914

1015
namespace xsimd

include-refactoring/xsimd/types/xsimd_sse2_register.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ namespace xsimd
2121
namespace types
2222
{
2323
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(sse2, sse);
24+
XSIMD_DECLARE_SIMD_REGISTER(bool, sse2, __m128i);
25+
XSIMD_DECLARE_SIMD_REGISTER(signed char, sse2, __m128i);
26+
XSIMD_DECLARE_SIMD_REGISTER(unsigned char, sse2, __m128i);
27+
XSIMD_DECLARE_SIMD_REGISTER(char, sse2, __m128i);
28+
XSIMD_DECLARE_SIMD_REGISTER(unsigned short, sse2, __m128i);
29+
XSIMD_DECLARE_SIMD_REGISTER(short, sse2, __m128i);
30+
XSIMD_DECLARE_SIMD_REGISTER(unsigned int, sse2, __m128i);
31+
XSIMD_DECLARE_SIMD_REGISTER(int, sse2, __m128i);
32+
XSIMD_DECLARE_SIMD_REGISTER(unsigned long int, sse2, __m128i);
33+
XSIMD_DECLARE_SIMD_REGISTER(long int, sse2, __m128i);
34+
XSIMD_DECLARE_SIMD_REGISTER(unsigned long long int, sse2, __m128i);
35+
XSIMD_DECLARE_SIMD_REGISTER(long long int, sse2, __m128i);
36+
XSIMD_DECLARE_SIMD_REGISTER(double, sse2, __m128d);
2437
}
2538
#endif
2639
}

include-refactoring/xsimd/types/xsimd_sse_register.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,7 @@ namespace xsimd
2222
#if XSIMD_WITH_SSE
2323
namespace types
2424
{
25-
26-
XSIMD_DECLARE_SIMD_REGISTER(bool, sse, __m128i);
27-
XSIMD_DECLARE_SIMD_REGISTER(signed char, sse, __m128i);
28-
XSIMD_DECLARE_SIMD_REGISTER(unsigned char, sse, __m128i);
29-
XSIMD_DECLARE_SIMD_REGISTER(char, sse, __m128i);
30-
XSIMD_DECLARE_SIMD_REGISTER(unsigned short, sse, __m128i);
31-
XSIMD_DECLARE_SIMD_REGISTER(short, sse, __m128i);
32-
XSIMD_DECLARE_SIMD_REGISTER(unsigned int, sse, __m128i);
33-
XSIMD_DECLARE_SIMD_REGISTER(int, sse, __m128i);
34-
XSIMD_DECLARE_SIMD_REGISTER(unsigned long int, sse, __m128i);
35-
XSIMD_DECLARE_SIMD_REGISTER(long int, sse, __m128i);
36-
XSIMD_DECLARE_SIMD_REGISTER(unsigned long long int, sse, __m128i);
37-
XSIMD_DECLARE_SIMD_REGISTER(long long int, sse, __m128i);
3825
XSIMD_DECLARE_SIMD_REGISTER(float, sse, __m128);
39-
XSIMD_DECLARE_SIMD_REGISTER(double, sse, __m128d);
40-
4126
}
4227
#endif
4328
}

test-refactoring/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ endif()
9090
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
9191
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /bigobj")
9292
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
93-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267")
93+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267 /wd4005 /wd4146 /wd4800")
9494
set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
9595
endif()
9696

test-refactoring/test_utils.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,11 @@ class conversion_test_names
628628
template <class T>
629629
static std::string GetName(int)
630630
{
631+
#ifndef _MSC_VER
631632
return __PRETTY_FUNCTION__;
633+
#else
634+
return "Unknown name";
635+
#endif
632636
}
633637
};
634638

0 commit comments

Comments
 (0)