RISC-V: Fix for icache flush issue on multicore processors.
authorAndrew Waterman <andrew@sifive.com>
Tue, 2 Jan 2018 20:34:01 +0000 (20:34 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Tue, 2 Jan 2018 20:34:01 +0000 (12:34 -0800)
gcc/
* config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
* config/riscv/riscv.md (clear_cache): Use it.

From-SVN: r256109

gcc/ChangeLog
gcc/config/riscv/linux.h
gcc/config/riscv/riscv.md

index 403c46ff34444ab32313164a92207a1800ae4a88..4e5323c68feccc92f6b76394e66f5487c0c8e70f 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-02  Andrew Waterman  <andrew@sifive.com>
+
+       * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
+       * config/riscv/riscv.md (clear_cache): Use it.
+
 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
 
        * web.c: Remove out-of-date comment.
index 6c7e3c4e819f7ecbd7d0b5cbd7f6de1361ebf263..4b2f7b6e1fdbf98ffc43bdbfa8ab46d3bd01df2a 100644 (file)
@@ -45,6 +45,8 @@ along with GCC; see the file COPYING3.  If not see
 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
 #endif
 
+#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
+
 #define LINK_SPEC "\
 -melf" XLEN_SPEC "lriscv \
 %{shared} \
index db4fed48e539743b033ca8b4887782f8f4750911..dab54ad2738aac8c8a5245ad41d15f3d534ddda7 100644 (file)
    (match_operand 1 "pmode_register_operand")]
   ""
 {
+#ifdef ICACHE_FLUSH_FUNC
+  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, ICACHE_FLUSH_FUNC),
+                    LCT_NORMAL, VOIDmode, operands[0], Pmode,
+                    operands[1], Pmode, const0_rtx, Pmode);
+#else
   emit_insn (gen_fence_i ());
+#endif
   DONE;
 })