I know there’s __int_as_float and __float_as_int functions presented in current CUDA API. However, I would like to convert to/from more data types, such as short2 and unsigned int and even vector types. I know at ptx level, the “as operator” are implemented using mov.b32 instruction, and as I read the ptx manual, I think the move instruction is capable of moving from any type to any other type. So it’s possible to implement something like __uint_as_float, __float_as_uint, …probably need to split into two mov instruction when it comes to __short2_as_int, __int_as_short2, __short2_as_float…
Since we can’t write inline ptx capability code, I think these kind of function will be handy if one wants to do some trick on data types. Any suggestion? Any alternative way to do such thing?