[SDK] Define some constants for use with _mm_prefetch (#1147)

* [SDK] Define some constants for use with _mm_prefetch
This should fix the build for x64
Add __INTRIN_INLINE for gcc and clang
This commit is contained in:
Mark Jansen 2018-12-16 23:25:52 +01:00 committed by GitHub
parent d840d7cb1b
commit b5aa5bcdc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#if defined(_M_IX86) || defined(_M_X64)
//#include <immintrin.h>
//#include <ammintrin.h>
#include <xmmintrin.h> // native headers: immintrin.h -> wmmintrin.h -> nmmintrin.h -> smmintrin.h -> tmmintrin.h -> pmmintrin.h -> emmintrin.h
#endif /* _M_IX86 || _M_X64 */
#if defined(_M_IX86)

View file

@ -34,6 +34,16 @@ unsigned int _mm_getcsr(void);
void _mm_setcsr(unsigned int);
#pragma intrinsic(_mm_setcsr)
#else
#ifndef __INTRIN_INLINE
#ifdef __clang__
#define __INTRIN_INLINE __forceinline
#else
#define __ATTRIBUTE_ARTIFICIAL __attribute__((artificial))
#define __INTRIN_INLINE extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) __ATTRIBUTE_ARTIFICIAL
#endif
#endif
/*
* We can't use __builtin_ia32_* functions,
* are they are only available with the -msse2 compiler switch
@ -55,4 +65,12 @@ __INTRIN_INLINE void _mm_setcsr(unsigned int val)
#define _mm_cvtss_si32 _mm_cvt_ss2si
/* _mm_prefetch constants */
#define _MM_HINT_T0 1
#define _MM_HINT_T1 2
#define _MM_HINT_T2 3
#define _MM_HINT_NTA 0
#define _MM_HINT_ET1 6
#endif /* _INCLUDED_MM2 */