Skip to content

Commit

Permalink
Remove redundant sign/zero extension for SIMD broadcasts (dotnet#108824)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored and mikelle-rogers committed Dec 4, 2024
1 parent 28bea0f commit 5a1ebd2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/coreclr/jit/lowerxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10377,6 +10377,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()) &&
(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

0 comments on commit 5a1ebd2

Please sign in to comment.