diff mbox series

tree-optimization/114921 - _Float16 -> __bf16 isn't noop

Message ID 20240502121902.D09193858426@sourceware.org
State New
Headers show
Series tree-optimization/114921 - _Float16 -> __bf16 isn't noop | expand

Commit Message

Richard Biener May 2, 2024, 12:18 p.m. UTC
The vectorizer handles a _Float16 to __bf16 conversion through
vectorizable_assignment, thinking it's a noop.  The following
fixes this by making the same-size check stricter, requiring
the same vector component mode.

Posted again for the arm CI

	PR tree-optimization/114921
	* tree-vect-stmts.cc (vectorizable_assignment): Require
	same vector component modes for input and output.
---
 gcc/tree-vect-stmts.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f8d8636b139..adb6ef53254 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5961,8 +5961,8 @@  vectorizable_assignment (vec_info *vinfo,
        || code == VIEW_CONVERT_EXPR)
       && (!vectype_in
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype_in), nunits)
-	  || maybe_ne (GET_MODE_SIZE (TYPE_MODE (vectype)),
-		       GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
+	  || (TYPE_MODE (TREE_TYPE (vectype))
+	      != TYPE_MODE (TREE_TYPE (vectype_in)))))
     return false;
 
   if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))