bitcast instruction
suarezvictor opened this issue · 1 comments
suarezvictor commented
There's a bug with respect to bitcast instruction: it shoudln't be cast with (float) or (unsigned int) operations: the bitcast should be a reinterpretation of the memory (i.e. corresponding to "memcpy"). If not, the compiler issues a conversion from float to interger or interger to float.
%17 = bitcast float %13 to i32
%21 = bitcast i32 %20 to float
Possible implementation:
inline unsigned int bitcast_to_uint(float a) { union _noname { float f; unsigned int i;} conv; conv.f = a; return conv.i; }
inline float bitcast_to_float(unsigned int a) { union _noname { float f; unsigned int i;} conv; conv.i = a; return conv.f; }