[cfe-dev] [OpenCL patch] Misc vector support

Anton Lokhmotov Anton.Lokhmotov at arm.com
Sun Aug 14 03:43:42 PDT 2011


Hi Tanya,

The tests say it all really.  Clang currently (r137302):

1) uses the language options for AltiVec (wrongly as you agreed) and
LaxVectorConversions (wrongly because vector conversions are disallowed in
OpenCL [except between vectors of the same type, when they are effectively a
no-op]).

2) hence accepts invalid explicit conversions between vectors of different
types and sizes:

  uint4 u = (uint4)(1);
  int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector
type 'int4' and 'uint4'}}
  uint3 u3 = (uint3)u; // expected-error{{invalid conversion between
ext-vector type 'uint3' and 'uint4'}}

3) accepts taking the address of a vector literal, e.g.

  return &((int4)(3,2,1,0)); // expected-error{{address expression must be
an lvalue}}

4) only handles cases when a constant vector in the program scope is
initialised with a single element or another vector, but not recursively
e.g.:
  const float4 f_1_3 = (float4)(1,(float3)(2,3,4)); // [wrong!] error:
initializer element is not a compile-time constant

These changes seem not to affect other test cases (including ones available
for AltiVec).

Many thanks,
Anton.







More information about the cfe-dev mailing list