[cfe-commits] [REVIEW] - Altivec vector literal casting problem - need feedback - AST/Sema

John McCall rjmccall at apple.com
Fri Jun 25 19:11:58 PDT 2010


On Jun 25, 2010, at 6:15 PM, John Thompson wrote:
> Though the ALTIVECPIM.pdf doc says: "A vector literal is written as a parenthesized vector type followed by a parenthesized set of constant expressions."  I.e. (vector unsigned int)(1, 2, 3, 4)
> However, should a non-constant expression like this be supported?:
>  
> int a = 1;
> (vector unsigned int)(1 + a, 2 + a, 3 + a, 4 + a)
>  
> My PS3 gcc doesn't like it, but do any other compilers support this?  Or more importantly, should Clang/LLVM support it?

It wouldn't be at all hard to implement — they're required for OpenCL vectors anyway.  I can't speak to whether other compilers support it or whether it's a good idea to start extending the AltiVec standard, though.

John.



More information about the cfe-commits mailing list