[PATCH] D25772: Add a macro for prefetching data

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 07:42:01 PDT 2016


rafael created this revision.
rafael added a reviewer: dblaikie.
rafael added a subscriber: llvm-commits.

I want to use this in a binary search. It can make lld up to 1.029X faster.


https://reviews.llvm.org/D25772

Files:
  include/llvm/Support/Compiler.h


Index: include/llvm/Support/Compiler.h
===================================================================
--- include/llvm/Support/Compiler.h
+++ include/llvm/Support/Compiler.h
@@ -118,6 +118,12 @@
 #define LLVM_LIBRARY_VISIBILITY
 #endif
 
+#if defined(__GNUC__)
+#define LLVM_PREFETCH(addr, rw, locality) __builtin_prefetch(addr, rw, locality)
+#else
+#define LLVM_PREFETCH(addr, rw, locality)
+#endif
+
 #if __has_attribute(sentinel) || LLVM_GNUC_PREREQ(3, 0, 0)
 #define LLVM_END_WITH_NULL __attribute__((sentinel))
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25772.75148.patch
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161019/4c2e329a/attachment.bin>


More information about the llvm-commits mailing list