https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104267

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
pr91003.f90:8:13: note:   ------>vectorizing SLP node starting from: _61 =
.COND_MUL (_202, j_42(D), bnrm2_60(D), 0.0);
pr91003.f90:8:13: missed:   could not find an appropriate vector mask type.
pr91003.f90:8:13: note:   ------>vectorizing SLP node starting from: M.6_62 =
.COND_MAX (_202, _36, _61, 0.0);

I can't find where we actually verify we can use .COND_MUL for this node.  Huh.

Note it's

pr91003.f90:8:13: note:   node 0x426e8c8 (max_nunits=16, refcnt=1)
pr91003.f90:8:13: note:   op template: _61 = .COND_MUL (_202, j_42(D),
bnrm2_60(D), 0.0);
pr91003.f90:8:13: note:         stmt 0 _61 = .COND_MUL (_202, j_42(D),
bnrm2_60(D), 0.0);
pr91003.f90:8:13: note:         stmt 1 _61 = .COND_MUL (_202, j_42(D),
bnrm2_60(D), 0.0);
pr91003.f90:8:13: note:         children 0x426e950 0x426e9d8 0x426ea60
0x426eae8
pr91003.f90:8:13: note:   node (external) 0x426e950 (max_nunits=1, refcnt=1)
pr91003.f90:8:13: note:         { _202, _202 }
pr91003.f90:8:13: note:   node (external) 0x426e9d8 (max_nunits=1, refcnt=1)
pr91003.f90:8:13: note:         { j_42(D), j_42(D) }
pr91003.f90:8:13: note:   node (external) 0x426ea60 (max_nunits=1, refcnt=1)
pr91003.f90:8:13: note:         { bnrm2_60(D), bnrm2_60(D) }
pr91003.f90:8:13: note:   node (constant) 0x426eae8 (max_nunits=1, refcnt=1)
pr91003.f90:8:13: note:         { 0.0, 0.0 }

so _all_ childs are external/constant.  I think the issue here is that
we pushed vector(16) real(kind=4) as vector type for this external def
but we are expecting a VECTOR_BOOLEAN_TYPE_P here.

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 824ebb6354b..000a0f4b47e 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3444,7 +3444,9 @@ vectorizable_call (vec_info *vinfo,
     {
       if (slp_node)
        for (i = 0; i < nargs; ++i)
-         if (!vect_maybe_update_slp_op_vectype (slp_op[i], vectype_in))
+         if (!vect_maybe_update_slp_op_vectype (slp_op[i],
+                                                vectypes[i]
+                                                ? vectypes[i] : vectype_in))
            {
              if (dump_enabled_p ())
                dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

fixes this.

Reply via email to