Merge pull request #1226 from facebook/noPrefetch

add build macro NO_PREFETCH
This commit is contained in:
Yann Collet 2018-07-06 17:56:35 -07:00 committed by GitHub
commit 14a92e90fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,11 @@
#endif #endif
#endif #endif
/* prefetch */ /* prefetch
* can be disabled, by declaring NO_PREFETCH macro */
#if defined(NO_PREFETCH)
# define PREFETCH(ptr) /* disabled */
#else
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ # if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
# define PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0) # define PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0)
@ -97,6 +101,7 @@
# else # else
# define PREFETCH(ptr) /* disabled */ # define PREFETCH(ptr) /* disabled */
# endif # endif
#endif /* NO_PREFETCH */
/* disable warnings */ /* disable warnings */
#ifdef _MSC_VER /* Visual Studio */ #ifdef _MSC_VER /* Visual Studio */