-
Notifications
You must be signed in to change notification settings - Fork 4.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
Optimize AdvSimd.Extract() when passed variable that can be const propagated #36070
Comments
//cc : @BruceForstall , @echesakovMSFT , @tannergooding |
cc @CarolEidt |
This is a case for any intrinsic that has an immediate operand - not only for Extract |
Doesn't Roslyn propagate constants for such simple cases (without inlining) ? |
This is basically a dupe of #11062 and possibly a couple other issues iirc. It is a problem on both x86/x64 and ARM64. Ideally we would delay the decision for this to be a call or constant until lowering but that isn't necessarily "easy" to do today. We could presumably extend that to |
There is also another case that might be related where we miss some optimizations on x86 due to Basically the tree might look like:
and certain instructions might be able to contain or consume the underlying value directly, but we aren't smart enough to contain and handle the cast today. |
Since it appears unlikely we will work on this for 5.0, I've moved it out to 6.0. cc @AndyAyersMS who might be interested in the phase ordering aspect of this. |
Un-assigning myself |
Closing as a dup of #11062 |
I was expecting it to generate:
But instead we generate the following.
It happens because we decide whether to fallback or not depending on the
index
operand. If it is const, we generate the optimize code however this decision happens during importing and we won't know if the operand is constant or not until we do constant propagation which is in later phase.We should also investigate if there are more scenarios in which we miss optimizing opportunity because of this dependency and evaluate if we should do the decision after constant propagation is done probably in lower.
category:cq
theme:hardware-intrinsics
skill-level:intermediate
cost:medium
The text was updated successfully, but these errors were encountered: