aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/loongarch/loongarch-c.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/loongarch/loongarch-c.cc')
-rw-r--r--gcc/config/loongarch/loongarch-c.cc37
1 files changed, 10 insertions, 27 deletions
diff --git a/gcc/config/loongarch/loongarch-c.cc b/gcc/config/loongarch/loongarch-c.cc
index 4d88c17..c1eab28 100644
--- a/gcc/config/loongarch/loongarch-c.cc
+++ b/gcc/config/loongarch/loongarch-c.cc
@@ -31,29 +31,6 @@ along with GCC; see the file COPYING3. If not see
#define builtin_define(TXT) cpp_define (pfile, TXT)
#define builtin_assert(TXT) cpp_assert (pfile, TXT)
-/* Define preprocessor macros for the -march and -mtune options.
- PREFIX is either _LOONGARCH_ARCH or _LOONGARCH_TUNE, INFO is
- the selected processor. If INFO's canonical name is "foo",
- define PREFIX to be "foo", and define an additional macro
- PREFIX_FOO. */
-#define LARCH_CPP_SET_PROCESSOR(PREFIX, CPU_TYPE) \
- do \
- { \
- char *macro, *p; \
- int cpu_type = (CPU_TYPE); \
- \
- macro = concat ((PREFIX), "_", \
- loongarch_cpu_strings[cpu_type], NULL); \
- for (p = macro; *p != 0; p++) \
- *p = TOUPPER (*p); \
- \
- builtin_define (macro); \
- builtin_define_with_value ((PREFIX), \
- loongarch_cpu_strings[cpu_type], 1); \
- free (macro); \
- } \
- while (0)
-
void
loongarch_cpu_cpp_builtins (cpp_reader *pfile)
{
@@ -61,11 +38,17 @@ loongarch_cpu_cpp_builtins (cpp_reader *pfile)
builtin_assert ("cpu=loongarch");
builtin_define ("__loongarch__");
- LARCH_CPP_SET_PROCESSOR ("_LOONGARCH_ARCH", la_target.cpu_arch);
- LARCH_CPP_SET_PROCESSOR ("_LOONGARCH_TUNE", la_target.cpu_tune);
+ 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);
- LARCH_CPP_SET_PROCESSOR ("__loongarch_arch", la_target.cpu_arch);
- LARCH_CPP_SET_PROCESSOR ("__loongarch_tune", la_target.cpu_tune);
+ builtin_define_with_value ("_LOONGARCH_TUNE",
+ loongarch_tune_strings[la_target.cpu_tune], 1);
/* Base architecture / ABI. */
if (TARGET_64BIT)