This is the mail archive of the
mailing list for the GCC project.
Re: conversions between vectors
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>, dan at cgsoftware dot com
- Cc: Richard Henderson <rth at redhat dot com>, Alexandre Oliva <aoliva at redhat dot com>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: 22 Dec 2001 10:54:01 -0800
- Subject: Re: conversions between vectors
- References: <Pine.LNX.email@example.com>
> > c2 = __builtin_vector_add_v4si_unsigned (a2, b2);
> > even if both builtins map to the same exact machine instruction.
> If both are signed, or both unsigned, surely programmers will just use the
> + operator?
we have no support for any kind of operations on vectors. dan berlin
had a patch for + and - a few weeks ago, but no one approved AFAICT.
> Signed addition and unsigned addition are different in C; in signed
> addition, overflow is undefined behaviour and GCC will optimise on the
> basis that it is undefined. Thus the functions have conceptually
> different behaviour.
from what i've seen in vector extensions, signed and unsigned additions
for vector types are the same. i don't think there's overflow.
> The programmers should normally be using the much less cumbersome +
i absolutely agree. so, let's get Dan's patch approved.
> operator between two vectors of the same type. If they want to add a
> signed to an unsigned - yes, make them explictly convert one to the other
> rather than repeating the problems of the type system for the standard
for operations between signed and unsigned in which one is signed and
the other unsigned, yes, i agree. provided we have + - etc available.
this would be great.
however, what do you do for a function:
void foo (vector int, vector int);
that operates on vector int's but has the same effect for vector
unsigned as for vector signed? are you going to explicitly require a
cast? that's the part i don't like.
Aldy Hernandez E-mail: firstname.lastname@example.org
Red Hat, Inc.