[cfe-dev] OpenCL vector initialization

Anton Lokhmotov Anton.Lokhmotov at arm.com
Wed Jun 1 01:48:47 PDT 2011


Hi Alberto,

Thanks for working on OpenCL support in Clang.  It's an important area we
should aim to enable for the 3.0 release.

The OpenCL requirement for vector literals is actually quite involved.  To
quote from a recent revision of the spec (to which you don't have access
yet):

"A vector literal is written as a parenthesized vector type followed by a
parenthesized comma delimited list of parameters. A vector literal operates
as an overloaded function. The forms of the function that are available is
the set of possible argument lists for which all arguments have the same
element type as the result vector, and the total number of elements is equal
to the number of elements in the result vector. In addition, a form with a
single scalar of the same type as the element type of the vector is
available."

"For example, the following forms are available for float4:
(float4)( float, float, float, float )
(float4)( float2, float, float )
(float4)( float, float2, float )
(float4)( float, float, float2 )
(float4)( float2, float2 )
(float4)( float3, float )
(float4)( float, float3 )
(float4)( float )"

As I understand, your patch handles only the last case.  We are going to
submit a patch shortly to accept valid cases and reject invalid cases.

Thanks,
Anton.







More information about the cfe-dev mailing list