]> git.sesse.net Git - stockfish/commitdiff
Rearrange prefetch code
authorMarco Costalba <mcostalba@gmail.com>
Mon, 8 Oct 2012 09:19:50 +0000 (11:19 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 8 Oct 2012 09:43:47 +0000 (11:43 +0200)
No functional change.

src/misc.cpp
src/types.h

index 1e1b220cb533da6cbee0319dcf6f56c66c327c3e..608d772501fc54c70967d16e55ed80ba9cccb573 100644 (file)
@@ -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
    // Intel compiler. Both MSVC and gcc seems not affected.
    __asm__ ("");
 #  endif
 
    // This hack prevents prefetches to be optimized away by
    // Intel compiler. Both MSVC and gcc seems not affected.
    __asm__ ("");
 #  endif
 
-#  if defined(__INTEL_COMPILER) || defined(__ICL) || defined(_MSC_VER)
-  _mm_prefetch(addr, _MM_HINT_T2);
-  _mm_prefetch(addr+64, _MM_HINT_T2); // 64 bytes ahead
+#  if defined(__INTEL_COMPILER) || defined(_MSC_VER)
+  _mm_prefetch(addr, _MM_HINT_T0);
+  _mm_prefetch(addr+64, _MM_HINT_T0); // 64 bytes ahead
 #  else
   __builtin_prefetch(addr);
   __builtin_prefetch(addr+64);
 #  else
   __builtin_prefetch(addr);
   __builtin_prefetch(addr+64);
index 59d051ecfaa03f0aeb3a71c28d256acab257578f..0774557e000a421aa63a5958368f0fb04237960c 100644 (file)
 #  include <nmmintrin.h> // Intel header for _mm_popcnt_u64() intrinsic
 #endif
 
 #  include <nmmintrin.h> // Intel header for _mm_popcnt_u64() intrinsic
 #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)
 #  define CACHE_LINE_ALIGNMENT __declspec(align(64))
 #else
 #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
 #  define CACHE_LINE_ALIGNMENT __declspec(align(64))
 #else