From: Tamar Christina Date: Wed, 22 Oct 2025 09:49:26 +0000 (+0100) Subject: vect: Add support for boolean reductions for VLA X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b387bd897857742bce85ef50725841af1329351;p=thirdparty%2Fgcc.git vect: Add support for boolean reductions for VLA The support for the new boolean reduction optabs didn't quite work for VLA because the code later on insists on the target still having a shift-and-insert optab. This is however not needed if the target can do the reduction using the new optabs, and the initial reduction value matches the neutral value and we have one SLP lane while not having a reduction chain. gcc/ChangeLog: * tree-vect-loop.cc (vectorizable_reduction): Don't always require IFN_VEC_SHL_INSERT when using reduc sbool optabs. --- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 77c9e15601b..9320bf8e878 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -7581,6 +7581,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo, values into the low-numbered elements. */ if ((double_reduc || neutral_op) && !nunits_out.is_constant () + && (SLP_TREE_LANES (slp_node) != 1 && !reduc_chain) + && !operand_equal_p (neutral_op, vect_phi_initial_value (reduc_def_phi)) && !direct_internal_fn_supported_p (IFN_VEC_SHL_INSERT, vectype_out, OPTIMIZE_FOR_SPEED)) {