]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Define macro CLEAR_INSN_CACHE.
authorLulu Cheng <chenglulu@loongson.cn>
Mon, 23 Oct 2023 01:07:32 +0000 (09:07 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 26 Oct 2023 06:28:10 +0000 (14:28 +0800)
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)

gcc/config/loongarch/loongarch.h

index 714401f2dc29a7777ee544329906ca5e09fdf46a..f34a7a604ccdb920dae23801aca3e1b2f484e4ac 100644 (file)
@@ -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)