]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/114921 - _Float16 -> __bf16 isn't noop fixup
authorRichard Biener <rguenther@suse.de>
Mon, 6 May 2024 10:03:09 +0000 (12:03 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 7 May 2024 06:24:04 +0000 (08:24 +0200)
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.

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

index 7e571968a59d7f0cc9833ca930f5f2975c8dcd21..21e8fe98e44ab07eb9a361c2ef3461ed3f1d97cf 100644 (file)
@@ -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))