-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Missed optimization in math expression: squashing sqrt functions #34940
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
It will certainly make sense to have sqrt(a)sqrt(b) -> sqrt(ab) in InstCombine. |
See a lot of optimizations here: https://github.com/gcc-mirror/gcc/blob/07b69d3f1cd3dd8ebb0af1fbff95914daee477d2/gcc/match.pd |
You might want to create a "meta bug" about all of these, and then link the individual bug reports to that as dependencies. Also, there are other sources of these kinds of things that we should look at. For example, in https://github.com/sympy/sympy/blob/master/sympy/functions/elementary/trigonometric.py we have:
|
It appears this was reviewed in https://reviews.llvm.org/D41322 and fixed in r321637. |
mentioned in issue #34959 |
Extended Description
clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this code:
generates this assembly:
GCC (trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags generates more optimal code:
The text was updated successfully, but these errors were encountered: