This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, vectorizer] Fix PR33953 ICE in vectorizable_operation at tree-vect-transform.c:4017


Dorit Nuzman/Haifa/IBM wrote on 06/11/2007 10:20:40:

> > @@ -3915,10 +3916,14 @@ vectorizable_operation (tree stmt, block
> >    /* Handle def.  */
> >    vec_dest = vect_create_destination_var (scalar_dest, vectype);
> >
> > -  if (!slp_node)
> > -    vec_oprnds0 = VEC_alloc (tree, heap, 1);
> > -  if (op_type == binary_op)
> > -    vec_oprnds1 = VEC_alloc (tree, heap, 1);
> > +  if (slp_node && op_type == binary_op)
> > +    vec_oprnds1 = VEC_alloc (tree, heap, slp_node->vec_stmts_size);
> > +  else
> > +    {
> > +      vec_oprnds0 = VEC_alloc (tree, heap, 1);
> > +      if (op_type == binary_op)
> > +        vec_oprnds1 = VEC_alloc (tree, heap, 1);
> > +    }
> >
>
> can you please add a comment explaining why in the case of SLP-ing a
> binary-op we need to allocate a VEC only for oprnd1 and not oprnd0?
> and why in the case of SLP-ing an unary-op we allocate a VEC of size
> 1 whereas in the case of SLP-ing a binary-op we allocate a VEC of
> size "vec_stmts_size"? (I think a high level description of how
> these VECs are used would help)

We actually need a VEC of size "vec_stmts_size" only in case of SLP of
shift with scalar argument. I will rewrite the condition here and add a
comment.

>
> >    /* In case the vectorization factor (VF) is bigger than the number
> >       of elements that we can fit in a vectype (nunits), we have to
> > generate
> > @@ -3993,10 +3998,17 @@ vectorizable_operation (tree stmt, block
> >                     fprintf (vect_dump, "operand 1 using scalar
mode.");
> >                   vec_oprnd1 = op1;
> >                   VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
> > +                 if (slp_node)
> > +                   {
> > +                     /* Store vec_oprnd1 for every vector stmt to be
> > created
> > +                        for SLP_NODE.  */
> > +                     for (k = 0; k < slp_node->vec_stmts_size - 1;
k++)
> > +                       VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
> > +                   }
>
> would this work also if it was a different (scalar) shift-amounts
> for the generated vector stmts? i.e. if the testcase was:
>
> > +         dstdata[0] |= srcdata[0] << srcshift1;
> > +         dstdata[1] |= srcdata[1] << srcshift1;
> > +         dstdata[2] |= srcdata[2] << srcshift1;
> > +         dstdata[3] |= srcdata[3] << srcshift1;
> > +         dstdata[4] |= srcdata[4] << srcshift2;
> > +         dstdata[5] |= srcdata[5] << srcshift2;
> > +         dstdata[6] |= srcdata[6] << srcshift2;
> > +         dstdata[7] |= srcdata[7] << srcshift2;
>
> ?

We check during the analysis that all the shift arguments in case of scalar
shift arguments are equal. I will add a comment here to explain this.

Thanks,
Ira

>
> thanks,
> dorit
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]