public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9946] LoongArch: Define macro CLEAR_INSN_CACHE.
@ 2023-10-26  6:36 LuluCheng
  0 siblings, 0 replies; only message in thread
From: LuluCheng @ 2023-10-26  6:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1983e252d85c24c3ec6a4ed6be6006098a6b4225

commit r12-9946-g1983e252d85c24c3ec6a4ed6be6006098a6b4225
Author: Lulu Cheng <chenglulu@loongson.cn>
Date:   Mon Oct 23 09:07:32 2023 +0800

    LoongArch: Define macro CLEAR_INSN_CACHE.
    
    LoongArch's microstructure ensures cache consistency by hardware.
    Due to out-of-order execution, "ibar" is required to ensure the visibility of the
    store (invalidated icache) executed by this CPU before "ibar" (to the instance).
    "ibar" will not invalidate the icache, so the start and end parameters are not Affect
    "ibar" performance.
    
    gcc/ChangeLog:
    
            * config/loongarch/loongarch.h (CLEAR_INSN_CACHE): New definition.
    
    (cherry picked from commit 5697ed0327f23d2e2ec4f7beec3b3d02f463173c)

Diff:
---
 gcc/config/loongarch/loongarch.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index 714401f2dc29..f34a7a604ccd 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -1148,3 +1148,8 @@ struct GTY (()) machine_function
   (TARGET_HARD_FLOAT_ABI ? (TARGET_DOUBLE_FLOAT_ABI ? 8 : 4) : 0)
 
 #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN)
+
+/* LoongArch maintains ICache/DCache coherency by hardware,
+   we just need "ibar" to avoid instruction hazard here.  */
+#undef  CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(beg, end) __builtin_loongarch_ibar (0)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-26  6:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26  6:36 [gcc r12-9946] LoongArch: Define macro CLEAR_INSN_CACHE LuluCheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).