Skip to content

Commit

Permalink
Remove restrictions on offset in Lowering::ContainBlockStoreAddress()
Browse files Browse the repository at this point in the history
  • Loading branch information
echesakov committed Dec 2, 2021
1 parent d652014 commit c3566b1
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/coreclr/jit/lowerarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,24 +442,14 @@ void Lowering::ContainBlockStoreAddress(GenTreeBlk* blkNode, unsigned size, GenT
GenTreeIntCon* offsetNode = addr->AsOp()->gtGetOp2()->AsIntCon();
ssize_t offset = offsetNode->IconValue();

// All integer load/store instructions on both ARM32 and ARM64 support
// offsets in range -255..255. Of course, this is a rather conservative
// check. For example, if the offset and size are a multiple of 8 we
// could allow a combined offset of up to 32760 on ARM64.
#ifdef TARGET_ARM
// All integer load/store instructions on Arm support offsets in range -255..255.
// Of course, this is a rather conservative check.
if ((offset < -255) || (offset > 255) || (offset + static_cast<int>(size) > 256))
{
return;
}

#ifdef TARGET_ARM64
// If we're going to use LDP/STP we need to ensure that the offset is
// a multiple of 8 since these instructions do not have an unscaled
// offset variant.
if ((size >= 2 * REGSIZE_BYTES) && (offset % REGSIZE_BYTES != 0))
{
return;
}
#endif
#endif // TARGET_ARM

if (!IsSafeToContainMem(blkNode, addr))
{
Expand Down

0 comments on commit c3566b1

Please sign in to comment.