public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-5135] Sync LTO type_for_mode with c-family/
Date: Fri, 13 Jan 2023 08:40:37 +0000 (GMT)	[thread overview]
Message-ID: <20230113084037.604AC3858425@sourceware.org> (raw)

https://gcc.gnu.org/g:9b6c624820050cd5e11b2fbd9c997f94b691295a

commit r13-5135-g9b6c624820050cd5e11b2fbd9c997f94b691295a
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 13 08:11:53 2023 +0100

    Sync LTO type_for_mode with c-family/
    
    The following adds _FloatN mode support to the LTO copy of
    c_common_type_for_mode and also implements the fix for PR94072.
    
    gcc/lto/
            * lto-lang.cc (lto_type_for_mode): Sync with
            c_common_type_for_mode.

Diff:
---
 gcc/lto/lto-lang.cc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/lto/lto-lang.cc b/gcc/lto/lto-lang.cc
index 7018dfae4a5..1b2a4a632bb 100644
--- a/gcc/lto/lto-lang.cc
+++ b/gcc/lto/lto-lang.cc
@@ -1004,6 +1004,11 @@ lto_type_for_mode (machine_mode mode, int unsigned_p)
   if (mode == TYPE_MODE (long_double_type_node))
     return long_double_type_node;
 
+  for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+    if (FLOATN_NX_TYPE_NODE (i) != NULL_TREE
+	&& mode == TYPE_MODE (FLOATN_NX_TYPE_NODE (i)))
+      return FLOATN_NX_TYPE_NODE (i);
+
   if (mode == TYPE_MODE (void_type_node))
     return void_type_node;
 
@@ -1029,6 +1034,11 @@ lto_type_for_mode (machine_mode mode, int unsigned_p)
       if (mode == TYPE_MODE (complex_long_double_type_node))
 	return complex_long_double_type_node;
 
+      for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+	if (COMPLEX_FLOATN_NX_TYPE_NODE (i) != NULL_TREE
+	    && mode == TYPE_MODE (COMPLEX_FLOATN_NX_TYPE_NODE (i)))
+	  return COMPLEX_FLOATN_NX_TYPE_NODE (i);
+
       if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
 	return complex_integer_type_node;
 
@@ -1154,9 +1164,13 @@ lto_type_for_mode (machine_mode mode, int unsigned_p)
     }
 
   for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
-    if (TYPE_MODE (TREE_VALUE (t)) == mode)
-      return TREE_VALUE (t);
-
+    {
+      tree type = TREE_VALUE (t);
+      if (TYPE_MODE (type) == mode
+	  && VECTOR_TYPE_P (type) == VECTOR_MODE_P (mode)
+	  && !!unsigned_p == !!TYPE_UNSIGNED (type))
+	return type;
+    }
   return NULL_TREE;
 }

                 reply	other threads:[~2023-01-13  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230113084037.604AC3858425@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).