Skip to content

Commit

Permalink
Fix x86 build with msvc compiler
Browse files Browse the repository at this point in the history
Replace check for `_M_X64` with `_M_IX86` to make sure x86 builds can be compiled
  • Loading branch information
pps83 committed Feb 14, 2024
1 parent b50206c commit dbd9959
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion headers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <iso646.h>
#include <stdint.h>

#if (defined(_M_X64) || defined(_M_AMD64))
#if (defined(_M_IX86) || defined(_M_AMD64))
#include <intrin.h>
#elif defined(_M_ARM64)
#include <simde/x86/sse4.1.h>
Expand Down
2 changes: 1 addition & 1 deletion headers/cpubenchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static __inline__ unsigned long long stopRDTSCP(void) {
"%rdx");
return (static_cast<unsigned long long>(cycles_high) << 32) | cycles_low;
}
#elif (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64)))
#elif (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64)))

static inline unsigned long long startRDTSC(void) { return __rdtsc(); }

Expand Down
4 changes: 2 additions & 2 deletions headers/simdgroupsimple.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace FastPForLib {
* efficiency is not that crucial here.
*/

#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64)))
#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64)))

inline static void comprIncompleteBlock(const uint8_t &n, const __m128i *&in,
__m128i *&out) {
Expand Down Expand Up @@ -627,7 +627,7 @@ namespace FastPForLib {
* efficiency is not that crucial here.
*/

#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64)))
#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64)))

inline static void decomprIncompleteBlock(const uint8_t &n,
const __m128i *&in,
Expand Down
2 changes: 1 addition & 1 deletion src/simdbitpacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8930,7 +8930,7 @@ static void __SIMD_fastunpack1_32(const __m128i *__restrict__ in,
__m128i InReg2 = InReg1;
__m128i OutReg1, OutReg2, OutReg3, OutReg4;
const __m128i mask = _mm_set1_epi32(1);
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64)))
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64)))
unsigned shift = 0;

for (unsigned i = 0; i < 8; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/simdunalignedbitpacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8930,7 +8930,7 @@ static void __SIMD_fastunpack1_32(const __m128i *__restrict__ in,
__m128i InReg2 = InReg1;
__m128i OutReg1, OutReg2, OutReg3, OutReg4;
const __m128i mask = _mm_set1_epi32(1);
#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64)))
#if (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64)))
unsigned shift = 0;

for (unsigned i = 0; i < 8; ++i) {
Expand Down
40 changes: 20 additions & 20 deletions src/streamvbyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
// no particular alignment is assumed or guaranteed for any elements

#if defined(_MSC_VER)
/* Microsoft C/C++-compatible compiler */
#if (defined(_M_X64) || defined(_M_AMD64))
#include <intrin.h>
#elif defined(_M_ARM64)
#include <simde/x86/sse4.1.h>
#endif

#include <iso646.h>
#include <stdint.h>
#define __restrict__ __restrict
/* Microsoft C/C++-compatible compiler */
#if (defined(_M_IX86) || defined(_M_AMD64))
#include <intrin.h>
#elif defined(_M_ARM64)
#include <simde/x86/sse4.1.h>
#endif

#include <iso646.h>
#include <stdint.h>
#define __restrict__ __restrict
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
/* GCC-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>
/* GCC-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>
#elif defined(__aarch64__)
/* GCC-compatible compiler, targeting ARM with NEON */
#include <simde/x86/sse4.1.h>
/* GCC-compatible compiler, targeting ARM with NEON */
#include <simde/x86/sse4.1.h>
#elif defined(__GNUC__) && defined(__IWMMXT__)
/* GCC-compatible compiler, targeting ARM with WMMX */
#include <mmintrin.h>
/* GCC-compatible compiler, targeting ARM with WMMX */
#include <mmintrin.h>
#elif (defined(__GNUC__) || defined(__xlC__)) && (defined(__VEC__) || defined(__ALTIVEC__))
/* XLC or GCC-compatible compiler, targeting PowerPC with VMX/VSX */
#include <altivec.h>
/* XLC or GCC-compatible compiler, targeting PowerPC with VMX/VSX */
#include <altivec.h>
#elif defined(__GNUC__) && defined(__SPE__)
/* GCC-compatible compiler, targeting PowerPC with SPE */
#include <spe.h>
/* GCC-compatible compiler, targeting PowerPC with SPE */
#include <spe.h>
#endif

#include <stdint.h>
Expand Down
22 changes: 11 additions & 11 deletions src/varintdecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@

#if defined(_MSC_VER)
/* Microsoft C/C++-compatible compiler */
#if (defined(_M_X64) || defined(_M_AMD64))
#if (defined(_M_IX86) || defined(_M_AMD64))
#include <intrin.h>
#elif defined(_M_ARM64)
#include <simde/x86/sse4.1.h>
#endif
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
/* GCC-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>
/* GCC-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>

#elif defined(__aarch64__)
/* GCC-compatible compiler, targeting ARM with NEON */
#include <simde/x86/sse4.1.h>
/* GCC-compatible compiler, targeting ARM with NEON */
#include <simde/x86/sse4.1.h>
#elif defined(__GNUC__) && defined(__IWMMXT__)
/* GCC-compatible compiler, targeting ARM with WMMX */
#include <mmintrin.h>
/* GCC-compatible compiler, targeting ARM with WMMX */
#include <mmintrin.h>
#elif (defined(__GNUC__) || defined(__xlC__)) && (defined(__VEC__) || defined(__ALTIVEC__))
/* XLC or GCC-compatible compiler, targeting PowerPC with VMX/VSX */
#include <altivec.h>
/* XLC or GCC-compatible compiler, targeting PowerPC with VMX/VSX */
#include <altivec.h>
#elif defined(__GNUC__) && defined(__SPE__)
/* GCC-compatible compiler, targeting PowerPC with SPE */
#include <spe.h>
/* GCC-compatible compiler, targeting PowerPC with SPE */
#include <spe.h>
#endif
#include <stdint.h>

Expand Down

0 comments on commit dbd9959

Please sign in to comment.