logical operators for build-in vector types should applied componet-wise

Hi,

I would like to to use operator && two int4 and expect a int4 as result. I get an error, please see attached message.

Have you any hints?

Thanks

screw

/tmp/OCLPevl34.cl(373): error: bad argument type to opencl convert_* function: expected src and dst have the same number of elements float4 f = convert_float4(((int4)1) && ((int4)0)); ^

As per OpenCL specification, 6.3(g),

For scalar types, the logical operators shall return 0 if the result of the operation is false and 1 if the result is true. For vector types, the logical operators shall return 0 if the result of the operation is false and –1 (i.e. all bits set) if the result is true.

As per Spec 6.2.3, explicit conversions need source and destination vectors to be matching, which means convert_float4 is expecting a 4 element vector, but is getting a scalar value.