Compilation fixes for Visual Studio:

- fixed ALIGNED macro to support both gcc/cl
 - popcnt64 for 32-bit compilation
 - use intrin.h instead of x86intrin.h
This commit is contained in:
Pavel P
2019-07-16 05:37:06 -07:00
parent 739d69dc9b
commit 52bfcaaf32
4 changed files with 14 additions and 4 deletions

View File

@ -764,7 +764,7 @@ size_t bitnfunpack128v32( unsigned char *__restrict in, size_t n, uint32_t *__re
#define mm256_maskz_expand_epi32(_m_,_v_) _mm256_maskz_expand_epi32(_m_,_v_)
#define mm256_maskz_loadu_epi32( _m_,_v_) _mm256_maskz_loadu_epi32( _m_,_v_)
#else
static unsigned char permv[256][8] __attribute__((aligned(32))) = {
static ALIGNED(unsigned char, permv[256][8], 32) = {
0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,1,
1,0,1,1,1,1,1,1,

8
conf.h
View File

@ -85,7 +85,7 @@ static inline unsigned short bswap16(unsigned short x) { return __builtin_bswap3
#define __builtin_prefetch(x,a) _mm_prefetch(x, _MM_HINT_NTA)
#endif
#define ALIGNED(x) __declspec(align(x))
#define ALIGNED(t,v,n) __declspec(align(n)) t v
#define ALWAYS_INLINE __forceinline
#define NOINLINE __declspec(noinline)
#define THREADLOCAL __declspec(thread)
@ -109,8 +109,12 @@ static inline int clz64(uint64_t x) { unsigned long z; _BitScanReverse64(&z, x
#define bswap32(x) _byteswap_ulong(x)
#define bswap64(x) _byteswap_uint64(x)
#define popcnt32(x) __popcnt(x)
#define popcnt32(x) __popcnt(x)
#ifdef _WIN64
#define popcnt64(x) __popcnt64(x)
#else
#define popcnt64(x) (popcnt32(x) + popcnt32(x>>32))
#endif
#define sleep(x) Sleep(x/1000)
#define fseeko _fseeki64

4
fp.c
View File

@ -40,7 +40,11 @@
#define bitflush( _bw_,_br_,_op_) ctou64(_op_) = _bw_, _op_ += (_br_+7)>>3, _bw_=_br_=0
#ifdef __AVX2__
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#else
#define _bzhi_u64(_u_, _b_) ((_u_) & ((1ull<<(_b_))-1))
#define _bzhi_u32(_u_, _b_) ((_u_) & ((1u <<(_b_))-1))

View File

@ -120,7 +120,9 @@
#include "transpose.c"
//--------------------- CPU detection -------------------------------------------
#if (_MSC_VER >=1300) || defined (__INTEL_COMPILER)
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#include <intrin.h>
#elif defined(__INTEL_COMPILER)
#include <x86intrin.h>
#endif