[cfe-dev] Casting scalars to vectors

John Thompson john.thompson.jtsoftware at gmail.com
Tue Apr 20 12:45:35 PDT 2010


Clang was generating an error on vector initializers, when all the vector
slots are not provided, i.e.:

vector unsigned int v = (vector unsigned int)(vector int)(-1);

Instead of:

vector unsigned int v = (vector unsigned int)(vector int)(-1, -1, -1, -1);

I'm seeing these kinds of statements in some headers in the PS3 sdk, which
gcc allows.

I've checked in a fix and revised the altivec tests.  (Sorry I missed a
test last night, and broke the build.)

I have a question, though (for Anton or anyone).  What will the initializers
be for the unspecified slots?  Will they be 0?  What does gcc do?

On Tue, Apr 20, 2010 at 2:34 AM, Anton Lokhmotov <Anton.Lokhmotov at arm.com>wrote:

> > This stops the error, but is it enough?
> Sorry, I couldn't understand from the thread what was the error?
> > -      if (SemaRef.getLangOptions().OpenCL ||
> SemaRef.getLangOptions().AltiVec)
> > +      if (SemaRef.getLangOptions().OpenCL)
> In other words, it's something that's not required for AltiVec but is
> required for OpenCL?
> Cheers,
> Anton.

John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100420/49b38ed6/attachment.html>

More information about the cfe-dev mailing list