]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Relax COND_EXPR reduction vectorization SLP restriction
authorRichard Biener <rguenther@suse.de>
Fri, 23 Feb 2024 15:16:38 +0000 (16:16 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 6 Jun 2024 06:55:56 +0000 (08:55 +0200)
Allow one-lane SLP but for the case where we need to swap the arms.

* tree-vect-stmts.cc (vectorizable_condition): Allow
single-lane SLP, but not when we need to swap then and
else clause.

gcc/tree-vect-stmts.cc

index b26cc74f41727d9b2f2cd285aae7801070dfdf7b..c82381e799e69f6d9d2b3ecb02bb224e0f5eaa17 100644 (file)
@@ -12116,7 +12116,7 @@ vectorizable_condition (vec_info *vinfo,
     = STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)) != NULL;
   if (for_reduction)
     {
-      if (slp_node)
+      if (slp_node && SLP_TREE_LANES (slp_node) > 1)
        return false;
       reduc_info = info_for_reduction (vinfo, stmt_info);
       reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
@@ -12205,6 +12205,10 @@ vectorizable_condition (vec_info *vinfo,
              cond_expr = NULL_TREE;
            }
        }
+      /* ???  The vectorized operand query below doesn't allow swapping
+        this way for SLP.  */
+      if (slp_node)
+       return false;
       std::swap (then_clause, else_clause);
     }