This is the mail archive of the gcc@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: Vector types and type conversions


Janis Johnson writes:
 > On Wed, Apr 19, 2006 at 05:30:54PM +0200, Paolo Bonzini wrote:
 > > 
 > > The C spec for Altivec (not the ISA) is a horrible spec that set a 
 > > horrible de facto standard.  To some extent, gcc already departed from 
 > > Altivec, for example by disallowing the (vector int) (1, 2, 3, 4) syntax 
 > > -- notice the parentheses instead of the braces -- because it was 
 > > extremely hackish to implement in a Bison parser.
 > 
 > The Motorola AltiVec PIM (sorry, I'm looking at a hard copy and don't
 > have the link handy) says:
 > 
 >   2.4.2 Assignment
 > 
 >   If either the left hand side or right hand side of an expression has
 >   a vector type, then both sides of the expression must be of the same
 >   vector type.  Thus, the expression a = b is valid and represents
 >   assignment if a and b are of the same vector type (or if neither is
 >   a vector type).  Otherwise, the expression is invalid and must be
 >   signaled as an error by the compiler.
 > 
 > We can't blame this admittedly horrible spec for this one.

You seem to have missed 

"2.4.6 Type Casting

"... None of the casts performs a conversion; the bit pattern of the
result is the same as the bit pattern of the argument that is cast."

Andrew.


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