Commit dd983e12aa

Alex Rønne Petersen <alex@alexrp.com>
2024-10-16 01:05:27
compiler-rt: Use loongarch clear_cache() implementation for loongarch32 too.
1 parent f5beb50
Changed files (1)
lib
compiler_rt
lib/compiler_rt/clear_cache.zig
@@ -28,8 +28,10 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void {
         .aarch64, .aarch64_be => true,
         else => false,
     };
-    const loongarch64 = switch (arch) {
-        .loongarch64 => true,
+    const loongarch = switch (arch) {
+        .loongarch32,
+        .loongarch64,
+        => true,
         else => false,
     };
     const mips = switch (arch) {
@@ -163,7 +165,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void {
         // On Darwin, sys_icache_invalidate() provides this functionality
         sys_icache_invalidate(start, end - start);
         exportIt();
-    } else if (os == .linux and loongarch64) {
+    } else if (os == .linux and loongarch) {
         // See: https://github.com/llvm/llvm-project/blob/cf54cae26b65fc3201eff7200ffb9b0c9e8f9a13/compiler-rt/lib/builtins/clear_cache.c#L94-L95
         asm volatile (
             \\ ibar 0