]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/122110 - do not reject all bit-precision reductions
authorRichard Biener <rguenther@suse.de>
Wed, 1 Oct 2025 09:26:45 +0000 (11:26 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 1 Oct 2025 11:49:53 +0000 (13:49 +0200)
We can handle bitwise-operation reductions and reductions on mask
vectors just fine.

PR tree-optimization/122110
* tree-vect-loop.cc (vectorizable_reduction): Relax restriction
to mode-precision operations.

gcc/tree-vect-loop.cc

index 18360375e2974b8540df4ddf945d7397925d4c54..1d549e4a03e236a76f75e97f66df9016fe0b54fd 100644 (file)
@@ -7187,7 +7187,11 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
     return false;
 
   /* Do not try to vectorize bit-precision reductions.  */
-  if (!type_has_mode_precision_p (op.type))
+  if (!VECTOR_BOOLEAN_TYPE_P (vectype_out)
+      && !type_has_mode_precision_p (op.type)
+      && op.code != BIT_AND_EXPR
+      && op.code != BIT_IOR_EXPR
+      && op.code != BIT_XOR_EXPR)
     return false;
 
   /* Lane-reducing ops also never can be used in a SLP reduction group