public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop fixup
@ 2024-05-06 10:37 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-05-06 10:37 UTC (permalink / raw)
  To: gcc-patches

The following further strengthens the check which convert expressions
we allow to vectorize as simple copy by resorting to
tree_nop_conversion_p on the vector components.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

	PR tree-optimization/114921
	* tree-vect-stmts.cc (vectorizable_assignment): Use
	tree_nop_conversion_p to identify converts we can vectorize
	with a simple assignment.
---
 gcc/tree-vect-stmts.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 7e571968a59..21e8fe98e44 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5957,15 +5957,15 @@ vectorizable_assignment (vec_info *vinfo,
 
   /* We can handle VIEW_CONVERT conversions that do not change the number
      of elements or the vector size or other conversions when the component
-     mode keeps the same.  */
+     types are nop-convertible.  */
   if (!vectype_in
       || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype_in), nunits)
       || (code == VIEW_CONVERT_EXPR
 	  && maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
 		       GET_MODE_SIZE (TYPE_MODE (vectype_in))))
       || (CONVERT_EXPR_CODE_P (code)
-	  && (TYPE_MODE (TREE_TYPE (vectype))
-	      != TYPE_MODE (TREE_TYPE (vectype_in)))))
+	  && !tree_nop_conversion_p (TREE_TYPE (vectype),
+				     TREE_TYPE (vectype_in))))
     return false;
 
   if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-06 10:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 10:37 [PATCH] tree-optimization/114921 - _Float16 -> __bf16 isn't noop fixup 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).