Skip to content

Commit 4f6e97c

Browse files
EgorBogithub-actions
authored and
github-actions
committed
Revert #99140
1 parent a184e7d commit 4f6e97c

File tree

2 files changed

+16
-57
lines changed

2 files changed

+16
-57
lines changed

src/coreclr/jit/codegenarm64.cpp

+16-50
Original file line numberDiff line numberDiff line change
@@ -3626,7 +3626,7 @@ void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
36263626
unsigned slots = layout->GetSlotCount();
36273627

36283628
// Temp register(s) used to perform the sequence of loads and stores.
3629-
regNumber tmpReg = cpObjNode->ExtractTempReg(RBM_ALLINT);
3629+
regNumber tmpReg = cpObjNode->ExtractTempReg();
36303630
regNumber tmpReg2 = REG_NA;
36313631

36323632
assert(genIsValidIntReg(tmpReg));
@@ -3635,7 +3635,7 @@ void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
36353635

36363636
if (slots > 1)
36373637
{
3638-
tmpReg2 = cpObjNode->ExtractTempReg(RBM_ALLINT);
3638+
tmpReg2 = cpObjNode->GetSingleTempReg();
36393639
assert(tmpReg2 != tmpReg);
36403640
assert(genIsValidIntReg(tmpReg2));
36413641
assert(tmpReg2 != REG_WRITE_BARRIER_DST_BYREF);
@@ -3682,69 +3682,35 @@ void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
36823682
{
36833683
unsigned gcPtrCount = cpObjNode->GetLayout()->GetGCPtrCount();
36843684

3685-
// We might also need SIMD regs if we have 4 or more continuous non-gc slots
3686-
// On ARM64, SIMD loads/stores provide 8-byte atomicity guarantees when aligned to 8 bytes.
3687-
regNumber tmpSimdReg1 = REG_NA;
3688-
regNumber tmpSimdReg2 = REG_NA;
3689-
if ((slots >= 4) && compiler->IsBaselineSimdIsaSupported())
3690-
{
3691-
tmpSimdReg1 = cpObjNode->ExtractTempReg(RBM_ALLFLOAT);
3692-
tmpSimdReg2 = cpObjNode->ExtractTempReg(RBM_ALLFLOAT);
3693-
}
3694-
36953685
unsigned i = 0;
36963686
while (i < slots)
36973687
{
36983688
if (!layout->IsGCPtr(i))
36993689
{
3700-
// How many continuous non-gc slots do we have?
3701-
unsigned nonGcSlots = 0;
3702-
do
3690+
// Check if the next slot's type is also TYP_GC_NONE and use ldp/stp
3691+
if ((i + 1 < slots) && !layout->IsGCPtr(i + 1))
37033692
{
3704-
nonGcSlots++;
3705-
i++;
3706-
} while ((i < slots) && !layout->IsGCPtr(i));
3707-
3708-
const regNumber srcReg = REG_WRITE_BARRIER_SRC_BYREF;
3709-
const regNumber dstReg = REG_WRITE_BARRIER_DST_BYREF;
3710-
while (nonGcSlots > 0)
3693+
emit->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, tmpReg, tmpReg2, REG_WRITE_BARRIER_SRC_BYREF,
3694+
2 * TARGET_POINTER_SIZE, INS_OPTS_POST_INDEX);
3695+
emit->emitIns_R_R_R_I(INS_stp, EA_8BYTE, tmpReg, tmpReg2, REG_WRITE_BARRIER_DST_BYREF,
3696+
2 * TARGET_POINTER_SIZE, INS_OPTS_POST_INDEX);
3697+
++i; // extra increment of i, since we are copying two items
3698+
}
3699+
else
37113700
{
3712-
regNumber tmp1 = tmpReg;
3713-
regNumber tmp2 = tmpReg2;
3714-
emitAttr size = EA_8BYTE;
3715-
insOpts opts = INS_OPTS_POST_INDEX;
3716-
3717-
// Copy at least two slots at a time
3718-
if (nonGcSlots >= 2)
3719-
{
3720-
// Do 4 slots at a time if SIMD is supported
3721-
if ((nonGcSlots >= 4) && compiler->IsBaselineSimdIsaSupported())
3722-
{
3723-
// We need SIMD temp regs now
3724-
tmp1 = tmpSimdReg1;
3725-
tmp2 = tmpSimdReg2;
3726-
size = EA_16BYTE;
3727-
nonGcSlots -= 2;
3728-
}
3729-
nonGcSlots -= 2;
3730-
emit->emitIns_R_R_R_I(INS_ldp, size, tmp1, tmp2, srcReg, EA_SIZE(size) * 2, opts);
3731-
emit->emitIns_R_R_R_I(INS_stp, size, tmp1, tmp2, dstReg, EA_SIZE(size) * 2, opts);
3732-
}
3733-
else
3734-
{
3735-
nonGcSlots--;
3736-
emit->emitIns_R_R_I(INS_ldr, EA_8BYTE, tmp1, srcReg, EA_SIZE(size), opts);
3737-
emit->emitIns_R_R_I(INS_str, EA_8BYTE, tmp1, dstReg, EA_SIZE(size), opts);
3738-
}
3701+
emit->emitIns_R_R_I(INS_ldr, EA_8BYTE, tmpReg, REG_WRITE_BARRIER_SRC_BYREF, TARGET_POINTER_SIZE,
3702+
INS_OPTS_POST_INDEX);
3703+
emit->emitIns_R_R_I(INS_str, EA_8BYTE, tmpReg, REG_WRITE_BARRIER_DST_BYREF, TARGET_POINTER_SIZE,
3704+
INS_OPTS_POST_INDEX);
37393705
}
37403706
}
37413707
else
37423708
{
37433709
// In the case of a GC-Pointer we'll call the ByRef write barrier helper
37443710
genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF, 0, EA_PTRSIZE);
37453711
gcPtrCount--;
3746-
i++;
37473712
}
3713+
++i;
37483714
}
37493715
assert(gcPtrCount == 0);
37503716
}

src/coreclr/jit/lsraarmarch.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,6 @@ int LinearScan::BuildBlockStore(GenTreeBlk* blkNode)
697697
buildInternalIntRegisterDefForNode(blkNode, internalIntCandidates);
698698
}
699699

700-
if (size >= 4 * REGSIZE_BYTES && compiler->IsBaselineSimdIsaSupported())
701-
{
702-
// We can use 128-bit SIMD ldp/stp for larger block sizes
703-
buildInternalFloatRegisterDefForNode(blkNode, internalFloatRegCandidates());
704-
buildInternalFloatRegisterDefForNode(blkNode, internalFloatRegCandidates());
705-
}
706-
707700
// If we have a dest address we want it in RBM_WRITE_BARRIER_DST_BYREF.
708701
dstAddrRegMask = RBM_WRITE_BARRIER_DST_BYREF;
709702

0 commit comments

Comments
 (0)