aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2018-01-02 20:34:01 +0000
committerJim Wilson <wilson@gcc.gnu.org>2018-01-02 12:34:01 -0800
commitf1bdc63a898f2fa164e79528c03e96a21a779e82 (patch)
tree57d866c19352e762105309dc99d34dd530f91286 /gcc/config/riscv
parenta7e92aff74d014fba5765654333b2dbb2b294913 (diff)
downloadgcc-f1bdc63a898f2fa164e79528c03e96a21a779e82.zip
gcc-f1bdc63a898f2fa164e79528c03e96a21a779e82.tar.gz
gcc-f1bdc63a898f2fa164e79528c03e96a21a779e82.tar.bz2
RISC-V: Fix for icache flush issue on multicore processors.
gcc/ * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New. * config/riscv/riscv.md (clear_cache): Use it. From-SVN: r256109
Diffstat (limited to 'gcc/config/riscv')
-rw-r--r--gcc/config/riscv/linux.h2
-rw-r--r--gcc/config/riscv/riscv.md6
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 6c7e3c4..4b2f7b6 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -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} \
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index db4fed4..dab54ad 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -1456,7 +1456,13 @@
(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;
})