]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: define preprocessing macros "__loongarch_{arch,tune}"
authorYang Yujie <yangyujie@loongson.cn>
Mon, 28 Aug 2023 01:32:16 +0000 (09:32 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Tue, 5 Sep 2023 03:48:00 +0000 (11:48 +0800)
These are exported according to the LoongArch Toolchain Conventions[1]
as a replacement of the obsolete "_LOONGARCH_{ARCH,TUNE}" macros,
which are expanded to strings representing the actual architecture
and microarchitecture of the target.

[1] currently relased at https://github.com/loongson/LoongArch-Documentation
    /blob/main/docs/LoongArch-toolchain-conventions-EN.adoc

gcc/ChangeLog:

* config/loongarch/loongarch-c.cc: Export macros
"__loongarch_{arch,tune}" in the preprocessor.

gcc/config/loongarch/loongarch-c.cc

index f5a966a1d1c7b7a8b93f5536bc7af4fe710220bb..fbc33a10351f9c7ed7f31daccaf8fc8685738a67 100644 (file)
@@ -64,6 +64,9 @@ loongarch_cpu_cpp_builtins (cpp_reader *pfile)
   LARCH_CPP_SET_PROCESSOR ("_LOONGARCH_ARCH", la_target.cpu_arch);
   LARCH_CPP_SET_PROCESSOR ("_LOONGARCH_TUNE", la_target.cpu_tune);
 
+  LARCH_CPP_SET_PROCESSOR ("__loongarch_arch", la_target.cpu_arch);
+  LARCH_CPP_SET_PROCESSOR ("__loongarch_tune", la_target.cpu_tune);
+
   /* Base architecture / ABI.  */
   if (TARGET_64BIT)
     {