I am currently trying to optimize some DSP related code with Shark and found that I am wasting a lot of time in a float to integer conversion:
SInt16 nextInt = nextFloat * 32768.0f + 0.5f;
As the iPhone seems to have an ARM11 FP co-processor, I am wondering if I can replace my code with the FTOSI instruction.
There is some documentation available at the ARM website, but I have no experience in inlining hand optimized assembly.
Has someone done that before?
I think I could inline the code with
__asm__ volatile
But how do I check if the instruction is available?
How can I pass my value in?
EDIT1: As Louis already pointed out, I forgot to mention that I am compiling with "Compile for Thumb" turned off.
EDIT2: As I want to convert float to signed Int16 and not unsigned Int, I changed the ARM instruction from FTOUI to FTOSI. This was a mistake in the original post.