mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Rearrange prefetch code
No functional change.
This commit is contained in:
12
src/misc.cpp
12
src/misc.cpp
@@ -227,21 +227,17 @@ void prefetch(char*) {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# if defined(__INTEL_COMPILER) || defined(__ICL) || defined(_MSC_VER)
|
|
||||||
# include <xmmintrin.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
void prefetch(char* addr) {
|
void prefetch(char* addr) {
|
||||||
|
|
||||||
# if defined(__INTEL_COMPILER) || defined(__ICL)
|
# if defined(__INTEL_COMPILER)
|
||||||
// This hack prevents prefetches to be optimized away by
|
// This hack prevents prefetches to be optimized away by
|
||||||
// Intel compiler. Both MSVC and gcc seems not affected.
|
// Intel compiler. Both MSVC and gcc seems not affected.
|
||||||
__asm__ ("");
|
__asm__ ("");
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(__INTEL_COMPILER) || defined(__ICL) || defined(_MSC_VER)
|
# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||||
_mm_prefetch(addr, _MM_HINT_T2);
|
_mm_prefetch(addr, _MM_HINT_T0);
|
||||||
_mm_prefetch(addr+64, _MM_HINT_T2); // 64 bytes ahead
|
_mm_prefetch(addr+64, _MM_HINT_T0); // 64 bytes ahead
|
||||||
# else
|
# else
|
||||||
__builtin_prefetch(addr);
|
__builtin_prefetch(addr);
|
||||||
__builtin_prefetch(addr+64);
|
__builtin_prefetch(addr+64);
|
||||||
|
|||||||
@@ -51,6 +51,10 @@
|
|||||||
# include <nmmintrin.h> // Intel header for _mm_popcnt_u64() intrinsic
|
# include <nmmintrin.h> // Intel header for _mm_popcnt_u64() intrinsic
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# if !defined(NO_PREFETCH) && (defined(__INTEL_COMPILER) || defined(_MSC_VER))
|
||||||
|
# include <xmmintrin.h> // Intel and Microsoft header for _mm_prefetch()
|
||||||
|
# endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||||
# define CACHE_LINE_ALIGNMENT __declspec(align(64))
|
# define CACHE_LINE_ALIGNMENT __declspec(align(64))
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user