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: conversions between vectors


Aldy Hernandez <aldyh@redhat.com> writes:

| > > Compatability with valarray is a nice thought, but I don't think it's
| > > quite relevant.  In documenting valarrays and C-vectors, we'll find
| > > more differences than similarities.
| > 
| > Valarrays tell you that you can't operate between vectors of different
| > lengths.  They tell you what types of operands you can operate on, with
| 
| but as i understand, you can't operate between vectors of the same size
| either. (signed vs unsigned)

You can operate between vectors of tehs ame size and same value type.
When mixing types, great care must be exercised.  

I don't think value-loss conversions should be implicit. 

[...]

| > what type everything has and where the conversions are applying.  At least
| > with valarray we have a design that has already been worked out and some
| 
| is there some documentation for valarray?  i'd like to read more on it.

The only documentation I know for valarray<> is the standard C++ text
and the implementation we have in V3 (plus my yet-to-finish book on
numerics). 

[...]

| i suppose we can force the programmer to do:
| 
| 	c2 = (vector signed int) __builtin_vector_add_v4si
| 		((vector signed int) a2, (vector signed int) b2);
| 
| but that's precisely my point.  do we really want to force such casts
| for something that should just work?

My personnal opinion is yes.  One should be explicit about type
issues.

-- Gaby


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