3333#include <immintrin.h>
3434
3535/* yes I know, the top of this file is quite ugly */
36- # define ALIGN32_BEG
37- # define ALIGN32_END __attribute__((aligned(32)))
36+ #if defined(__GNUC__ )
37+ # define ALIGN32_BEG __attribute__((aligned(32)))
38+ #elif defined(_WIN32 )
39+ # define ALIGN32_BEG __declspec(align(32))
40+ #endif
3841
3942/* __m128 is ugly to write */
4043typedef __m256 v8sf ; // vector of 8 float (avx)
4144typedef __m256i v8si ; // vector of 8 int (avx)
4245typedef __m128i v4si ; // vector of 8 int (avx)
4346
4447#define _PI32AVX_CONST (Name , Val ) \
45- static const ALIGN32_BEG int _pi32avx_##Name[4] ALIGN32_END = { Val, Val, Val, Val }
48+ static const ALIGN32_BEG int _pi32avx_##Name[4] = { Val, Val, Val, Val }
4649
4750_PI32AVX_CONST (1 , 1 );
4851_PI32AVX_CONST (inv1 , ~1 );
@@ -52,11 +55,11 @@ _PI32AVX_CONST(4, 4);
5255
5356/* declare some AVX constants -- why can't I figure a better way to do that? */
5457#define _PS256_CONST (Name , Val ) \
55- static const ALIGN32_BEG float _ps256_##Name[8] ALIGN32_END = { Val, Val, Val, Val, Val, Val, Val, Val }
58+ static const ALIGN32_BEG float _ps256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
5659#define _PI32_CONST256 (Name , Val ) \
57- static const ALIGN32_BEG int _pi32_256_##Name[8] ALIGN32_END = { Val, Val, Val, Val, Val, Val, Val, Val }
60+ static const ALIGN32_BEG int _pi32_256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
5861#define _PS256_CONST_TYPE (Name , Type , Val ) \
59- static const ALIGN32_BEG Type _ps256_##Name[8] ALIGN32_END = { Val, Val, Val, Val, Val, Val, Val, Val }
62+ static const ALIGN32_BEG Type _ps256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
6063
6164_PS256_CONST (1 , 1.0f );
6265_PS256_CONST (0p5 , 0.5f );
0 commit comments