-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[AArch64] there is redundant neg instruction for mull with complex type #84152
Comments
@llvm/issue-subscribers-backend-aarch64 Author: Allen (vfdff)
* **test**: https://gcc.godbolt.org/z/enYjsjGfE
```
define ptr @_ZNSt7complexIiEmLIiEERS0_RKS_IT_E(ptr noundef nonnull align 4 dereferenceable(8) %a,
ptr noundef nonnull align 4 dereferenceable(8) %b) align 2 {
entry:
%0 = load i32, ptr %a, align 4
%1 = load i32, ptr %b, align 4
%mul = mul nsw i32 %1, %0
%_M_imag = getelementptr inbounds i8, ptr %a, i64 4
%2 = load i32, ptr %_M_imag, align 4
%_M_imag.i = getelementptr inbounds i8, ptr %b, i64 4
%3 = load i32, ptr %_M_imag.i, align 4
%mul3 = mul nsw i32 %3, %2
%sub = sub nsw i32 %mul, %mul3
%mul6 = mul nsw i32 %3, %0
%mul9 = mul nsw i32 %2, %1
%add = add nsw i32 %mul6, %mul9
store i32 %add, ptr %_M_imag, align 4
store i32 %sub, ptr %a, align 4
ret ptr %a
}
```
|
vfdff
added a commit
to vfdff/llvm-project
that referenced
this issue
Mar 7, 2024
Pattern should be sorted in priority order since the pattern evalutor stops checking as soon as it finds a faster sequence. so for a * b - c * d, we prefer to match the 2nd operands of sub, which can be use msub to fold them. Refer to https://www.slideshare.net/chimerawang/instruction-combine-in-llvm Fix llvm#84152
the complex<long long> has similar issue , https://gcc.godbolt.org/z/79GnMPnY1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: