public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yang Yujie <yangyujie@loongson.cn>
To: gcc-patches@gcc.gnu.org
Cc: ibuclaw@gdcproject.org, chenglulu@loongson.cn,
	xuchenghua@loongson.cn, Yang Yujie <yangyujie@loongson.cn>
Subject: [PATCH 1/3] LoongArch: Adjust D version strings.
Date: Fri, 17 Nov 2023 18:00:05 +0800	[thread overview]
Message-ID: <20231117100007.2566030-2-yangyujie@loongson.cn> (raw)
In-Reply-To: <20231117100007.2566030-1-yangyujie@loongson.cn>

gcc/ChangeLog:

	* config/loongarch/loongarch-d.cc: Undefine LoongArch32.
	Define LoongArch_SF, LoongArch_F32, LoongArch_F64

gcc/d/ChangeLog:

	* dmd/cond.d: Same.
	* implement-d.texi: Same.
---
 gcc/config/loongarch/loongarch-d.cc | 27 ++++++++++++++-------------
 gcc/d/dmd/cond.d                    |  6 +++---
 gcc/d/implement-d.texi              |  6 ++++++
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/gcc/config/loongarch/loongarch-d.cc b/gcc/config/loongarch/loongarch-d.cc
index 9ac483c39a7..4692b78708a 100644
--- a/gcc/config/loongarch/loongarch-d.cc
+++ b/gcc/config/loongarch/loongarch-d.cc
@@ -29,24 +29,27 @@ along with GCC; see the file COPYING3.  If not see
 void
 loongarch_d_target_versions (void)
 {
-  if (TARGET_64BIT)
+  if (TARGET_ABI_LP64)
     d_add_builtin_version ("LoongArch64");
-  else
-    d_add_builtin_version ("LoongArch32");
 
-  if (TARGET_HARD_FLOAT_ABI)
+  if (TARGET_DOUBLE_FLOAT_ABI)
+    {
+      d_add_builtin_version ("LoongArch_F64");
+      d_add_builtin_version ("D_HardFloat");
+    }
+  else if (TARGET_SINGLE_FLOAT_ABI)
     {
-      d_add_builtin_version ("LoongArch_HardFloat");
+      d_add_builtin_version ("LoongArch_F32");
       d_add_builtin_version ("D_HardFloat");
     }
-  else if (TARGET_SOFT_FLOAT_ABI)
+  else
     {
-      d_add_builtin_version ("LoongArch_SoftFloat");
+      d_add_builtin_version ("LoongArch_SF");
       d_add_builtin_version ("D_SoftFloat");
     }
 }
 
-/* Handle a call to `__traits(getTargetInfo, "floatAbi")'.  */
+/* Handle trait getTargetInfo with key "floatAbi"  */
 
 static tree
 loongarch_d_handle_target_float_abi (void)
@@ -55,10 +58,8 @@ loongarch_d_handle_target_float_abi (void)
 
   if (TARGET_HARD_FLOAT_ABI)
     abi = "hard";
-  else if (TARGET_SOFT_FLOAT_ABI)
-    abi = "soft";
   else
-    abi = "";
+    abi = "soft";
 
   return build_string_literal (strlen (abi) + 1, abi);
 }
@@ -69,8 +70,8 @@ void
 loongarch_d_register_target_info (void)
 {
   const struct d_target_info_spec handlers[] = {
-    {"floatAbi", loongarch_d_handle_target_float_abi},
-    {NULL, NULL},
+    { "floatAbi", loongarch_d_handle_target_float_abi },
+    { NULL, NULL },
   };
 
   d_add_target_info_handlers (handlers);
diff --git a/gcc/d/dmd/cond.d b/gcc/d/dmd/cond.d
index a8d099433a2..a6317eeffb1 100644
--- a/gcc/d/dmd/cond.d
+++ b/gcc/d/dmd/cond.d
@@ -692,10 +692,10 @@ extern (C++) final class VersionCondition : DVCondition
             case "LDC":
             case "linux":
             case "LittleEndian":
-            case "LoongArch32":
             case "LoongArch64":
-            case "LoongArch_HardFloat":
-            case "LoongArch_SoftFloat":
+            case "LoongArch_F64":
+            case "LoongArch_F32":
+            case "LoongArch_SF":
             case "MinGW":
             case "MIPS32":
             case "MIPS64":
diff --git a/gcc/d/implement-d.texi b/gcc/d/implement-d.texi
index 6f33bc192fe..cc0d1ecf593 100644
--- a/gcc/d/implement-d.texi
+++ b/gcc/d/implement-d.texi
@@ -1966,6 +1966,12 @@ Version relating to GNU Hurd systems.
 @item linux
 Version relating to Linux systems.
 
+@item LoongArch64
+@item LoongArch_SF
+@item LoongArch_F32
+@item LoongArch_F64
+Versions relating to the LoongArch family of processors.
+
 @item MinGW
 Version relating to the MinGW environment.
 
-- 
2.42.1


  reply	other threads:[~2023-11-17 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 10:00 [PATCH 0/3] LoongArch GDC support Yang Yujie
2023-11-17 10:00 ` Yang Yujie [this message]
2023-11-17 10:00 ` [PATCH 2/3] libphobos: Update build scripts for LoongArch64 Yang Yujie
2023-11-17 10:00 ` [PATCH 3/3] libphobos: Adjust LoongArch definitons Yang Yujie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117100007.2566030-2-yangyujie@loongson.cn \
    --to=yangyujie@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ibuclaw@gdcproject.org \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).