Conversion of unsigned int to float appears to be difficult for x86-64 processor. However, signed int to float is directly supported in the hardware.
The GCC compiler is clever enough to use the hardware instruction CVTSI2SS. However in the case of unsigned int to float, it needs to treat numbers which would be negative in two’s complement notation differently. So the generated code contains a branch!
Doing this with random numbers means the branch can go either way, with 50% probability. No amount of hardware branch prediction can help with this!
Rewriting the code to use signed integers instead of unsigned ones (basically, dropping the most significant bit) speeded up some critical piece of code by 10%.
A very noticeable improvement!