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: RFA: PR c++/10611 arithmetic operations on vectors


On Fri, Jun 10, 2005 at 01:46:51PM -0700, Richard Henderson wrote:
> On Fri, Jun 10, 2005 at 09:44:30AM -0400, Aldy Hernandez wrote:
> > +   if (code1 == VECTOR_TYPE)
> > +     {
> > +       /* When we get here we should have two vectors of the same size.
> > + 	 Just prefer the unsigned one if present.  */
> > +       if (TYPE_UNSIGNED (t1))
> > + 	return build_type_attribute_variant (t1, attributes);
> > +       else
> > + 	return build_type_attribute_variant (t2, attributes);
> > +     }
> 
> I don't see any checks that the vectors are compatible.  So given
> 
> 	vector_size(16) float a, b;
> 	vector_size(16) int c;
> 	a = b + c;
> 
> Will this error?

Hmmmm... better yet, it'll ICE in emit_move_insn :-(.

I have to revist this to make it behave like the C front end, but it'll
have to wait till I get dropped from another race this weekend.

I think the check should go in build_binary_op, not in the snippet above.
Right around here:

      /* Vector arithmetic is only allowed when both sides are vectors.  */
      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
        {

Thanks for spotting this.
Aldy


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