Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 13 additions & 2 deletions src/coreclr/jit/hwintrinsiccodegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,12 +1093,23 @@ void CodeGen::genBaseIntrinsic(GenTreeHWIntrinsic* node)
{
if (op1->isContained() || op1->isUsedFromSpillTemp())
{
genHWIntrinsic_R_RM(node, ins, attr, targetReg, op1);
// We want to always emit the EA_16BYTE version here.
//
// For ToVector256Unsafe the upper bits don't matter and for GetLower we
// only actually need the lower 16-bytes, so we can just be "more efficient"

genHWIntrinsic_R_RM(node, ins, EA_16BYTE, targetReg, op1);
}
else
{
// We want to always emit the EA_32BYTE version here.
//
// For ToVector256Unsafe the upper bits don't matter and this allows same
// register moves to be elided. For GetLower we're getting a Vector128 and
// so the upper bits aren't impactful either allowing the same.

// Just use movaps for reg->reg moves as it has zero-latency on modern CPUs
emit->emitIns_Mov(INS_movaps, attr, targetReg, op1Reg, /* canSkip */ true);
emit->emitIns_Mov(INS_movaps, EA_32BYTE, targetReg, op1Reg, /* canSkip */ true);
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/hwintrinsicxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,11 +1318,12 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic,
op1 = gtNewSimdHWIntrinsicNode(simdType, op1, gtNewIconNode(0xD8), NI_AVX2_Permute4x64,
simdOtherJitType, simdSize);

simdSize = 16;
simdType = TYP_SIMD16;

op1 = gtNewSimdHWIntrinsicNode(simdType, op1, NI_Vector256_GetLower, simdBaseJitType,
simdSize);

simdSize = 16;
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/lowerxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,7 @@ void Lowering::LowerHWIntrinsicGetElement(GenTreeHWIntrinsic* node)
// ...
// op1 = op1.GetLower();

tmp1 = comp->gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, NI_Vector256_GetLower, simdBaseJitType, 16);
tmp1 = comp->gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, NI_Vector256_GetLower, simdBaseJitType, simdSize);
BlockRange().InsertBefore(node, tmp1);
LowerNode(tmp1);
}
Expand Down