-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AArch64] Inefficient loading of some immediates #140787
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
https://godbolt.org/z/anGPGEeWh More simplified. |
@llvm/issue-subscribers-backend-aarch64 Author: AZero13 (AZero13)
https://godbolt.org/z/Yo55Gz8eP
We decompose many immediates, which is a good thing. However, there are some that we decompose that we can just avoid with the mov instruction. This is one such example. |
Note GCC implemented this in GCC 9 [generic non-aarch64 specific path] (and GCC 15 for the ccmp path): |
We have code for adjusting condition codes to simplify cmp immediates; see https://github.com/llvm/llvm-project/blob/26d9cb17a6e655993c991b66b21d5c378256d79b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L4077 . We currently don't try to do any adjustments unless the adjustment results in a legal cmp immediate. gcc apparently misses the adjustment for the following.
|
I see the issue, the problem is how GCC calculates the cost here. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120372 (fix included which I will be submitting soon). |
fixing that in particular is not an easy task because by the time the ccmp is generated, so is the cmp, which is another bug I meant to report but forgot to. |
https://godbolt.org/z/Yo55Gz8eP
We decompose many immediates, which is a good thing. However, there are some that we decompose that we can just avoid with the mov instruction. This is one such example.
The text was updated successfully, but these errors were encountered: