[cfe-commits] [OpenCL patch] Clang fails on nested vector literals *update*
Anton Lokhmotov
Anton.Lokhmotov at arm.com
Fri Oct 28 06:57:21 PDT 2011
> >> Your patch breaks the following:
> >>
> >> typedef int i4 __attribute((vector_size(16)));
> >> i4 x = (i4){1,2};
> >>
> >> It takes out the code that would otherwise pad the vector with zeros.
> >
> > You are right. But why was this behaviour used in the first place?
> >
> > Both OpenCL 1.1
> > (http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf, p164)
> > and AltiVec PIM
> > (http://www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPIM.pdf,
p26)
> > say that the number of elements in the source must be equal to the
> > number of elements in the result vector or one. GCC vector extensions
> > (http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html) are also
> > silent on the issue.
> >
> > Could you please point to a specification that says that missing
> > vector elements must be filled with zeros?
>
> No spec, but it's gcc-compatible for my given testcase.
OK, Alex helpfully provided us with a link to a spec: http://goo.gl/akXE0
("C/C++ Language Extensions for Cell Broadband Engine Architecture"), and
explained that it how GCC behaviour became the de facto standard.
Please review the updated patch.
Many thanks,
Anton.
[1] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-September/017451.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: literals_nested.patch
Type: application/octet-stream
Size: 5744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111028/83417005/attachment.obj>
More information about the cfe-commits
mailing list