Skip to content
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

Remove redundant sign/zero extension for SIMD broadcasts #108824

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/coreclr/jit/lowerxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10356,6 +10356,22 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)

op1 = node->Op(1);
op1->ClearContained();

// Drop GT_CAST if it doesn't change the op1's bits we're about to broadcast
if (op1->OperIs(GT_CAST) && !op1->gtOverflow() && comp->opts.Tier0OptimizationEnabled())
{
GenTreeCast* cast = op1->AsCast();
if (!varTypeIsFloating(cast->CastToType()) &&
!varTypeIsFloating(cast->CastFromType()) &&
Comment on lines +10394 to +10395
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this rather check for varTypeIsInteger on both?

We have several types (integer, floating, simd, and mask) so a negative test may accidentally include the wrong things

(genTypeSize(cast->CastToType()) >= genTypeSize(simdBaseType)) &&
(genTypeSize(cast->CastFromType()) >= genTypeSize(simdBaseType)))
{
BlockRange().Remove(op1);
op1 = cast->CastOp();
op1->ClearContained();
node->Op(1) = op1;
}
}
}
}
break;
Expand Down
Loading