Skip to content

Commit 53cc1dd

Browse files
authored
Remove redundant sign/zero extension for SIMD broadcasts (#108824)
1 parent da9381e commit 53cc1dd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/coreclr/jit/lowerxarch.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10377,6 +10377,22 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node)
1037710377

1037810378
op1 = node->Op(1);
1037910379
op1->ClearContained();
10380+
10381+
// Drop GT_CAST if it doesn't change the op1's bits we're about to broadcast
10382+
if (op1->OperIs(GT_CAST) && !op1->gtOverflow() && comp->opts.Tier0OptimizationEnabled())
10383+
{
10384+
GenTreeCast* cast = op1->AsCast();
10385+
if (!varTypeIsFloating(cast->CastToType()) &&
10386+
!varTypeIsFloating(cast->CastFromType()) &&
10387+
(genTypeSize(cast->CastToType()) >= genTypeSize(simdBaseType)) &&
10388+
(genTypeSize(cast->CastFromType()) >= genTypeSize(simdBaseType)))
10389+
{
10390+
BlockRange().Remove(op1);
10391+
op1 = cast->CastOp();
10392+
op1->ClearContained();
10393+
node->Op(1) = op1;
10394+
}
10395+
}
1038010396
}
1038110397
}
1038210398
break;

0 commit comments

Comments
 (0)