1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 17:19:36 +00:00

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.
This commit is contained in:
Jean-Francois Romang 2012-10-06 04:30:22 +08:00 committed by Marco Costalba
parent 1ac417edb8
commit b8948e84b8

View file

@ -237,8 +237,13 @@ void prefetch(char* addr) {
__asm__ (""); __asm__ ("");
# endif # endif
# if defined(__INTEL_COMPILER) || defined(__ICL) || defined(_MSC_VER)
_mm_prefetch(addr, _MM_HINT_T2); _mm_prefetch(addr, _MM_HINT_T2);
_mm_prefetch(addr+64, _MM_HINT_T2); // 64 bytes ahead _mm_prefetch(addr+64, _MM_HINT_T2); // 64 bytes ahead
# else
__builtin_prefetch(addr);
__builtin_prefetch(addr+64);
# endif
} }
#endif #endif