I've seen ASM routines in cast.h which seems to quickly convert integer into floats and floats into integer: if I directly call these functions instead of doing a simple cast from the compiler like int x= (float) y, how much faster will it be ?
also, I use libsamplerate in my project and it requires LRINT and LRINTF functions to be set: everything compiles fine so I guess they are present in libmath but again, what the performance against the functions in cast.h ?
thanks
PS: libsamplerate also ask about CPU_CLIPS_NEGATIVE and CPU_CLIPS_POSITIVE flags, does the Gekko automatically clips value on negative/positive float to int conversion ?
Casting float to int, fast math operations on double/float
Casting float to int, fast math operations on double/float
Last edited by Eke on Wed Jan 28, 2009 10:39 am, edited 1 time in total.
Re: casting float to int
I've been recently informed about the bottleneck issues that could occur when using simple float/double to int cast on modern CPU that use pipelining and load&store scheme (like the Power PC)
Some interesting articles here:
http://www.mega-nerd.com/FPcast/
http://assemblyrequired.crashworks.org/ ... s-to-ints/
Any ideas about what I should use ? lrint from math.h or those functions in libogc/cast.h ?
Or is powerpc-gekko-gcc already able to get ride of this alone with optimization enabled ?
Secondly, what about the __FAST_MATH__ define in math.h, is it defined by default or do we have to somehow enable it in gcc ?
Any advices would be appreciated, thanks
Some interesting articles here:
http://www.mega-nerd.com/FPcast/
http://assemblyrequired.crashworks.org/ ... s-to-ints/
Any ideas about what I should use ? lrint from math.h or those functions in libogc/cast.h ?
Or is powerpc-gekko-gcc already able to get ride of this alone with optimization enabled ?
Secondly, what about the __FAST_MATH__ define in math.h, is it defined by default or do we have to somehow enable it in gcc ?
Any advices would be appreciated, thanks
Who is online
Users browsing this forum: No registered users and 4 guests