在 2025/2/11 下午9:26, Xi Ruoyao 写道:
On Tue, 2025-02-11 at 20:49 +0800, Lulu Cheng wrote:
Split the implementation of the function loongarch_cpu_cpp_builtins
into two parts:
1. Macro definitions that do not change (only considering 64-bit
architecture)
2. Macro definitions that change with different compilation options.
gcc/ChangeLog:
* config/loongarch/loongarch-c.cc (builtin_undef): New macro.
(loongarch_cpu_cpp_builtins): Split to
loongarch_update_cpp_builtins
and loongarch_define_unconditional_macros.
(loongarch_def_or_undef): New functions.
(loongarch_define_unconditional_macros): Likewise.
(loongarch_update_cpp_builtins): Likewise.
Change-Id: Ifae73ffa2a07a595ed2a7f6ab7b82d8f51328a2a
---
/* snip */
I guess the handling for la_evo_macro_name macros (like
__loongarch_div32) and
__loongarch_version_major/__loongarch_version_minor should be moved as
well? Things like #pragma GCC target("arch=la664") may affect them.
It seems that the following four also need to be updated. I will make
corrections in v2
and add the corresponding test cases.
builtin_define_with_value ("__loongarch_arch",
loongarch_arch_strings[la_target.cpu_arch], 1);
builtin_define_with_value ("__loongarch_tune",
loongarch_tune_strings[la_target.cpu_tune], 1);
builtin_define_with_value ("_LOONGARCH_ARCH",
loongarch_arch_strings[la_target.cpu_arch], 1);
builtin_define_with_value ("_LOONGARCH_TUNE",
loongarch_tune_strings[la_target.cpu_tune], 1);