forked from OSchip/llvm-project
Lower TAGPstack with negative offset to SUBG.
Summary: This never really occurs in the current codegen, so only a MIR test is possible. Reviewers: ostannard, pcc Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72123
This commit is contained in:
parent
df3f4e0d77
commit
40a80a0a19
|
@ -696,10 +696,12 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
|
|||
return true;
|
||||
}
|
||||
case AArch64::TAGPstack: {
|
||||
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(AArch64::ADDG))
|
||||
int64_t Offset = MI.getOperand(2).getImm();
|
||||
BuildMI(MBB, MBBI, MI.getDebugLoc(),
|
||||
TII->get(Offset >= 0 ? AArch64::ADDG : AArch64::SUBG))
|
||||
.add(MI.getOperand(0))
|
||||
.add(MI.getOperand(1))
|
||||
.add(MI.getOperand(2))
|
||||
.addImm(std::abs(Offset))
|
||||
.add(MI.getOperand(4));
|
||||
MI.eraseFromParent();
|
||||
return true;
|
||||
|
|
|
@ -2188,12 +2188,19 @@ bool AArch64InstrInfo::getMemOpInfo(unsigned Opcode, unsigned &Scale,
|
|||
MaxOffset = 4095;
|
||||
break;
|
||||
case AArch64::ADDG:
|
||||
case AArch64::TAGPstack:
|
||||
Scale = 16;
|
||||
Width = 0;
|
||||
MinOffset = 0;
|
||||
MaxOffset = 63;
|
||||
break;
|
||||
case AArch64::TAGPstack:
|
||||
Scale = 16;
|
||||
Width = 0;
|
||||
// TAGP with a negative offset turns into SUBP, which has a maximum offset
|
||||
// of 63 (not 64!).
|
||||
MinOffset = -63;
|
||||
MaxOffset = 63;
|
||||
break;
|
||||
case AArch64::LDG:
|
||||
case AArch64::STGOffset:
|
||||
case AArch64::STZGOffset:
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# RUN: llc -mtriple=aarch64 -run-pass=prologepilog,aarch64-expand-pseudo %s -o - | FileCheck %s
|
||||
|
||||
# CHECK: renamable $x8 = IRG $sp, $xzr
|
||||
|
||||
# CHECK: renamable $x0 = ADDG $x8, 0, 0
|
||||
# CHECK: renamable $x0 = ADDG $x8, 5, 0
|
||||
# CHECK: renamable $x0 = ADDG $x8, 63, 0
|
||||
# CHECK: $[[R:x[0-9]+]] = ADDXri $x8, 16, 0
|
||||
# CHECK: renamable $x0 = ADDG killed $[[R]], 63, 0
|
||||
|
||||
# CHECK: renamable $x0 = SUBG $x8, 5, 0
|
||||
# CHECK: renamable $x0 = SUBG $x8, 63, 0
|
||||
# CHECK: $[[R:x[0-9]+]] = SUBXri $x8, 16, 0
|
||||
# CHECK: renamable $x0 = SUBG killed $[[R]], 63, 0
|
||||
|
||||
---
|
||||
name: subg
|
||||
stack:
|
||||
- { id: 0, type: default, offset: 0, size: 16, alignment: 16,
|
||||
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
|
||||
local-offset: -16, debug-info-variable: '', debug-info-expression: '',
|
||||
debug-info-location: '' }
|
||||
body: |
|
||||
bb.0.entry:
|
||||
renamable $x8 = IRGstack $sp, $xzr
|
||||
|
||||
renamable $x0 = TAGPstack %stack.0, 0, killed renamable $x8, 0
|
||||
renamable $x0 = TAGPstack %stack.0, 5, killed renamable $x8, 0
|
||||
renamable $x0 = TAGPstack %stack.0, 63, killed renamable $x8, 0
|
||||
renamable $x0 = TAGPstack %stack.0, 64, killed renamable $x8, 0
|
||||
|
||||
renamable $x0 = TAGPstack %stack.0, -5, killed renamable $x8, 0
|
||||
renamable $x0 = TAGPstack %stack.0, -63, killed renamable $x8, 0
|
||||
renamable $x0 = TAGPstack %stack.0, -64, killed renamable $x8, 0
|
||||
RET_ReallyLR
|
||||
|
||||
...
|
Loading…
Reference in New Issue