* [PATCH] Sync LTO type_for_mode with c-family/
@ 2023-01-13 8:39 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-01-13 8:39 UTC (permalink / raw)
To: gcc-patches
The following adds _FloatN mode support to the LTO copy of
c_common_type_for_mode and also implements the fix for PR94072.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
gcc/lto/
* lto-lang.cc (lto_type_for_mode): Sync with
c_common_type_for_mode.
---
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;
}
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-13 8:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 8:39 [PATCH] Sync LTO type_for_mode with c-family/ Richard Biener
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).