Skip to content

Commit

Permalink
[Xtensa] Fix i8/i16 alignment.
Browse files Browse the repository at this point in the history
Fix frame indices elimination. The offset value
in load/store instructions must be aligned to 32-bit.
  • Loading branch information
andreisfr committed Jul 13, 2023
1 parent 1e39483 commit 2aba83d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/Target/Xtensa/XtensaRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ bool XtensaRegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
case Xtensa::L16SI:
case Xtensa::L16UI:
case Xtensa::S16I:
Valid = (Offset >= 0 && Offset <= 510);
Valid = (Offset >= 0 && Offset <= 510) && ((Offset & 0x1) == 0);
break;
case Xtensa::LEA_ADD:
Valid = (Offset >= -128 && Offset <= 127);
break;
default:
Valid = (Offset >= 0 && Offset <= 1020);
// assume that MI is 32-bit load/store operation
Valid = (Offset >= 0 && Offset <= 1020) && ((Offset & 0x3) == 0);
break;
}

Expand Down

0 comments on commit 2aba83d

Please sign in to comment.