It would be useful if gentypen were extended to include gentype1 as an alternative to the scalar gentype. I found myself in need of the swizzle properties for scalar datatypes when trying to generalize kernels for all vector lengths–including scalars. For example,
__kernel void kernel(__global gentypen *x)
{
// vector length is sizeof(*x) / sizeof((*x).s0)
...
}
The problem with the above code is that gentype doesn’t have .s0 in cl_platform.h. I propose adding something like the following:
typedef union
{
cl_float CL_ALIGNED(4) s[1];
#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x; };
__extension__ struct{ cl_float s0; };
__extension__ struct{ cl_float lo; };
__extension__ struct{ cl_float hi; };
#endif
#if defined( __CL_FLOAT1__)
__cl_float1 v1;
#endif
}cl_float1;
Maybe including the last “#if defined” isn’t correct; I’m not sure.