Atomics for vectors
===

I have some OpenCL code where operation like `atomic_cmpxchg` is needed, but for `int4` (or `long2`) instead of just `int` or `long`. After several tryings I didn't manage to create it, and googling gave nothing useful to me. My code now looks like this:

    int4 atomicCAS(__global int4 *place, int4 new_val)
    {
    	int4 old = *place;
    	if (atomic_cmpxchg((int*)place, 0, new_val.x) == 0)
    	{
    		*place = new_val;
    	}
    	return old;
    }

It checks that the place contains zero vector and uses some additional knowledge about the data: in a non-zero `int4` vector all components are non-zero.

However, this code doesn't work and I can't get it working: there seems to be no way to convert int4* to int*, which points to the first (or any other) component of the vector.