Skip to content

Commit

Permalink
JIT: Expand unaligned address recognition for ARM32 (#92938)
Browse files Browse the repository at this point in the history
The JIT has some backwards compatibility for accessing unaligned float
fields on ARM32. With physical promotion, we can end up with some new
patterns that we didn't handle. Expand the pattern matching to handle a
constant address unaligned address.

Fix #92382
  • Loading branch information
jakobbotsch authored Oct 3, 2023
1 parent 01cab29 commit 6dadf7c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9889,18 +9889,18 @@ GenTree* Compiler::fgMorphFinalizeIndir(GenTreeIndir* indir)
GenTree* addr = indir->Addr();

#ifdef TARGET_ARM
GenTree* effAddr = addr->gtEffectiveVal(true);
// Check for a misalignment floating point indirection.
if (effAddr->OperIs(GT_ADD) && varTypeIsFloating(indir))
if (varTypeIsFloating(indir))
{
GenTree* addOp2 = effAddr->gtGetOp2();
if (addOp2->IsCnsIntOrI())
// Check for a misaligned floating point indirection.
GenTree* effAddr = addr->gtEffectiveVal(true);
target_ssize_t offset;
FieldSeq* fldSeq;
gtPeelOffsets(&effAddr, &offset, &fldSeq);

if (((offset % genTypeSize(TYP_FLOAT)) != 0) ||
(effAddr->IsCnsIntOrI() && ((effAddr->AsIntConCommon()->IconValue() % genTypeSize(TYP_FLOAT)) != 0)))
{
ssize_t offset = addOp2->AsIntCon()->IconValue();
if ((offset % genTypeSize(TYP_FLOAT)) != 0)
{
indir->gtFlags |= GTF_IND_UNALIGNED;
}
indir->gtFlags |= GTF_IND_UNALIGNED;
}
}
#endif // TARGET_ARM
Expand Down

0 comments on commit 6dadf7c

Please sign in to comment.