-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check if fixed point square root in renderer can be replaced with hardware squareroot instruction #32
Comments
Seems to have implementations in the header file |
For some reason, I didn't think fixed-point square root could be done by shifting a regular square root. You're right; this can be replaced with the hardware function. |
Do the 64bit and 32 bit squareroots have identical performance for the hardware instruction? I can't tell without checking what the compiler generates in terms of load/store instructions and prologue. I don't expect the nds to have 64 bit registers, but I didn't really check. |
if (s > 0) I think this will always evaluate to true except for NaN and s=0 since s is the squared norm of a vector. Does either of these happen? Does the compiler recognize this? |
According to GBATEK, execution time is the same for both square root modes. The greater than zero check is just a precaution to avoid dividing by zero. Either way, we're talking about micro-optimizations that won't have any measurable impact on performance. |
https://github.com/Hydr8gon/sm64/blob/nds/src/nds/nds_renderer.c
The text was updated successfully, but these errors were encountered: