-
Notifications
You must be signed in to change notification settings - Fork 24
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
Unnecessary divss instructions #337
Comments
Good candidates for a first round would be greps for |
If the C-preprocessor macro I did take a look for anywhere |
Ah, ok. That clears up the confusion i had about it. Thought it looks noopish, but why do it then - but with the boost macro i get it. Thanks for shining a light on that for me.
looking forward to it. not that i feel playrho is slow - but faster is always welcome. |
See issue #337 for more info.
Oh wow!
I hadn't realized
divss
would get used instead ofmulss
even with maximum standards-compliant optimizations turned on. I recall having switched a bunch of places in the code base to using division to more directly express the intent of division under the assumption that the compiler would always convert these to using multiplication by the reciprocals.Looking at things more closely on Godbolt reveals that it's divisions by floating point values that can't exactly be expressed reciprocally which are done via the
divss
instruction unless the-freciprocal-math
optimization argument is added. Gcc, clang, and msvc all appear to convert any divisions by values that are exactly expressed reciprocally withmulss
however at least in versions 9.2, 8.0.0, and 19.22.Good news is this means there's places in the code that can be rewritten to be faster then. Bad news is that I don't recall all the places in the code where this will be.
Originally posted by @louis-langholtz in #331 (comment)
The text was updated successfully, but these errors were encountered: