-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: Optimize ConditionalSelect with const zero when condition is not TYP_MASK #113864
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
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC. @dotnet/jit-contrib, @EgorBo for secondary review
/azp run Fuzzlyn |
Azure Pipelines successfully started running 1 pipeline(s). |
ping @tannergooding @EgorBo for merge |
// If either of the value operands is const zero, we can optimize down to AND or AND_NOT. | ||
GenTree* binOp = nullptr; | ||
|
||
if (op3->IsVectorZero()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have nodes of type ConvertMaskToVector(Vector.Zero)
for op2
or op3
. I just opened #114272 to fix a case where I was not checking that for arm64.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a way we'd create that currently on xarch, but I plan on reviving #110342 and will keep that possibility in mind since we'll more eagerly choose intrinsics that produce a mask with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
AVX-512 embedded masking relies on use of
ConditionalSelect
, which makes this pattern common:This change improves codegen when the same pattern is used with a compare that does not produce a kmask result:
And more when
pblendvb
is not available:Diffs show a few interesting variations in tests.