From: Jean-Francois Romang Date: Fri, 5 Oct 2012 20:30:22 +0000 (+0800) Subject: Allow prefetching on non-x86 platforms with gcc X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b8948e84b881c6b3cfaa26fa5512fe4c1800baa0 Allow prefetching on non-x86 platforms with gcc In particular on ARM processors. Original patch by Jean-Francois, sligtly modified by me to preserve the meaning of NO_PREFETCH flag. Verified with gcc, clang and icc that prefetch instruction is correctly created. No functional change. --- diff --git a/src/misc.cpp b/src/misc.cpp index fefa8d4f..167eedb3 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -237,8 +237,13 @@ void prefetch(char* addr) { __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 +# else + __builtin_prefetch(addr); + __builtin_prefetch(addr+64); +# endif } #endif