[cfe-dev] OpenCL vector data types

Török Edwin edwintorok at gmail.com
Mon Oct 25 23:48:58 PDT 2010


On Mon, 25 Oct 2010 23:58:24 +0200
Alberto Magni <alberto.magni86 at gmail.com> wrote:

> Hi everybody,
> 
> for my master thesis I am extending clang in order to support OpenCL,
> at least the most important features.
> I am adding the support for vector data types.
> 
> As I saw in many of the test cases in the suite the standard way to
> support them is using the ext_vector_type attribute, like this:
> 
> typedef __attribute__(( ext_vector_type(4) )) int int4;
> 
> My problem is that OpenCL supports a variety of vector data types:
> charn, intn, floatn ...
> There are 9 basic types supported and 'n' can assume 6 different
> values. Moreover every vector type has an alias: cl_charn,
> cl_intn, ... and so on. This will end up in 108 typedefs to add in
> the Preprocessor intialization phase.
> Can this be a problem?

stdlib.h has 117 typedefs, iostream has 480, so I don't think 108 is
that much: 
clang  -E /usr/include/stdlib.h|grep typedef|wc -l
117

--Edwin



More information about the cfe-dev mailing list