-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Missed optimization in math expression: aggressive optimization with std::pow #34943
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
Comments
Another missing InstCombine. |
One more case:
clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math':
gcc(trunk) with '--std=c++17 -O3 -march=native -ffast-math':
|
See a lot of optimizations here: https://github.com/gcc-mirror/gcc/blob/07b69d3f1cd3dd8ebb0af1fbff95914daee477d2/gcc/match.pd |
Same for opposite case
can be simplified to pow(a,b+c+d-2) |
mentioned in issue #34959 |
This is one of the patterns suggested in issue #34943.
This is one of the patterns suggested in issue #34943.
This is one of the patterns suggested in issue #34943.
All of the examples here should be optimized now. If there's still something missing, please open a new issue. |
Extended Description
clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this code:
generates this assembly:
As you can see, me can simplify it by adding 4 to 'x' variable and after call std::pow.
The text was updated successfully, but these errors were encountered: