Skip to content

Commit

Permalink
Remove redundant sign/zero extension for SIMD broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Oct 13, 2024
1 parent 4900696 commit 01735f3
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 @@ -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())
{
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 01735f3

Please sign in to comment.