On 8/25/2022 3:39 AM, Kong, Lingling via Gcc-patches wrote:
Hi, The conditional mult reduction cannot be recognized with current GCC. The following loop cannot be vectorized. Now add MULT_EXPR recognition for conditional scalar reduction. float summa(int n, float *arg1, float *arg2) { int i; float res1 = 1.0; for(i = 0; i < n; i++) { if(arg2[i]) res1 *= arg1[i]; } return res1; } gcc/ChangeLog: * tree-if-conv.cc (is_cond_scalar_reduction): Add MULT_EXPR recognition. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/gen-vect-34.c: New test. * gcc.dg/vect/vect-ifcvt-18.c: New test.
OK jeff