>
> I'm still trying to get access to PPC. Linux on PPC should have lrint/lrintf
> so thats not a big issue. I'm much more interested in gettig access to
> MacOS.
>
>
I made some tests on a G3 with Code Warrior 5 with optimizations on (Mac OS
8.6). The lrint/lrintf is slower that the standard cast code.
Here are the result of disassembing 2 tests functions :
int test1 (float in){ return lrintf(in); } gives :
...
00000000: 7C0802A6 mflr r0
00000004: 90010008 stw r0,8(SP)
00000008: 9421FFC0 stwu SP,-64(SP)
0000000C: 48000001 bl .rinttol
00000010: 60000000 nop
00000014: 80010048 lwz r0,72(SP)
00000018: 38210040 addi SP,SP,64
0000001C: 7C0803A6 mtlr r0
00000020: 4E800020 blr
...
Is seems that lrint/lrintf are implemented in the MathLib using the rinttol
call.
int test2 (float in){ return in; } gives :
...
00000000: FC00081E fctiwz fp0,fp1
00000004: D801FFF0 stfd fp0,-16(SP)
00000008: 8061FFF4 lwz r3,-12(SP)
0000000C: 4E800020 blr
...
Directly using the fctiwz
Stephane Letz