-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
im*x
is inefficient
#12851
Comments
Relevant: #10000 - the redesign of |
I just see that the special case is already there:
I don't think it should use |
Just one more datapoint. |
These additional definitions
seem to solve this issue for me. These definitions catch |
Closed by #12887 |
The mathematical expression
i x
is naturally translated toim*x
. Unfortunately, this leads to less efficient code than1im*x
. (This is with LLVM 3.6.1).That is, while the expression
1im*x
leads to ideal code (I guess the multiplication by zero has to remain because of nans?), the expressionim*x
contains a branch, moving values between xmm and general registers, and loads the constant0.0
from memory (!). Also, the nan semantics are different, and I'd argue they are wrong -- I expectNan+Nan*im
as result:My guess is that the solution is either to ensure that
Complex{Bool}
is converted toComplex{Int}
before being converted toComplex{Float64}
, or to explicitly define complex arithmetic operators that handleComplex{Bool}
.The text was updated successfully, but these errors were encountered: