[PATCH] D42196: [compiler-rt] [builtins] Align addresses to cache lines in __clear_cache for aarch64

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 02:16:46 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL323315: [builtins] Align addresses to cache lines in __clear_cache for aarch64 (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42196?vs=130256&id=131211#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42196

Files:
  compiler-rt/trunk/lib/builtins/clear_cache.c


Index: compiler-rt/trunk/lib/builtins/clear_cache.c
===================================================================
--- compiler-rt/trunk/lib/builtins/clear_cache.c
+++ compiler-rt/trunk/lib/builtins/clear_cache.c
@@ -163,12 +163,14 @@
    * uintptr_t in case this runs in an IPL32 environment.
    */
   const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15);
-  for (addr = xstart; addr < xend; addr += dcache_line_size)
+  for (addr = xstart & ~(dcache_line_size - 1); addr < xend;
+       addr += dcache_line_size)
     __asm __volatile("dc cvau, %0" :: "r"(addr));
   __asm __volatile("dsb ish");
 
   const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15);
-  for (addr = xstart; addr < xend; addr += icache_line_size)
+  for (addr = xstart & ~(icache_line_size - 1); addr < xend;
+       addr += icache_line_size)
     __asm __volatile("ic ivau, %0" :: "r"(addr));
   __asm __volatile("isb sy");
 #elif defined (__powerpc64__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42196.131211.patch
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180124/46430e6b/attachment.bin>


More information about the llvm-commits mailing list