]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Deal with vector typed operands in conversions
authorRichard Biener <rguenther@suse.de>
Fri, 23 Jun 2023 10:48:36 +0000 (12:48 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 23 Jun 2023 12:16:22 +0000 (14:16 +0200)
The following avoids using TYPE_PRECISION on VECTOR_TYPE when
looking for bit-precision changes in vectorizable_assignment.
We didn't anticipate a stmt like

  _21 = VIEW_CONVERT_EXPR<unsigned int>(vect__1.7_28);

and the following makes sure to handle that.

* tree-vect-stmts.cc (vectorizable_assignment):
Properly handle non-integral operands when analyzing
conversions.

gcc/tree-vect-stmts.cc

index e66497895400b71ea63fa106a2087f9a28c791a9..01cb19ce933cbfcbc3f57156b90a0aa1e2434f01 100644 (file)
@@ -5833,12 +5833,15 @@ vectorizable_assignment (vec_info *vinfo,
   /* We do not handle bit-precision changes.  */
   if ((CONVERT_EXPR_CODE_P (code)
        || code == VIEW_CONVERT_EXPR)
-      && INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
-      && (!type_has_mode_precision_p (TREE_TYPE (scalar_dest))
-         || !type_has_mode_precision_p (TREE_TYPE (op)))
+      && ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
+          && !type_has_mode_precision_p (TREE_TYPE (scalar_dest)))
+         || (INTEGRAL_TYPE_P (TREE_TYPE (op))
+             && !type_has_mode_precision_p (TREE_TYPE (op))))
       /* But a conversion that does not change the bit-pattern is ok.  */
-      && !((TYPE_PRECISION (TREE_TYPE (scalar_dest))
-           > TYPE_PRECISION (TREE_TYPE (op)))
+      && !(INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
+          && INTEGRAL_TYPE_P (TREE_TYPE (op))
+          && (TYPE_PRECISION (TREE_TYPE (scalar_dest))
+              > TYPE_PRECISION (TREE_TYPE (op)))
           && TYPE_UNSIGNED (TREE_TYPE (op))))
     {
       if (dump_enabled_p ())