diff mbox series

LoongArch: Define macro CLEAR_INSN_CACHE.

Message ID 20231020071506.27021-1-chenglulu@loongson.cn
State New
Headers show
Series LoongArch: Define macro CLEAR_INSN_CACHE. | expand

Commit Message

Lulu Cheng Oct. 20, 2023, 7:15 a.m. UTC
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.
---
 gcc/config/loongarch/loongarch.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lulu Cheng Oct. 23, 2023, 1:28 a.m. UTC | #1
Pushed to r14-4836.

在 2023/10/20 下午3:15, Lulu Cheng 写道:
> 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.
> ---
>   gcc/config/loongarch/loongarch.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
> index 22912018a0d..0c15c79bc4c 100644
> --- a/gcc/config/loongarch/loongarch.h
> +++ b/gcc/config/loongarch/loongarch.h
> @@ -1239,3 +1239,6 @@ struct GTY (()) machine_function
>   
>   #define TARGET_EXPLICIT_RELOCS \
>     (la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS)
> +
> +#undef  CLEAR_INSN_CACHE
> +#define CLEAR_INSN_CACHE(beg, end) __builtin_loongarch_ibar (0)
diff mbox series

Patch

diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index 22912018a0d..0c15c79bc4c 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -1239,3 +1239,6 @@  struct GTY (()) machine_function
 
 #define TARGET_EXPLICIT_RELOCS \
   (la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS)
+
+#undef  CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(beg, end) __builtin_loongarch_ibar (0)