git: f17fa892de18 - releng/13.1 - powerpc: implement __clear_cache

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 14:51:34 UTC
The branch releng/13.1 has been updated by pkubaj (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=f17fa892de185a1031d6eaf3b813d0503527f3d1

commit f17fa892de185a1031d6eaf3b813d0503527f3d1
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-04-01 19:13:13 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-04-05 14:51:27 +0000

    powerpc: implement __clear_cache
    
    Merge LLVM commit 81f5c6270cdfcdf80e6296df216b696a7a37c8b5.
    
    This fixes runtime of most notably pcre libraries (currently patched in ports),
    and probably also other ports since currently __clear_cache() just calls
    SIGABRT on powerpc.
    
    Reviewed by:    dim
    Differential Revision: https://reviews.freebsd.org/D34736
    Approved by:    re (gjb)
    
    (cherry picked from commit 57b6ac48a96c99e684ab4dc85b8a87097797dc9f)
    (cherry picked from commit 16c3f5d03e984a6039a888eec5bcc58735a7d965)
---
 contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c b/contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c
index da0715914b41..1f1efbff3ab2 100644
--- a/contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c
@@ -130,7 +130,10 @@ void __clear_cache(void *start, void *end) {
     __asm __volatile("dsb ish");
   }
   __asm __volatile("isb sy");
-#elif defined(__powerpc64__)
+#elif defined(__powerpc__)
+  // Newer CPUs have a bigger line size made of multiple blocks, so the
+  // following value is a minimal common denominator for what used to be
+  // a single block cache line and is therefore inneficient.
   const size_t line_size = 32;
   const size_t len = (uintptr_t)end - (uintptr_t)start;