From e5fd2aa95be1dc8ba62f2cbff925a5e9a59a1673 Mon Sep 17 00:00:00 2001 From: Zaara Syeda Date: Tue, 23 Jul 2024 13:24:09 -0400 Subject: [PATCH 1/5] [PPC][AIX] Set needsFP to true when base pointer is used in prologue/epilogue When the base pointer r30 is used to hold the stack pointer, r30 is spilled in the prologue. On AIX registers are saved from highest to lowest, so r31 also needs to be saved. Setting needsFP to true on AIX when the base pointer is used allows r31 to also be saved and restored. --- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 3 + llvm/test/CodeGen/PowerPC/aix-base-pointer.ll | 13 +- .../PowerPC/ppc64-rop-protection-aix.ll | 436 ++++++++++-------- 3 files changed, 249 insertions(+), 203 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 1963582ce68631..11332dbd8147cf 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -376,6 +376,9 @@ bool PPCFrameLowering::needsFP(const MachineFunction &MF) const { if (MF.getFunction().hasFnAttribute(Attribute::Naked)) return false; + if (Subtarget.isAIXABI() && Subtarget.getRegisterInfo()->hasBasePointer(MF)) + return true; + return MF.getTarget().Options.DisableFramePointerElim(MF) || MFI.hasVarSizedObjects() || MFI.hasStackMap() || MFI.hasPatchPoint() || MF.exposesReturnsTwice() || diff --git a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll index ab222d770360ce..cc4f0ee92c5dce 100644 --- a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll +++ b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll @@ -6,8 +6,9 @@ ; Use an overaligned buffer to force base-pointer usage. Test verifies: ; - base pointer register (r30) is saved/defined/restored. +; - frame pointer register (r31) is saved/defined/restored. ; - stack frame is allocated with correct alignment. -; - Address of %AlignedBuffer is calculated based off offset from the stack +; - Address of %AlignedBuffer is calculated based off offset from the frame ; pointer. define float @caller(float %f) { @@ -19,23 +20,29 @@ define float @caller(float %f) { declare void @callee(ptr) ; 32BIT-LABEL: .caller: +; 32BIT: stw 31, -12(1) ; 32BIT: stw 30, -16(1) ; 32BIT: mr 30, 1 ; 32BIT: clrlwi 0, 1, 27 ; 32BIT: subfic 0, 0, -224 ; 32BIT: stwux 1, 1, 0 -; 32BIT: addi 3, 1, 64 +; 32BIT: mr 31, 1 +; 32BIT: addi 3, 31, 64 ; 32BIT: bl .callee ; 32BIT: mr 1, 30 +; 32BIT: lwz 31, -12(1) ; 32BIT: lwz 30, -16(1) ; 64BIT-LABEL: .caller: +; 64BIT: std 31, -16(1) ; 64BIT: std 30, -24(1) ; 64BIT: mr 30, 1 ; 64BIT: clrldi 0, 1, 59 ; 64BIT: subfic 0, 0, -288 ; 64BIT: stdux 1, 1, 0 -; 64BIT: addi 3, 1, 128 +; 64BIT: mr 31, 1 +; 64BIT: addi 3, 31, 128 ; 64BIT: bl .callee ; 64BIT: mr 1, 30 +; 64BIT: ld 31, -16(1) ; 64BIT: ld 30, -24(1) diff --git a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll index 8955835f41ea6c..318b6d2fc6aa39 100644 --- a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll +++ b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll @@ -2297,510 +2297,546 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-LABEL: aligned: ; BE-P10: # %bb.0: # %entry ; BE-P10-NEXT: mflr r0 +; BE-P10-NEXT: std r31, -8(r1) ; BE-P10-NEXT: std r30, -16(r1) ; BE-P10-NEXT: lis r12, -1 ; BE-P10-NEXT: mr r30, r1 ; BE-P10-NEXT: std r0, 16(r1) -; BE-P10-NEXT: hashst r0, -24(r1) +; BE-P10-NEXT: hashst r0, -32(r1) ; BE-P10-NEXT: clrldi r0, r1, 49 ; BE-P10-NEXT: subc r0, r12, r0 ; BE-P10-NEXT: stdux r1, r1, r0 -; BE-P10-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P10-NEXT: mr r31, r3 +; BE-P10-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P10-NEXT: mr r29, r3 ; BE-P10-NEXT: lwz r3, 4(r3) ; BE-P10-NEXT: lis r4, 0 -; BE-P10-NEXT: addi r5, r1, 32764 -; BE-P10-NEXT: ori r4, r4, 65508 -; BE-P10-NEXT: stwx r3, r1, r4 -; BE-P10-NEXT: lwz r3, 12(r31) +; BE-P10-NEXT: mr r31, r1 +; BE-P10-NEXT: ori r4, r4, 65500 +; BE-P10-NEXT: stwx r3, r31, r4 +; BE-P10-NEXT: lwz r3, 12(r29) ; BE-P10-NEXT: lis r4, 0 ; BE-P10-NEXT: ori r4, r4, 32768 -; BE-P10-NEXT: stwx r3, r1, r4 -; BE-P10-NEXT: lwz r3, 20(r31) +; BE-P10-NEXT: stwx r3, r31, r4 +; BE-P10-NEXT: lwz r3, 20(r29) ; BE-P10-NEXT: lis r4, 0 -; BE-P10-NEXT: ori r4, r4, 65508 -; BE-P10-NEXT: add r4, r1, r4 -; BE-P10-NEXT: stw r3, 32764(r1) +; BE-P10-NEXT: ori r4, r4, 65500 +; BE-P10-NEXT: stw r3, 32764(r31) ; BE-P10-NEXT: lis r3, 0 ; BE-P10-NEXT: ori r3, r3, 32768 -; BE-P10-NEXT: add r3, r1, r3 +; BE-P10-NEXT: add r3, r31, r3 +; BE-P10-NEXT: add r4, r31, r4 +; BE-P10-NEXT: addi r5, r31, 32764 ; BE-P10-NEXT: bl .callee3[PR] ; BE-P10-NEXT: nop -; BE-P10-NEXT: lwz r4, 16(r31) -; BE-P10-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P10-NEXT: lwz r4, 16(r29) +; BE-P10-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P10-NEXT: add r3, r4, r3 ; BE-P10-NEXT: clrldi r3, r3, 32 ; BE-P10-NEXT: mr r1, r30 ; BE-P10-NEXT: ld r0, 16(r1) -; BE-P10-NEXT: ld r30, -16(r1) +; BE-P10-NEXT: ld r31, -8(r1) ; BE-P10-NEXT: mtlr r0 -; BE-P10-NEXT: hashchk r0, -24(r1) +; BE-P10-NEXT: ld r30, -16(r1) +; BE-P10-NEXT: hashchk r0, -32(r1) ; BE-P10-NEXT: blr ; ; BE-P9-LABEL: aligned: ; BE-P9: # %bb.0: # %entry ; BE-P9-NEXT: mflr r0 -; BE-P9-NEXT: std r30, -16(r1) +; BE-P9-NEXT: std r31, -8(r1) ; BE-P9-NEXT: lis r12, -1 +; BE-P9-NEXT: std r30, -16(r1) ; BE-P9-NEXT: mr r30, r1 ; BE-P9-NEXT: std r0, 16(r1) -; BE-P9-NEXT: hashst r0, -24(r1) +; BE-P9-NEXT: hashst r0, -32(r1) ; BE-P9-NEXT: clrldi r0, r1, 49 ; BE-P9-NEXT: subc r0, r12, r0 ; BE-P9-NEXT: stdux r1, r1, r0 -; BE-P9-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P9-NEXT: mr r31, r3 +; BE-P9-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P9-NEXT: mr r29, r3 ; BE-P9-NEXT: lwz r3, 4(r3) ; BE-P9-NEXT: lis r4, 0 -; BE-P9-NEXT: addi r5, r1, 32764 -; BE-P9-NEXT: ori r4, r4, 65508 -; BE-P9-NEXT: stwx r3, r1, r4 -; BE-P9-NEXT: lwz r3, 12(r31) +; BE-P9-NEXT: mr r31, r1 +; BE-P9-NEXT: ori r4, r4, 65500 +; BE-P9-NEXT: addi r5, r31, 32764 +; BE-P9-NEXT: stwx r3, r31, r4 +; BE-P9-NEXT: lwz r3, 12(r29) ; BE-P9-NEXT: lis r4, 0 ; BE-P9-NEXT: ori r4, r4, 32768 -; BE-P9-NEXT: stwx r3, r1, r4 -; BE-P9-NEXT: lwz r3, 20(r31) +; BE-P9-NEXT: stwx r3, r31, r4 +; BE-P9-NEXT: lwz r3, 20(r29) ; BE-P9-NEXT: lis r4, 0 -; BE-P9-NEXT: ori r4, r4, 65508 -; BE-P9-NEXT: stw r3, 32764(r1) +; BE-P9-NEXT: ori r4, r4, 65500 +; BE-P9-NEXT: stw r3, 32764(r31) ; BE-P9-NEXT: lis r3, 0 -; BE-P9-NEXT: add r4, r1, r4 +; BE-P9-NEXT: add r4, r31, r4 ; BE-P9-NEXT: ori r3, r3, 32768 -; BE-P9-NEXT: add r3, r1, r3 +; BE-P9-NEXT: add r3, r31, r3 ; BE-P9-NEXT: bl .callee3[PR] ; BE-P9-NEXT: nop -; BE-P9-NEXT: lwz r4, 16(r31) -; BE-P9-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P9-NEXT: lwz r4, 16(r29) +; BE-P9-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P9-NEXT: add r3, r4, r3 ; BE-P9-NEXT: clrldi r3, r3, 32 ; BE-P9-NEXT: mr r1, r30 ; BE-P9-NEXT: ld r0, 16(r1) +; BE-P9-NEXT: ld r31, -8(r1) ; BE-P9-NEXT: ld r30, -16(r1) ; BE-P9-NEXT: mtlr r0 -; BE-P9-NEXT: hashchk r0, -24(r1) +; BE-P9-NEXT: hashchk r0, -32(r1) ; BE-P9-NEXT: blr ; ; BE-P8-LABEL: aligned: ; BE-P8: # %bb.0: # %entry ; BE-P8-NEXT: mflr r0 +; BE-P8-NEXT: std r31, -8(r1) ; BE-P8-NEXT: std r30, -16(r1) ; BE-P8-NEXT: lis r12, -1 ; BE-P8-NEXT: mr r30, r1 ; BE-P8-NEXT: std r0, 16(r1) -; BE-P8-NEXT: hashst r0, -24(r1) +; BE-P8-NEXT: hashst r0, -32(r1) ; BE-P8-NEXT: clrldi r0, r1, 49 ; BE-P8-NEXT: subc r0, r12, r0 ; BE-P8-NEXT: stdux r1, r1, r0 ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P8-NEXT: mr r31, r3 +; BE-P8-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P8-NEXT: mr r29, r3 ; BE-P8-NEXT: lwz r3, 4(r3) -; BE-P8-NEXT: addi r5, r1, 32764 -; BE-P8-NEXT: ori r4, r4, 65508 -; BE-P8-NEXT: stwx r3, r1, r4 +; BE-P8-NEXT: mr r31, r1 +; BE-P8-NEXT: ori r4, r4, 65500 +; BE-P8-NEXT: addi r5, r31, 32764 +; BE-P8-NEXT: stwx r3, r31, r4 ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: lwz r3, 12(r31) +; BE-P8-NEXT: lwz r3, 12(r29) ; BE-P8-NEXT: ori r4, r4, 32768 -; BE-P8-NEXT: stwx r3, r1, r4 -; BE-P8-NEXT: lwz r3, 20(r31) +; BE-P8-NEXT: stwx r3, r31, r4 +; BE-P8-NEXT: lwz r3, 20(r29) ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: ori r4, r4, 65508 -; BE-P8-NEXT: stw r3, 32764(r1) +; BE-P8-NEXT: ori r4, r4, 65500 +; BE-P8-NEXT: stw r3, 32764(r31) ; BE-P8-NEXT: lis r3, 0 -; BE-P8-NEXT: add r4, r1, r4 +; BE-P8-NEXT: add r4, r31, r4 ; BE-P8-NEXT: ori r3, r3, 32768 -; BE-P8-NEXT: add r3, r1, r3 +; BE-P8-NEXT: add r3, r31, r3 ; BE-P8-NEXT: bl .callee3[PR] ; BE-P8-NEXT: nop -; BE-P8-NEXT: lwz r4, 16(r31) -; BE-P8-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P8-NEXT: lwz r4, 16(r29) +; BE-P8-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P8-NEXT: add r3, r4, r3 ; BE-P8-NEXT: clrldi r3, r3, 32 ; BE-P8-NEXT: mr r1, r30 ; BE-P8-NEXT: ld r0, 16(r1) +; BE-P8-NEXT: ld r31, -8(r1) ; BE-P8-NEXT: ld r30, -16(r1) -; BE-P8-NEXT: hashchk r0, -24(r1) +; BE-P8-NEXT: hashchk r0, -32(r1) ; BE-P8-NEXT: mtlr r0 ; BE-P8-NEXT: blr ; ; BE-32BIT-P10-LABEL: aligned: ; BE-32BIT-P10: # %bb.0: # %entry ; BE-32BIT-P10-NEXT: mflr r0 +; BE-32BIT-P10-NEXT: stw r31, -4(r1) ; BE-32BIT-P10-NEXT: stw r30, -8(r1) ; BE-32BIT-P10-NEXT: lis r12, -1 ; BE-32BIT-P10-NEXT: mr r30, r1 ; BE-32BIT-P10-NEXT: stw r0, 8(r1) -; BE-32BIT-P10-NEXT: hashst r0, -16(r1) +; BE-32BIT-P10-NEXT: hashst r0, -24(r1) ; BE-32BIT-P10-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-NEXT: stwux r1, r1, r0 -; BE-32BIT-P10-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P10-NEXT: mr r31, r3 +; BE-32BIT-P10-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P10-NEXT: mr r29, r3 ; BE-32BIT-P10-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-NEXT: lis r4, 0 -; BE-32BIT-P10-NEXT: addi r5, r1, 32764 -; BE-32BIT-P10-NEXT: ori r4, r4, 65516 -; BE-32BIT-P10-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-NEXT: lwz r3, 12(r31) +; BE-32BIT-P10-NEXT: mr r31, r1 +; BE-32BIT-P10-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-NEXT: lwz r3, 12(r29) ; BE-32BIT-P10-NEXT: lis r4, 0 ; BE-32BIT-P10-NEXT: ori r4, r4, 32768 -; BE-32BIT-P10-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-NEXT: lwz r3, 20(r31) +; BE-32BIT-P10-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-NEXT: lwz r3, 20(r29) ; BE-32BIT-P10-NEXT: lis r4, 0 -; BE-32BIT-P10-NEXT: ori r4, r4, 65516 -; BE-32BIT-P10-NEXT: add r4, r1, r4 -; BE-32BIT-P10-NEXT: stw r3, 32764(r1) +; BE-32BIT-P10-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-NEXT: stw r3, 32764(r31) ; BE-32BIT-P10-NEXT: lis r3, 0 ; BE-32BIT-P10-NEXT: ori r3, r3, 32768 -; BE-32BIT-P10-NEXT: add r3, r1, r3 +; BE-32BIT-P10-NEXT: add r3, r31, r3 +; BE-32BIT-P10-NEXT: add r4, r31, r4 +; BE-32BIT-P10-NEXT: addi r5, r31, 32764 ; BE-32BIT-P10-NEXT: bl .callee3[PR] ; BE-32BIT-P10-NEXT: nop -; BE-32BIT-P10-NEXT: lwz r4, 16(r31) -; BE-32BIT-P10-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P10-NEXT: lwz r4, 16(r29) +; BE-32BIT-P10-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P10-NEXT: add r3, r4, r3 ; BE-32BIT-P10-NEXT: mr r1, r30 ; BE-32BIT-P10-NEXT: lwz r0, 8(r1) -; BE-32BIT-P10-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-NEXT: lwz r31, -4(r1) ; BE-32BIT-P10-NEXT: mtlr r0 -; BE-32BIT-P10-NEXT: hashchk r0, -16(r1) +; BE-32BIT-P10-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-NEXT: hashchk r0, -24(r1) ; BE-32BIT-P10-NEXT: blr ; ; BE-32BIT-P9-LABEL: aligned: ; BE-32BIT-P9: # %bb.0: # %entry ; BE-32BIT-P9-NEXT: mflr r0 -; BE-32BIT-P9-NEXT: stw r30, -8(r1) +; BE-32BIT-P9-NEXT: stw r31, -4(r1) ; BE-32BIT-P9-NEXT: lis r12, -1 +; BE-32BIT-P9-NEXT: stw r30, -8(r1) ; BE-32BIT-P9-NEXT: mr r30, r1 ; BE-32BIT-P9-NEXT: stw r0, 8(r1) -; BE-32BIT-P9-NEXT: hashst r0, -16(r1) +; BE-32BIT-P9-NEXT: hashst r0, -24(r1) ; BE-32BIT-P9-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-NEXT: stwux r1, r1, r0 -; BE-32BIT-P9-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P9-NEXT: mr r31, r3 +; BE-32BIT-P9-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P9-NEXT: mr r29, r3 ; BE-32BIT-P9-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-NEXT: lis r4, 0 -; BE-32BIT-P9-NEXT: addi r5, r1, 32764 -; BE-32BIT-P9-NEXT: ori r4, r4, 65516 -; BE-32BIT-P9-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-NEXT: lwz r3, 12(r31) +; BE-32BIT-P9-NEXT: mr r31, r1 +; BE-32BIT-P9-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-NEXT: addi r5, r31, 32764 +; BE-32BIT-P9-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-NEXT: lwz r3, 12(r29) ; BE-32BIT-P9-NEXT: lis r4, 0 ; BE-32BIT-P9-NEXT: ori r4, r4, 32768 -; BE-32BIT-P9-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-NEXT: lwz r3, 20(r31) +; BE-32BIT-P9-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-NEXT: lwz r3, 20(r29) ; BE-32BIT-P9-NEXT: lis r4, 0 -; BE-32BIT-P9-NEXT: ori r4, r4, 65516 -; BE-32BIT-P9-NEXT: stw r3, 32764(r1) +; BE-32BIT-P9-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-NEXT: stw r3, 32764(r31) ; BE-32BIT-P9-NEXT: lis r3, 0 -; BE-32BIT-P9-NEXT: add r4, r1, r4 +; BE-32BIT-P9-NEXT: add r4, r31, r4 ; BE-32BIT-P9-NEXT: ori r3, r3, 32768 -; BE-32BIT-P9-NEXT: add r3, r1, r3 +; BE-32BIT-P9-NEXT: add r3, r31, r3 ; BE-32BIT-P9-NEXT: bl .callee3[PR] ; BE-32BIT-P9-NEXT: nop -; BE-32BIT-P9-NEXT: lwz r4, 16(r31) -; BE-32BIT-P9-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P9-NEXT: lwz r4, 16(r29) +; BE-32BIT-P9-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P9-NEXT: add r3, r4, r3 ; BE-32BIT-P9-NEXT: mr r1, r30 ; BE-32BIT-P9-NEXT: lwz r0, 8(r1) +; BE-32BIT-P9-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-NEXT: mtlr r0 -; BE-32BIT-P9-NEXT: hashchk r0, -16(r1) +; BE-32BIT-P9-NEXT: hashchk r0, -24(r1) ; BE-32BIT-P9-NEXT: blr ; ; BE-32BIT-P8-LABEL: aligned: ; BE-32BIT-P8: # %bb.0: # %entry ; BE-32BIT-P8-NEXT: mflr r0 +; BE-32BIT-P8-NEXT: stw r31, -4(r1) ; BE-32BIT-P8-NEXT: stw r30, -8(r1) ; BE-32BIT-P8-NEXT: lis r12, -1 ; BE-32BIT-P8-NEXT: mr r30, r1 ; BE-32BIT-P8-NEXT: stw r0, 8(r1) -; BE-32BIT-P8-NEXT: hashst r0, -16(r1) +; BE-32BIT-P8-NEXT: hashst r0, -24(r1) ; BE-32BIT-P8-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P8-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P8-NEXT: mr r31, r3 +; BE-32BIT-P8-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P8-NEXT: mr r29, r3 ; BE-32BIT-P8-NEXT: lwz r3, 4(r3) -; BE-32BIT-P8-NEXT: addi r5, r1, 32764 -; BE-32BIT-P8-NEXT: ori r4, r4, 65516 -; BE-32BIT-P8-NEXT: stwx r3, r1, r4 +; BE-32BIT-P8-NEXT: mr r31, r1 +; BE-32BIT-P8-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-NEXT: addi r5, r31, 32764 +; BE-32BIT-P8-NEXT: stwx r3, r31, r4 ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: lwz r3, 12(r31) +; BE-32BIT-P8-NEXT: lwz r3, 12(r29) ; BE-32BIT-P8-NEXT: ori r4, r4, 32768 -; BE-32BIT-P8-NEXT: stwx r3, r1, r4 -; BE-32BIT-P8-NEXT: lwz r3, 20(r31) +; BE-32BIT-P8-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-NEXT: lwz r3, 20(r29) ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: ori r4, r4, 65516 -; BE-32BIT-P8-NEXT: stw r3, 32764(r1) +; BE-32BIT-P8-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-NEXT: stw r3, 32764(r31) ; BE-32BIT-P8-NEXT: lis r3, 0 -; BE-32BIT-P8-NEXT: add r4, r1, r4 +; BE-32BIT-P8-NEXT: add r4, r31, r4 ; BE-32BIT-P8-NEXT: ori r3, r3, 32768 -; BE-32BIT-P8-NEXT: add r3, r1, r3 +; BE-32BIT-P8-NEXT: add r3, r31, r3 ; BE-32BIT-P8-NEXT: bl .callee3[PR] ; BE-32BIT-P8-NEXT: nop -; BE-32BIT-P8-NEXT: lwz r4, 16(r31) -; BE-32BIT-P8-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P8-NEXT: lwz r4, 16(r29) +; BE-32BIT-P8-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P8-NEXT: add r3, r4, r3 ; BE-32BIT-P8-NEXT: mr r1, r30 ; BE-32BIT-P8-NEXT: lwz r0, 8(r1) +; BE-32BIT-P8-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-NEXT: lwz r30, -8(r1) -; BE-32BIT-P8-NEXT: hashchk r0, -16(r1) +; BE-32BIT-P8-NEXT: hashchk r0, -24(r1) ; BE-32BIT-P8-NEXT: mtlr r0 ; BE-32BIT-P8-NEXT: blr ; ; BE-P10-PRIV-LABEL: aligned: ; BE-P10-PRIV: # %bb.0: # %entry ; BE-P10-PRIV-NEXT: mflr r0 +; BE-P10-PRIV-NEXT: std r31, -8(r1) ; BE-P10-PRIV-NEXT: std r30, -16(r1) ; BE-P10-PRIV-NEXT: lis r12, -1 ; BE-P10-PRIV-NEXT: mr r30, r1 ; BE-P10-PRIV-NEXT: std r0, 16(r1) -; BE-P10-PRIV-NEXT: hashstp r0, -24(r1) +; BE-P10-PRIV-NEXT: hashstp r0, -32(r1) ; BE-P10-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-P10-PRIV-NEXT: stdux r1, r1, r0 -; BE-P10-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P10-PRIV-NEXT: mr r31, r3 +; BE-P10-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P10-PRIV-NEXT: mr r29, r3 ; BE-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-P10-PRIV-NEXT: lis r4, 0 -; BE-P10-PRIV-NEXT: addi r5, r1, 32764 -; BE-P10-PRIV-NEXT: ori r4, r4, 65508 -; BE-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-P10-PRIV-NEXT: lwz r3, 12(r31) +; BE-P10-PRIV-NEXT: mr r31, r1 +; BE-P10-PRIV-NEXT: ori r4, r4, 65500 +; BE-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-P10-PRIV-NEXT: lwz r3, 12(r29) ; BE-P10-PRIV-NEXT: lis r4, 0 ; BE-P10-PRIV-NEXT: ori r4, r4, 32768 -; BE-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-P10-PRIV-NEXT: lwz r3, 20(r31) +; BE-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-P10-PRIV-NEXT: lwz r3, 20(r29) ; BE-P10-PRIV-NEXT: lis r4, 0 -; BE-P10-PRIV-NEXT: ori r4, r4, 65508 -; BE-P10-PRIV-NEXT: add r4, r1, r4 -; BE-P10-PRIV-NEXT: stw r3, 32764(r1) +; BE-P10-PRIV-NEXT: ori r4, r4, 65500 +; BE-P10-PRIV-NEXT: stw r3, 32764(r31) ; BE-P10-PRIV-NEXT: lis r3, 0 ; BE-P10-PRIV-NEXT: ori r3, r3, 32768 -; BE-P10-PRIV-NEXT: add r3, r1, r3 +; BE-P10-PRIV-NEXT: add r3, r31, r3 +; BE-P10-PRIV-NEXT: add r4, r31, r4 +; BE-P10-PRIV-NEXT: addi r5, r31, 32764 ; BE-P10-PRIV-NEXT: bl .callee3[PR] ; BE-P10-PRIV-NEXT: nop -; BE-P10-PRIV-NEXT: lwz r4, 16(r31) -; BE-P10-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P10-PRIV-NEXT: lwz r4, 16(r29) +; BE-P10-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P10-PRIV-NEXT: add r3, r4, r3 ; BE-P10-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P10-PRIV-NEXT: mr r1, r30 ; BE-P10-PRIV-NEXT: ld r0, 16(r1) -; BE-P10-PRIV-NEXT: ld r30, -16(r1) +; BE-P10-PRIV-NEXT: ld r31, -8(r1) ; BE-P10-PRIV-NEXT: mtlr r0 -; BE-P10-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-P10-PRIV-NEXT: ld r30, -16(r1) +; BE-P10-PRIV-NEXT: hashchkp r0, -32(r1) ; BE-P10-PRIV-NEXT: blr ; ; BE-P9-PRIV-LABEL: aligned: ; BE-P9-PRIV: # %bb.0: # %entry ; BE-P9-PRIV-NEXT: mflr r0 -; BE-P9-PRIV-NEXT: std r30, -16(r1) +; BE-P9-PRIV-NEXT: std r31, -8(r1) ; BE-P9-PRIV-NEXT: lis r12, -1 +; BE-P9-PRIV-NEXT: std r30, -16(r1) ; BE-P9-PRIV-NEXT: mr r30, r1 ; BE-P9-PRIV-NEXT: std r0, 16(r1) -; BE-P9-PRIV-NEXT: hashstp r0, -24(r1) +; BE-P9-PRIV-NEXT: hashstp r0, -32(r1) ; BE-P9-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-P9-PRIV-NEXT: stdux r1, r1, r0 -; BE-P9-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P9-PRIV-NEXT: mr r31, r3 +; BE-P9-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P9-PRIV-NEXT: mr r29, r3 ; BE-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-P9-PRIV-NEXT: lis r4, 0 -; BE-P9-PRIV-NEXT: addi r5, r1, 32764 -; BE-P9-PRIV-NEXT: ori r4, r4, 65508 -; BE-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-P9-PRIV-NEXT: lwz r3, 12(r31) +; BE-P9-PRIV-NEXT: mr r31, r1 +; BE-P9-PRIV-NEXT: ori r4, r4, 65500 +; BE-P9-PRIV-NEXT: addi r5, r31, 32764 +; BE-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-P9-PRIV-NEXT: lwz r3, 12(r29) ; BE-P9-PRIV-NEXT: lis r4, 0 ; BE-P9-PRIV-NEXT: ori r4, r4, 32768 -; BE-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-P9-PRIV-NEXT: lwz r3, 20(r31) +; BE-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-P9-PRIV-NEXT: lwz r3, 20(r29) ; BE-P9-PRIV-NEXT: lis r4, 0 -; BE-P9-PRIV-NEXT: ori r4, r4, 65508 -; BE-P9-PRIV-NEXT: stw r3, 32764(r1) +; BE-P9-PRIV-NEXT: ori r4, r4, 65500 +; BE-P9-PRIV-NEXT: stw r3, 32764(r31) ; BE-P9-PRIV-NEXT: lis r3, 0 -; BE-P9-PRIV-NEXT: add r4, r1, r4 +; BE-P9-PRIV-NEXT: add r4, r31, r4 ; BE-P9-PRIV-NEXT: ori r3, r3, 32768 -; BE-P9-PRIV-NEXT: add r3, r1, r3 +; BE-P9-PRIV-NEXT: add r3, r31, r3 ; BE-P9-PRIV-NEXT: bl .callee3[PR] ; BE-P9-PRIV-NEXT: nop -; BE-P9-PRIV-NEXT: lwz r4, 16(r31) -; BE-P9-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P9-PRIV-NEXT: lwz r4, 16(r29) +; BE-P9-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P9-PRIV-NEXT: add r3, r4, r3 ; BE-P9-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P9-PRIV-NEXT: mr r1, r30 ; BE-P9-PRIV-NEXT: ld r0, 16(r1) +; BE-P9-PRIV-NEXT: ld r31, -8(r1) ; BE-P9-PRIV-NEXT: ld r30, -16(r1) ; BE-P9-PRIV-NEXT: mtlr r0 -; BE-P9-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-P9-PRIV-NEXT: hashchkp r0, -32(r1) ; BE-P9-PRIV-NEXT: blr ; ; BE-P8-PRIV-LABEL: aligned: ; BE-P8-PRIV: # %bb.0: # %entry ; BE-P8-PRIV-NEXT: mflr r0 +; BE-P8-PRIV-NEXT: std r31, -8(r1) ; BE-P8-PRIV-NEXT: std r30, -16(r1) ; BE-P8-PRIV-NEXT: lis r12, -1 ; BE-P8-PRIV-NEXT: mr r30, r1 ; BE-P8-PRIV-NEXT: std r0, 16(r1) -; BE-P8-PRIV-NEXT: hashstp r0, -24(r1) +; BE-P8-PRIV-NEXT: hashstp r0, -32(r1) ; BE-P8-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-P8-PRIV-NEXT: stdux r1, r1, r0 ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill -; BE-P8-PRIV-NEXT: mr r31, r3 +; BE-P8-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill +; BE-P8-PRIV-NEXT: mr r29, r3 ; BE-P8-PRIV-NEXT: lwz r3, 4(r3) -; BE-P8-PRIV-NEXT: addi r5, r1, 32764 -; BE-P8-PRIV-NEXT: ori r4, r4, 65508 -; BE-P8-PRIV-NEXT: stwx r3, r1, r4 +; BE-P8-PRIV-NEXT: mr r31, r1 +; BE-P8-PRIV-NEXT: ori r4, r4, 65500 +; BE-P8-PRIV-NEXT: addi r5, r31, 32764 +; BE-P8-PRIV-NEXT: stwx r3, r31, r4 ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: lwz r3, 12(r31) +; BE-P8-PRIV-NEXT: lwz r3, 12(r29) ; BE-P8-PRIV-NEXT: ori r4, r4, 32768 -; BE-P8-PRIV-NEXT: stwx r3, r1, r4 -; BE-P8-PRIV-NEXT: lwz r3, 20(r31) +; BE-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-P8-PRIV-NEXT: lwz r3, 20(r29) ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: ori r4, r4, 65508 -; BE-P8-PRIV-NEXT: stw r3, 32764(r1) +; BE-P8-PRIV-NEXT: ori r4, r4, 65500 +; BE-P8-PRIV-NEXT: stw r3, 32764(r31) ; BE-P8-PRIV-NEXT: lis r3, 0 -; BE-P8-PRIV-NEXT: add r4, r1, r4 +; BE-P8-PRIV-NEXT: add r4, r31, r4 ; BE-P8-PRIV-NEXT: ori r3, r3, 32768 -; BE-P8-PRIV-NEXT: add r3, r1, r3 +; BE-P8-PRIV-NEXT: add r3, r31, r3 ; BE-P8-PRIV-NEXT: bl .callee3[PR] ; BE-P8-PRIV-NEXT: nop -; BE-P8-PRIV-NEXT: lwz r4, 16(r31) -; BE-P8-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload +; BE-P8-PRIV-NEXT: lwz r4, 16(r29) +; BE-P8-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload ; BE-P8-PRIV-NEXT: add r3, r4, r3 ; BE-P8-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P8-PRIV-NEXT: mr r1, r30 ; BE-P8-PRIV-NEXT: ld r0, 16(r1) +; BE-P8-PRIV-NEXT: ld r31, -8(r1) ; BE-P8-PRIV-NEXT: ld r30, -16(r1) -; BE-P8-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-P8-PRIV-NEXT: hashchkp r0, -32(r1) ; BE-P8-PRIV-NEXT: mtlr r0 ; BE-P8-PRIV-NEXT: blr ; ; BE-32BIT-P10-PRIV-LABEL: aligned: ; BE-32BIT-P10-PRIV: # %bb.0: # %entry ; BE-32BIT-P10-PRIV-NEXT: mflr r0 +; BE-32BIT-P10-PRIV-NEXT: stw r31, -4(r1) ; BE-32BIT-P10-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P10-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P10-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P10-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P10-PRIV-NEXT: hashstp r0, -16(r1) +; BE-32BIT-P10-PRIV-NEXT: hashstp r0, -24(r1) ; BE-32BIT-P10-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-PRIV-NEXT: stwux r1, r1, r0 -; BE-32BIT-P10-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P10-PRIV-NEXT: mr r31, r3 +; BE-32BIT-P10-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P10-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P10-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-PRIV-NEXT: lwz r3, 12(r31) +; BE-32BIT-P10-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-PRIV-NEXT: lwz r3, 20(r31) +; BE-32BIT-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P10-PRIV-NEXT: add r4, r1, r4 -; BE-32BIT-P10-PRIV-NEXT: stw r3, 32764(r1) +; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-PRIV-NEXT: stw r3, 32764(r31) ; BE-32BIT-P10-PRIV-NEXT: lis r3, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P10-PRIV-NEXT: add r3, r1, r3 +; BE-32BIT-P10-PRIV-NEXT: add r3, r31, r3 +; BE-32BIT-P10-PRIV-NEXT: add r4, r31, r4 +; BE-32BIT-P10-PRIV-NEXT: addi r5, r31, 32764 ; BE-32BIT-P10-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P10-PRIV-NEXT: nop -; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r31) -; BE-32BIT-P10-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r29) +; BE-32BIT-P10-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P10-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P10-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P10-PRIV-NEXT: lwz r0, 8(r1) -; BE-32BIT-P10-PRIV-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P10-PRIV-NEXT: mtlr r0 -; BE-32BIT-P10-PRIV-NEXT: hashchkp r0, -16(r1) +; BE-32BIT-P10-PRIV-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-32BIT-P10-PRIV-NEXT: blr ; ; BE-32BIT-P9-PRIV-LABEL: aligned: ; BE-32BIT-P9-PRIV: # %bb.0: # %entry ; BE-32BIT-P9-PRIV-NEXT: mflr r0 -; BE-32BIT-P9-PRIV-NEXT: stw r30, -8(r1) +; BE-32BIT-P9-PRIV-NEXT: stw r31, -4(r1) ; BE-32BIT-P9-PRIV-NEXT: lis r12, -1 +; BE-32BIT-P9-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P9-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P9-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P9-PRIV-NEXT: hashstp r0, -16(r1) +; BE-32BIT-P9-PRIV-NEXT: hashstp r0, -24(r1) ; BE-32BIT-P9-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-PRIV-NEXT: stwux r1, r1, r0 -; BE-32BIT-P9-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P9-PRIV-NEXT: mr r31, r3 +; BE-32BIT-P9-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P9-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P9-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-PRIV-NEXT: lwz r3, 12(r31) +; BE-32BIT-P9-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-PRIV-NEXT: addi r5, r31, 32764 +; BE-32BIT-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-PRIV-NEXT: lwz r3, 20(r31) +; BE-32BIT-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P9-PRIV-NEXT: stw r3, 32764(r1) +; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-PRIV-NEXT: stw r3, 32764(r31) ; BE-32BIT-P9-PRIV-NEXT: lis r3, 0 -; BE-32BIT-P9-PRIV-NEXT: add r4, r1, r4 +; BE-32BIT-P9-PRIV-NEXT: add r4, r31, r4 ; BE-32BIT-P9-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P9-PRIV-NEXT: add r3, r1, r3 +; BE-32BIT-P9-PRIV-NEXT: add r3, r31, r3 ; BE-32BIT-P9-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P9-PRIV-NEXT: nop -; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r31) -; BE-32BIT-P9-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r29) +; BE-32BIT-P9-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P9-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P9-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P9-PRIV-NEXT: lwz r0, 8(r1) +; BE-32BIT-P9-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-PRIV-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-PRIV-NEXT: mtlr r0 -; BE-32BIT-P9-PRIV-NEXT: hashchkp r0, -16(r1) +; BE-32BIT-P9-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-32BIT-P9-PRIV-NEXT: blr ; ; BE-32BIT-P8-PRIV-LABEL: aligned: ; BE-32BIT-P8-PRIV: # %bb.0: # %entry ; BE-32BIT-P8-PRIV-NEXT: mflr r0 +; BE-32BIT-P8-PRIV-NEXT: stw r31, -4(r1) ; BE-32BIT-P8-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P8-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P8-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P8-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P8-PRIV-NEXT: hashstp r0, -16(r1) +; BE-32BIT-P8-PRIV-NEXT: hashstp r0, -24(r1) ; BE-32BIT-P8-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-PRIV-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill -; BE-32BIT-P8-PRIV-NEXT: mr r31, r3 +; BE-32BIT-P8-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill +; BE-32BIT-P8-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 4(r3) -; BE-32BIT-P8-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 +; BE-32BIT-P8-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-PRIV-NEXT: addi r5, r31, 32764 +; BE-32BIT-P8-PRIV-NEXT: stwx r3, r31, r4 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: lwz r3, 12(r31) +; BE-32BIT-P8-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P8-PRIV-NEXT: lwz r3, 20(r31) +; BE-32BIT-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65516 -; BE-32BIT-P8-PRIV-NEXT: stw r3, 32764(r1) +; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-PRIV-NEXT: stw r3, 32764(r31) ; BE-32BIT-P8-PRIV-NEXT: lis r3, 0 -; BE-32BIT-P8-PRIV-NEXT: add r4, r1, r4 +; BE-32BIT-P8-PRIV-NEXT: add r4, r31, r4 ; BE-32BIT-P8-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P8-PRIV-NEXT: add r3, r1, r3 +; BE-32BIT-P8-PRIV-NEXT: add r3, r31, r3 ; BE-32BIT-P8-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P8-PRIV-NEXT: nop -; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r31) -; BE-32BIT-P8-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload +; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r29) +; BE-32BIT-P8-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload ; BE-32BIT-P8-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P8-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P8-PRIV-NEXT: lwz r0, 8(r1) +; BE-32BIT-P8-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-PRIV-NEXT: lwz r30, -8(r1) -; BE-32BIT-P8-PRIV-NEXT: hashchkp r0, -16(r1) +; BE-32BIT-P8-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-32BIT-P8-PRIV-NEXT: mtlr r0 ; BE-32BIT-P8-PRIV-NEXT: blr entry: From 069da92030f3137fe108af3c4eaf7c6ab584e980 Mon Sep 17 00:00:00 2001 From: Zaara Syeda Date: Mon, 29 Jul 2024 16:30:37 -0400 Subject: [PATCH 2/5] Address review comments --- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 27 ++- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 2 +- llvm/test/CodeGen/PowerPC/aix-base-pointer.ll | 6 +- .../PowerPC/ppc64-rop-protection-aix.ll | 156 ++++++++---------- 4 files changed, 88 insertions(+), 103 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 11332dbd8147cf..9dfeefc40324e7 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -376,8 +376,6 @@ bool PPCFrameLowering::needsFP(const MachineFunction &MF) const { if (MF.getFunction().hasFnAttribute(Attribute::Naked)) return false; - if (Subtarget.isAIXABI() && Subtarget.getRegisterInfo()->hasBasePointer(MF)) - return true; return MF.getTarget().Options.DisableFramePointerElim(MF) || MFI.hasVarSizedObjects() || MFI.hasStackMap() || MFI.hasPatchPoint() || @@ -699,7 +697,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, int64_t LROffset = getReturnSaveOffset(); int64_t FPOffset = 0; - if (HasFP) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { MachineFrameInfo &MFI = MF.getFrameInfo(); int FPIndex = FI->getFramePointerSaveIndex(); assert(FPIndex && "No Frame Pointer Save Slot!"); @@ -824,7 +822,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, BuildMoveFromCR(); if (HasRedZone) { - if (HasFP) + if (HasFP || (HasBP && Subtarget.isAIXABI())) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FPOffset) @@ -1010,7 +1008,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // R0 cannot be used as a base register, but it can be used as an // index in a store-indexed. int LastOffset = 0; - if (HasFP) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { // R0 += (FPOffset-LastOffset). // Need addic, since addi treats R0 as 0. BuildMI(MBB, MBBI, dl, TII.get(PPC::ADDIC), ScratchReg) @@ -1055,7 +1053,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // Now that the stack frame has been allocated, save all the necessary // registers using ScratchReg as the base address. - if (HasFP) + if (HasFP || (HasBP && Subtarget.isAIXABI())) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FPOffset) @@ -1080,7 +1078,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // field of STWU). To be here we have to be compiling for PPC32. // Since the SPReg has been decreased by FrameSize, add it back to each // offset. - if (HasFP) + if (HasFP || (HasBP && Subtarget.isAIXABI())) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FrameSize + FPOffset) @@ -1126,7 +1124,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); - if (HasFP) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { // Describe where FP was saved, at a fixed offset from CFA. unsigned Reg = MRI->getDwarfRegNum(FPReg, true); CFIIndex = MF.addFrameInst( @@ -1609,7 +1607,7 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF, SingleScratchReg = ScratchReg == TempReg; - if (HasFP) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { int FPIndex = FI->getFramePointerSaveIndex(); assert(FPIndex && "No Frame Pointer Save Slot!"); FPOffset = MFI.getObjectOffset(FPIndex); @@ -1805,7 +1803,7 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF, .addReg(RBReg); } - if (HasFP) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { // If there is red zone, restore FP directly, since SP has already been // restored. Otherwise, restore the value of FP into ScratchReg. if (HasRedZone || RBReg == SPReg) @@ -1997,7 +1995,8 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, MachineFrameInfo &MFI = MF.getFrameInfo(); // If the frame pointer save index hasn't been defined yet. - if (!FPSI && needsFP(MF)) { + if (!FPSI && (needsFP(MF) + || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI()))) { // Find out what the fix offset of the frame pointer save area. int FPOffset = getFramePointerSaveOffset(); // Allocate the frame index for frame pointer save area. @@ -2026,7 +2025,7 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, // some inline asm which explicitly clobbers it, when we otherwise have a // frame pointer and are using r31's spill slot for the prologue/epilogue // code. Same goes for the base pointer and the PIC base register. - if (needsFP(MF)) + if (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI())) SavedRegs.reset(isPPC64 ? PPC::X31 : PPC::R31); if (RegInfo->hasBasePointer(MF)) SavedRegs.reset(RegInfo->getBaseRegister(MF)); @@ -2169,9 +2168,10 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF, LowerBound -= (31 - TRI->getEncodingValue(MinFPR) + 1) * 8; } + const PPCRegisterInfo *RegInfo = Subtarget.getRegisterInfo(); // Check whether the frame pointer register is allocated. If so, make sure it // is spilled to the correct offset. - if (needsFP(MF)) { + if (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI())) { int FI = PFI->getFramePointerSaveIndex(); assert(FI && "No Frame Pointer Save Slot!"); MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI)); @@ -2188,7 +2188,6 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF, HasGPSaveArea = true; } - const PPCRegisterInfo *RegInfo = Subtarget.getRegisterInfo(); if (RegInfo->hasBasePointer(MF)) { int FI = PFI->getBasePointerSaveIndex(); assert(FI && "No Base Pointer Save Slot!"); diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp index 9e8da59615dfb3..96a5683320a8d3 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -402,7 +402,7 @@ BitVector PPCRegisterInfo::getReservedRegs(const MachineFunction &MF) const { if (TM.isPPC64()) markSuperRegs(Reserved, PPC::R13); - if (TFI->needsFP(MF)) + if (TFI->needsFP(MF) || (hasBasePointer(MF) && Subtarget.isAIXABI())) markSuperRegs(Reserved, PPC::R31); bool IsPositionIndependent = TM.isPositionIndependent(); diff --git a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll index cc4f0ee92c5dce..18894e6c97c435 100644 --- a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll +++ b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll @@ -26,8 +26,7 @@ declare void @callee(ptr) ; 32BIT: clrlwi 0, 1, 27 ; 32BIT: subfic 0, 0, -224 ; 32BIT: stwux 1, 1, 0 -; 32BIT: mr 31, 1 -; 32BIT: addi 3, 31, 64 +; 32BIT: addi 3, 1, 64 ; 32BIT: bl .callee ; 32BIT: mr 1, 30 ; 32BIT: lwz 31, -12(1) @@ -40,8 +39,7 @@ declare void @callee(ptr) ; 64BIT: clrldi 0, 1, 59 ; 64BIT: subfic 0, 0, -288 ; 64BIT: stdux 1, 1, 0 -; 64BIT: mr 31, 1 -; 64BIT: addi 3, 31, 128 +; 64BIT: addi 3, 1, 128 ; 64BIT: bl .callee ; 64BIT: mr 1, 30 ; 64BIT: ld 31, -16(1) diff --git a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll index 318b6d2fc6aa39..bb12e529bbbdb3 100644 --- a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll +++ b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll @@ -2310,22 +2310,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: mr r29, r3 ; BE-P10-NEXT: lwz r3, 4(r3) ; BE-P10-NEXT: lis r4, 0 -; BE-P10-NEXT: mr r31, r1 +; BE-P10-NEXT: addi r5, r1, 32764 ; BE-P10-NEXT: ori r4, r4, 65500 -; BE-P10-NEXT: stwx r3, r31, r4 +; BE-P10-NEXT: stwx r3, r1, r4 ; BE-P10-NEXT: lwz r3, 12(r29) ; BE-P10-NEXT: lis r4, 0 ; BE-P10-NEXT: ori r4, r4, 32768 -; BE-P10-NEXT: stwx r3, r31, r4 +; BE-P10-NEXT: stwx r3, r1, r4 ; BE-P10-NEXT: lwz r3, 20(r29) ; BE-P10-NEXT: lis r4, 0 ; BE-P10-NEXT: ori r4, r4, 65500 -; BE-P10-NEXT: stw r3, 32764(r31) +; BE-P10-NEXT: add r4, r1, r4 +; BE-P10-NEXT: stw r3, 32764(r1) ; BE-P10-NEXT: lis r3, 0 ; BE-P10-NEXT: ori r3, r3, 32768 -; BE-P10-NEXT: add r3, r31, r3 -; BE-P10-NEXT: add r4, r31, r4 -; BE-P10-NEXT: addi r5, r31, 32764 +; BE-P10-NEXT: add r3, r1, r3 ; BE-P10-NEXT: bl .callee3[PR] ; BE-P10-NEXT: nop ; BE-P10-NEXT: lwz r4, 16(r29) @@ -2356,22 +2355,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-NEXT: mr r29, r3 ; BE-P9-NEXT: lwz r3, 4(r3) ; BE-P9-NEXT: lis r4, 0 -; BE-P9-NEXT: mr r31, r1 +; BE-P9-NEXT: addi r5, r1, 32764 ; BE-P9-NEXT: ori r4, r4, 65500 -; BE-P9-NEXT: addi r5, r31, 32764 -; BE-P9-NEXT: stwx r3, r31, r4 +; BE-P9-NEXT: stwx r3, r1, r4 ; BE-P9-NEXT: lwz r3, 12(r29) ; BE-P9-NEXT: lis r4, 0 ; BE-P9-NEXT: ori r4, r4, 32768 -; BE-P9-NEXT: stwx r3, r31, r4 +; BE-P9-NEXT: stwx r3, r1, r4 ; BE-P9-NEXT: lwz r3, 20(r29) ; BE-P9-NEXT: lis r4, 0 ; BE-P9-NEXT: ori r4, r4, 65500 -; BE-P9-NEXT: stw r3, 32764(r31) +; BE-P9-NEXT: stw r3, 32764(r1) ; BE-P9-NEXT: lis r3, 0 -; BE-P9-NEXT: add r4, r31, r4 +; BE-P9-NEXT: add r4, r1, r4 ; BE-P9-NEXT: ori r3, r3, 32768 -; BE-P9-NEXT: add r3, r31, r3 +; BE-P9-NEXT: add r3, r1, r3 ; BE-P9-NEXT: bl .callee3[PR] ; BE-P9-NEXT: nop ; BE-P9-NEXT: lwz r4, 16(r29) @@ -2402,22 +2400,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-NEXT: std r29, -24(r30) # 8-byte Folded Spill ; BE-P8-NEXT: mr r29, r3 ; BE-P8-NEXT: lwz r3, 4(r3) -; BE-P8-NEXT: mr r31, r1 +; BE-P8-NEXT: addi r5, r1, 32764 ; BE-P8-NEXT: ori r4, r4, 65500 -; BE-P8-NEXT: addi r5, r31, 32764 -; BE-P8-NEXT: stwx r3, r31, r4 +; BE-P8-NEXT: stwx r3, r1, r4 ; BE-P8-NEXT: lis r4, 0 ; BE-P8-NEXT: lwz r3, 12(r29) ; BE-P8-NEXT: ori r4, r4, 32768 -; BE-P8-NEXT: stwx r3, r31, r4 +; BE-P8-NEXT: stwx r3, r1, r4 ; BE-P8-NEXT: lwz r3, 20(r29) ; BE-P8-NEXT: lis r4, 0 ; BE-P8-NEXT: ori r4, r4, 65500 -; BE-P8-NEXT: stw r3, 32764(r31) +; BE-P8-NEXT: stw r3, 32764(r1) ; BE-P8-NEXT: lis r3, 0 -; BE-P8-NEXT: add r4, r31, r4 +; BE-P8-NEXT: add r4, r1, r4 ; BE-P8-NEXT: ori r3, r3, 32768 -; BE-P8-NEXT: add r3, r31, r3 +; BE-P8-NEXT: add r3, r1, r3 ; BE-P8-NEXT: bl .callee3[PR] ; BE-P8-NEXT: nop ; BE-P8-NEXT: lwz r4, 16(r29) @@ -2448,22 +2445,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-NEXT: mr r29, r3 ; BE-32BIT-P10-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-NEXT: lis r4, 0 -; BE-32BIT-P10-NEXT: mr r31, r1 +; BE-32BIT-P10-NEXT: addi r5, r1, 32764 ; BE-32BIT-P10-NEXT: ori r4, r4, 65508 -; BE-32BIT-P10-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-NEXT: stwx r3, r1, r4 ; BE-32BIT-P10-NEXT: lwz r3, 12(r29) ; BE-32BIT-P10-NEXT: lis r4, 0 ; BE-32BIT-P10-NEXT: ori r4, r4, 32768 -; BE-32BIT-P10-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-NEXT: stwx r3, r1, r4 ; BE-32BIT-P10-NEXT: lwz r3, 20(r29) ; BE-32BIT-P10-NEXT: lis r4, 0 ; BE-32BIT-P10-NEXT: ori r4, r4, 65508 -; BE-32BIT-P10-NEXT: stw r3, 32764(r31) +; BE-32BIT-P10-NEXT: add r4, r1, r4 +; BE-32BIT-P10-NEXT: stw r3, 32764(r1) ; BE-32BIT-P10-NEXT: lis r3, 0 ; BE-32BIT-P10-NEXT: ori r3, r3, 32768 -; BE-32BIT-P10-NEXT: add r3, r31, r3 -; BE-32BIT-P10-NEXT: add r4, r31, r4 -; BE-32BIT-P10-NEXT: addi r5, r31, 32764 +; BE-32BIT-P10-NEXT: add r3, r1, r3 ; BE-32BIT-P10-NEXT: bl .callee3[PR] ; BE-32BIT-P10-NEXT: nop ; BE-32BIT-P10-NEXT: lwz r4, 16(r29) @@ -2493,22 +2489,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-NEXT: mr r29, r3 ; BE-32BIT-P9-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-NEXT: lis r4, 0 -; BE-32BIT-P9-NEXT: mr r31, r1 +; BE-32BIT-P9-NEXT: addi r5, r1, 32764 ; BE-32BIT-P9-NEXT: ori r4, r4, 65508 -; BE-32BIT-P9-NEXT: addi r5, r31, 32764 -; BE-32BIT-P9-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-NEXT: stwx r3, r1, r4 ; BE-32BIT-P9-NEXT: lwz r3, 12(r29) ; BE-32BIT-P9-NEXT: lis r4, 0 ; BE-32BIT-P9-NEXT: ori r4, r4, 32768 -; BE-32BIT-P9-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-NEXT: stwx r3, r1, r4 ; BE-32BIT-P9-NEXT: lwz r3, 20(r29) ; BE-32BIT-P9-NEXT: lis r4, 0 ; BE-32BIT-P9-NEXT: ori r4, r4, 65508 -; BE-32BIT-P9-NEXT: stw r3, 32764(r31) +; BE-32BIT-P9-NEXT: stw r3, 32764(r1) ; BE-32BIT-P9-NEXT: lis r3, 0 -; BE-32BIT-P9-NEXT: add r4, r31, r4 +; BE-32BIT-P9-NEXT: add r4, r1, r4 ; BE-32BIT-P9-NEXT: ori r3, r3, 32768 -; BE-32BIT-P9-NEXT: add r3, r31, r3 +; BE-32BIT-P9-NEXT: add r3, r1, r3 ; BE-32BIT-P9-NEXT: bl .callee3[PR] ; BE-32BIT-P9-NEXT: nop ; BE-32BIT-P9-NEXT: lwz r4, 16(r29) @@ -2538,22 +2533,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-NEXT: stw r29, -12(r30) # 4-byte Folded Spill ; BE-32BIT-P8-NEXT: mr r29, r3 ; BE-32BIT-P8-NEXT: lwz r3, 4(r3) -; BE-32BIT-P8-NEXT: mr r31, r1 +; BE-32BIT-P8-NEXT: addi r5, r1, 32764 ; BE-32BIT-P8-NEXT: ori r4, r4, 65508 -; BE-32BIT-P8-NEXT: addi r5, r31, 32764 -; BE-32BIT-P8-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-NEXT: lis r4, 0 ; BE-32BIT-P8-NEXT: lwz r3, 12(r29) ; BE-32BIT-P8-NEXT: ori r4, r4, 32768 -; BE-32BIT-P8-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-NEXT: lwz r3, 20(r29) ; BE-32BIT-P8-NEXT: lis r4, 0 ; BE-32BIT-P8-NEXT: ori r4, r4, 65508 -; BE-32BIT-P8-NEXT: stw r3, 32764(r31) +; BE-32BIT-P8-NEXT: stw r3, 32764(r1) ; BE-32BIT-P8-NEXT: lis r3, 0 -; BE-32BIT-P8-NEXT: add r4, r31, r4 +; BE-32BIT-P8-NEXT: add r4, r1, r4 ; BE-32BIT-P8-NEXT: ori r3, r3, 32768 -; BE-32BIT-P8-NEXT: add r3, r31, r3 +; BE-32BIT-P8-NEXT: add r3, r1, r3 ; BE-32BIT-P8-NEXT: bl .callee3[PR] ; BE-32BIT-P8-NEXT: nop ; BE-32BIT-P8-NEXT: lwz r4, 16(r29) @@ -2583,22 +2577,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: mr r29, r3 ; BE-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-P10-PRIV-NEXT: lis r4, 0 -; BE-P10-PRIV-NEXT: mr r31, r1 +; BE-P10-PRIV-NEXT: addi r5, r1, 32764 ; BE-P10-PRIV-NEXT: ori r4, r4, 65500 -; BE-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-P10-PRIV-NEXT: stwx r3, r1, r4 ; BE-P10-PRIV-NEXT: lwz r3, 12(r29) ; BE-P10-PRIV-NEXT: lis r4, 0 ; BE-P10-PRIV-NEXT: ori r4, r4, 32768 -; BE-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-P10-PRIV-NEXT: stwx r3, r1, r4 ; BE-P10-PRIV-NEXT: lwz r3, 20(r29) ; BE-P10-PRIV-NEXT: lis r4, 0 ; BE-P10-PRIV-NEXT: ori r4, r4, 65500 -; BE-P10-PRIV-NEXT: stw r3, 32764(r31) +; BE-P10-PRIV-NEXT: add r4, r1, r4 +; BE-P10-PRIV-NEXT: stw r3, 32764(r1) ; BE-P10-PRIV-NEXT: lis r3, 0 ; BE-P10-PRIV-NEXT: ori r3, r3, 32768 -; BE-P10-PRIV-NEXT: add r3, r31, r3 -; BE-P10-PRIV-NEXT: add r4, r31, r4 -; BE-P10-PRIV-NEXT: addi r5, r31, 32764 +; BE-P10-PRIV-NEXT: add r3, r1, r3 ; BE-P10-PRIV-NEXT: bl .callee3[PR] ; BE-P10-PRIV-NEXT: nop ; BE-P10-PRIV-NEXT: lwz r4, 16(r29) @@ -2629,22 +2622,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-PRIV-NEXT: mr r29, r3 ; BE-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-P9-PRIV-NEXT: lis r4, 0 -; BE-P9-PRIV-NEXT: mr r31, r1 +; BE-P9-PRIV-NEXT: addi r5, r1, 32764 ; BE-P9-PRIV-NEXT: ori r4, r4, 65500 -; BE-P9-PRIV-NEXT: addi r5, r31, 32764 -; BE-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-P9-PRIV-NEXT: stwx r3, r1, r4 ; BE-P9-PRIV-NEXT: lwz r3, 12(r29) ; BE-P9-PRIV-NEXT: lis r4, 0 ; BE-P9-PRIV-NEXT: ori r4, r4, 32768 -; BE-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-P9-PRIV-NEXT: stwx r3, r1, r4 ; BE-P9-PRIV-NEXT: lwz r3, 20(r29) ; BE-P9-PRIV-NEXT: lis r4, 0 ; BE-P9-PRIV-NEXT: ori r4, r4, 65500 -; BE-P9-PRIV-NEXT: stw r3, 32764(r31) +; BE-P9-PRIV-NEXT: stw r3, 32764(r1) ; BE-P9-PRIV-NEXT: lis r3, 0 -; BE-P9-PRIV-NEXT: add r4, r31, r4 +; BE-P9-PRIV-NEXT: add r4, r1, r4 ; BE-P9-PRIV-NEXT: ori r3, r3, 32768 -; BE-P9-PRIV-NEXT: add r3, r31, r3 +; BE-P9-PRIV-NEXT: add r3, r1, r3 ; BE-P9-PRIV-NEXT: bl .callee3[PR] ; BE-P9-PRIV-NEXT: nop ; BE-P9-PRIV-NEXT: lwz r4, 16(r29) @@ -2675,22 +2667,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill ; BE-P8-PRIV-NEXT: mr r29, r3 ; BE-P8-PRIV-NEXT: lwz r3, 4(r3) -; BE-P8-PRIV-NEXT: mr r31, r1 +; BE-P8-PRIV-NEXT: addi r5, r1, 32764 ; BE-P8-PRIV-NEXT: ori r4, r4, 65500 -; BE-P8-PRIV-NEXT: addi r5, r31, 32764 -; BE-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-P8-PRIV-NEXT: lis r4, 0 ; BE-P8-PRIV-NEXT: lwz r3, 12(r29) ; BE-P8-PRIV-NEXT: ori r4, r4, 32768 -; BE-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-P8-PRIV-NEXT: lwz r3, 20(r29) ; BE-P8-PRIV-NEXT: lis r4, 0 ; BE-P8-PRIV-NEXT: ori r4, r4, 65500 -; BE-P8-PRIV-NEXT: stw r3, 32764(r31) +; BE-P8-PRIV-NEXT: stw r3, 32764(r1) ; BE-P8-PRIV-NEXT: lis r3, 0 -; BE-P8-PRIV-NEXT: add r4, r31, r4 +; BE-P8-PRIV-NEXT: add r4, r1, r4 ; BE-P8-PRIV-NEXT: ori r3, r3, 32768 -; BE-P8-PRIV-NEXT: add r3, r31, r3 +; BE-P8-PRIV-NEXT: add r3, r1, r3 ; BE-P8-PRIV-NEXT: bl .callee3[PR] ; BE-P8-PRIV-NEXT: nop ; BE-P8-PRIV-NEXT: lwz r4, 16(r29) @@ -2721,22 +2712,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P10-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P10-PRIV-NEXT: addi r5, r1, 32764 ; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P10-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P10-PRIV-NEXT: stw r3, 32764(r31) +; BE-32BIT-P10-PRIV-NEXT: add r4, r1, r4 +; BE-32BIT-P10-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P10-PRIV-NEXT: lis r3, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P10-PRIV-NEXT: add r3, r31, r3 -; BE-32BIT-P10-PRIV-NEXT: add r4, r31, r4 -; BE-32BIT-P10-PRIV-NEXT: addi r5, r31, 32764 +; BE-32BIT-P10-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P10-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P10-PRIV-NEXT: nop ; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r29) @@ -2766,22 +2756,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P9-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P9-PRIV-NEXT: addi r5, r1, 32764 ; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P9-PRIV-NEXT: addi r5, r31, 32764 -; BE-32BIT-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P9-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P9-PRIV-NEXT: stw r3, 32764(r31) +; BE-32BIT-P9-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P9-PRIV-NEXT: lis r3, 0 -; BE-32BIT-P9-PRIV-NEXT: add r4, r31, r4 +; BE-32BIT-P9-PRIV-NEXT: add r4, r1, r4 ; BE-32BIT-P9-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P9-PRIV-NEXT: add r3, r31, r3 +; BE-32BIT-P9-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P9-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P9-PRIV-NEXT: nop ; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r29) @@ -2811,22 +2800,21 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill ; BE-32BIT-P8-PRIV-NEXT: mr r29, r3 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 4(r3) -; BE-32BIT-P8-PRIV-NEXT: mr r31, r1 +; BE-32BIT-P8-PRIV-NEXT: addi r5, r1, 32764 ; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P8-PRIV-NEXT: addi r5, r31, 32764 -; BE-32BIT-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 12(r29) ; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 32768 -; BE-32BIT-P8-PRIV-NEXT: stwx r3, r31, r4 +; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 20(r29) ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 -; BE-32BIT-P8-PRIV-NEXT: stw r3, 32764(r31) +; BE-32BIT-P8-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P8-PRIV-NEXT: lis r3, 0 -; BE-32BIT-P8-PRIV-NEXT: add r4, r31, r4 +; BE-32BIT-P8-PRIV-NEXT: add r4, r1, r4 ; BE-32BIT-P8-PRIV-NEXT: ori r3, r3, 32768 -; BE-32BIT-P8-PRIV-NEXT: add r3, r31, r3 +; BE-32BIT-P8-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P8-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P8-PRIV-NEXT: nop ; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r29) From f379cf4e91856811141eb0c848ace54385d6c0de Mon Sep 17 00:00:00 2001 From: Zaara Syeda Date: Mon, 29 Jul 2024 16:44:01 -0400 Subject: [PATCH 3/5] Address review comments, fix formatting --- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 7 +- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 2 +- .../PowerPC/ppc64-rop-protection-aix.ll | 216 ++++++++---------- 3 files changed, 100 insertions(+), 125 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 9dfeefc40324e7..630e21796f312b 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -376,7 +376,6 @@ bool PPCFrameLowering::needsFP(const MachineFunction &MF) const { if (MF.getFunction().hasFnAttribute(Attribute::Naked)) return false; - return MF.getTarget().Options.DisableFramePointerElim(MF) || MFI.hasVarSizedObjects() || MFI.hasStackMap() || MFI.hasPatchPoint() || MF.exposesReturnsTwice() || @@ -1008,7 +1007,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // R0 cannot be used as a base register, but it can be used as an // index in a store-indexed. int LastOffset = 0; - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP || (HasBP && Subtarget.isAIXABI())) { // R0 += (FPOffset-LastOffset). // Need addic, since addi treats R0 as 0. BuildMI(MBB, MBBI, dl, TII.get(PPC::ADDIC), ScratchReg) @@ -1995,8 +1994,8 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, MachineFrameInfo &MFI = MF.getFrameInfo(); // If the frame pointer save index hasn't been defined yet. - if (!FPSI && (needsFP(MF) - || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI()))) { + if (!FPSI && + (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI()))) { // Find out what the fix offset of the frame pointer save area. int FPOffset = getFramePointerSaveOffset(); // Allocate the frame index for frame pointer save area. diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp index 96a5683320a8d3..9e8da59615dfb3 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -402,7 +402,7 @@ BitVector PPCRegisterInfo::getReservedRegs(const MachineFunction &MF) const { if (TM.isPPC64()) markSuperRegs(Reserved, PPC::R13); - if (TFI->needsFP(MF) || (hasBasePointer(MF) && Subtarget.isAIXABI())) + if (TFI->needsFP(MF)) markSuperRegs(Reserved, PPC::R31); bool IsPositionIndependent = TM.isPositionIndependent(); diff --git a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll index bb12e529bbbdb3..c4517714526c74 100644 --- a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll +++ b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll @@ -2302,24 +2302,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: lis r12, -1 ; BE-P10-NEXT: mr r30, r1 ; BE-P10-NEXT: std r0, 16(r1) -; BE-P10-NEXT: hashst r0, -32(r1) +; BE-P10-NEXT: hashst r0, -24(r1) ; BE-P10-NEXT: clrldi r0, r1, 49 ; BE-P10-NEXT: subc r0, r12, r0 ; BE-P10-NEXT: stdux r1, r1, r0 -; BE-P10-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P10-NEXT: mr r29, r3 +; BE-P10-NEXT: mr r31, r3 ; BE-P10-NEXT: lwz r3, 4(r3) ; BE-P10-NEXT: lis r4, 0 ; BE-P10-NEXT: addi r5, r1, 32764 -; BE-P10-NEXT: ori r4, r4, 65500 +; BE-P10-NEXT: ori r4, r4, 65508 ; BE-P10-NEXT: stwx r3, r1, r4 -; BE-P10-NEXT: lwz r3, 12(r29) +; BE-P10-NEXT: lwz r3, 12(r31) ; BE-P10-NEXT: lis r4, 0 ; BE-P10-NEXT: ori r4, r4, 32768 ; BE-P10-NEXT: stwx r3, r1, r4 -; BE-P10-NEXT: lwz r3, 20(r29) +; BE-P10-NEXT: lwz r3, 20(r31) ; BE-P10-NEXT: lis r4, 0 -; BE-P10-NEXT: ori r4, r4, 65500 +; BE-P10-NEXT: ori r4, r4, 65508 ; BE-P10-NEXT: add r4, r1, r4 ; BE-P10-NEXT: stw r3, 32764(r1) ; BE-P10-NEXT: lis r3, 0 @@ -2327,8 +2326,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: add r3, r1, r3 ; BE-P10-NEXT: bl .callee3[PR] ; BE-P10-NEXT: nop -; BE-P10-NEXT: lwz r4, 16(r29) -; BE-P10-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P10-NEXT: lwz r4, 16(r31) ; BE-P10-NEXT: add r3, r4, r3 ; BE-P10-NEXT: clrldi r3, r3, 32 ; BE-P10-NEXT: mr r1, r30 @@ -2336,7 +2334,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: ld r31, -8(r1) ; BE-P10-NEXT: mtlr r0 ; BE-P10-NEXT: ld r30, -16(r1) -; BE-P10-NEXT: hashchk r0, -32(r1) +; BE-P10-NEXT: hashchk r0, -24(r1) ; BE-P10-NEXT: blr ; ; BE-P9-LABEL: aligned: @@ -2347,24 +2345,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-NEXT: std r30, -16(r1) ; BE-P9-NEXT: mr r30, r1 ; BE-P9-NEXT: std r0, 16(r1) -; BE-P9-NEXT: hashst r0, -32(r1) +; BE-P9-NEXT: hashst r0, -24(r1) ; BE-P9-NEXT: clrldi r0, r1, 49 ; BE-P9-NEXT: subc r0, r12, r0 ; BE-P9-NEXT: stdux r1, r1, r0 -; BE-P9-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P9-NEXT: mr r29, r3 +; BE-P9-NEXT: mr r31, r3 ; BE-P9-NEXT: lwz r3, 4(r3) ; BE-P9-NEXT: lis r4, 0 ; BE-P9-NEXT: addi r5, r1, 32764 -; BE-P9-NEXT: ori r4, r4, 65500 +; BE-P9-NEXT: ori r4, r4, 65508 ; BE-P9-NEXT: stwx r3, r1, r4 -; BE-P9-NEXT: lwz r3, 12(r29) +; BE-P9-NEXT: lwz r3, 12(r31) ; BE-P9-NEXT: lis r4, 0 ; BE-P9-NEXT: ori r4, r4, 32768 ; BE-P9-NEXT: stwx r3, r1, r4 -; BE-P9-NEXT: lwz r3, 20(r29) +; BE-P9-NEXT: lwz r3, 20(r31) ; BE-P9-NEXT: lis r4, 0 -; BE-P9-NEXT: ori r4, r4, 65500 +; BE-P9-NEXT: ori r4, r4, 65508 ; BE-P9-NEXT: stw r3, 32764(r1) ; BE-P9-NEXT: lis r3, 0 ; BE-P9-NEXT: add r4, r1, r4 @@ -2372,8 +2369,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-NEXT: add r3, r1, r3 ; BE-P9-NEXT: bl .callee3[PR] ; BE-P9-NEXT: nop -; BE-P9-NEXT: lwz r4, 16(r29) -; BE-P9-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P9-NEXT: lwz r4, 16(r31) ; BE-P9-NEXT: add r3, r4, r3 ; BE-P9-NEXT: clrldi r3, r3, 32 ; BE-P9-NEXT: mr r1, r30 @@ -2381,7 +2377,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-NEXT: ld r31, -8(r1) ; BE-P9-NEXT: ld r30, -16(r1) ; BE-P9-NEXT: mtlr r0 -; BE-P9-NEXT: hashchk r0, -32(r1) +; BE-P9-NEXT: hashchk r0, -24(r1) ; BE-P9-NEXT: blr ; ; BE-P8-LABEL: aligned: @@ -2392,24 +2388,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-NEXT: lis r12, -1 ; BE-P8-NEXT: mr r30, r1 ; BE-P8-NEXT: std r0, 16(r1) -; BE-P8-NEXT: hashst r0, -32(r1) +; BE-P8-NEXT: hashst r0, -24(r1) ; BE-P8-NEXT: clrldi r0, r1, 49 ; BE-P8-NEXT: subc r0, r12, r0 ; BE-P8-NEXT: stdux r1, r1, r0 ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P8-NEXT: mr r29, r3 +; BE-P8-NEXT: mr r31, r3 ; BE-P8-NEXT: lwz r3, 4(r3) ; BE-P8-NEXT: addi r5, r1, 32764 -; BE-P8-NEXT: ori r4, r4, 65500 +; BE-P8-NEXT: ori r4, r4, 65508 ; BE-P8-NEXT: stwx r3, r1, r4 ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: lwz r3, 12(r29) +; BE-P8-NEXT: lwz r3, 12(r31) ; BE-P8-NEXT: ori r4, r4, 32768 ; BE-P8-NEXT: stwx r3, r1, r4 -; BE-P8-NEXT: lwz r3, 20(r29) +; BE-P8-NEXT: lwz r3, 20(r31) ; BE-P8-NEXT: lis r4, 0 -; BE-P8-NEXT: ori r4, r4, 65500 +; BE-P8-NEXT: ori r4, r4, 65508 ; BE-P8-NEXT: stw r3, 32764(r1) ; BE-P8-NEXT: lis r3, 0 ; BE-P8-NEXT: add r4, r1, r4 @@ -2417,15 +2412,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-NEXT: add r3, r1, r3 ; BE-P8-NEXT: bl .callee3[PR] ; BE-P8-NEXT: nop -; BE-P8-NEXT: lwz r4, 16(r29) -; BE-P8-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P8-NEXT: lwz r4, 16(r31) ; BE-P8-NEXT: add r3, r4, r3 ; BE-P8-NEXT: clrldi r3, r3, 32 ; BE-P8-NEXT: mr r1, r30 ; BE-P8-NEXT: ld r0, 16(r1) ; BE-P8-NEXT: ld r31, -8(r1) ; BE-P8-NEXT: ld r30, -16(r1) -; BE-P8-NEXT: hashchk r0, -32(r1) +; BE-P8-NEXT: hashchk r0, -24(r1) ; BE-P8-NEXT: mtlr r0 ; BE-P8-NEXT: blr ; @@ -2437,24 +2431,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-NEXT: lis r12, -1 ; BE-32BIT-P10-NEXT: mr r30, r1 ; BE-32BIT-P10-NEXT: stw r0, 8(r1) -; BE-32BIT-P10-NEXT: hashst r0, -24(r1) +; BE-32BIT-P10-NEXT: hashst r0, -16(r1) ; BE-32BIT-P10-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-NEXT: stwux r1, r1, r0 -; BE-32BIT-P10-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P10-NEXT: mr r29, r3 +; BE-32BIT-P10-NEXT: mr r31, r3 ; BE-32BIT-P10-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-NEXT: lis r4, 0 ; BE-32BIT-P10-NEXT: addi r5, r1, 32764 -; BE-32BIT-P10-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-NEXT: ori r4, r4, 65516 ; BE-32BIT-P10-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-NEXT: lwz r3, 12(r29) +; BE-32BIT-P10-NEXT: lwz r3, 12(r31) ; BE-32BIT-P10-NEXT: lis r4, 0 ; BE-32BIT-P10-NEXT: ori r4, r4, 32768 ; BE-32BIT-P10-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-NEXT: lwz r3, 20(r29) +; BE-32BIT-P10-NEXT: lwz r3, 20(r31) ; BE-32BIT-P10-NEXT: lis r4, 0 -; BE-32BIT-P10-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-NEXT: ori r4, r4, 65516 ; BE-32BIT-P10-NEXT: add r4, r1, r4 ; BE-32BIT-P10-NEXT: stw r3, 32764(r1) ; BE-32BIT-P10-NEXT: lis r3, 0 @@ -2462,15 +2455,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-NEXT: add r3, r1, r3 ; BE-32BIT-P10-NEXT: bl .callee3[PR] ; BE-32BIT-P10-NEXT: nop -; BE-32BIT-P10-NEXT: lwz r4, 16(r29) -; BE-32BIT-P10-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P10-NEXT: lwz r4, 16(r31) ; BE-32BIT-P10-NEXT: add r3, r4, r3 ; BE-32BIT-P10-NEXT: mr r1, r30 ; BE-32BIT-P10-NEXT: lwz r0, 8(r1) ; BE-32BIT-P10-NEXT: lwz r31, -4(r1) ; BE-32BIT-P10-NEXT: mtlr r0 ; BE-32BIT-P10-NEXT: lwz r30, -8(r1) -; BE-32BIT-P10-NEXT: hashchk r0, -24(r1) +; BE-32BIT-P10-NEXT: hashchk r0, -16(r1) ; BE-32BIT-P10-NEXT: blr ; ; BE-32BIT-P9-LABEL: aligned: @@ -2481,24 +2473,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-NEXT: stw r30, -8(r1) ; BE-32BIT-P9-NEXT: mr r30, r1 ; BE-32BIT-P9-NEXT: stw r0, 8(r1) -; BE-32BIT-P9-NEXT: hashst r0, -24(r1) +; BE-32BIT-P9-NEXT: hashst r0, -16(r1) ; BE-32BIT-P9-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-NEXT: stwux r1, r1, r0 -; BE-32BIT-P9-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P9-NEXT: mr r29, r3 +; BE-32BIT-P9-NEXT: mr r31, r3 ; BE-32BIT-P9-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-NEXT: lis r4, 0 ; BE-32BIT-P9-NEXT: addi r5, r1, 32764 -; BE-32BIT-P9-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-NEXT: ori r4, r4, 65516 ; BE-32BIT-P9-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-NEXT: lwz r3, 12(r29) +; BE-32BIT-P9-NEXT: lwz r3, 12(r31) ; BE-32BIT-P9-NEXT: lis r4, 0 ; BE-32BIT-P9-NEXT: ori r4, r4, 32768 ; BE-32BIT-P9-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-NEXT: lwz r3, 20(r29) +; BE-32BIT-P9-NEXT: lwz r3, 20(r31) ; BE-32BIT-P9-NEXT: lis r4, 0 -; BE-32BIT-P9-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-NEXT: ori r4, r4, 65516 ; BE-32BIT-P9-NEXT: stw r3, 32764(r1) ; BE-32BIT-P9-NEXT: lis r3, 0 ; BE-32BIT-P9-NEXT: add r4, r1, r4 @@ -2506,15 +2497,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-NEXT: add r3, r1, r3 ; BE-32BIT-P9-NEXT: bl .callee3[PR] ; BE-32BIT-P9-NEXT: nop -; BE-32BIT-P9-NEXT: lwz r4, 16(r29) -; BE-32BIT-P9-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P9-NEXT: lwz r4, 16(r31) ; BE-32BIT-P9-NEXT: add r3, r4, r3 ; BE-32BIT-P9-NEXT: mr r1, r30 ; BE-32BIT-P9-NEXT: lwz r0, 8(r1) ; BE-32BIT-P9-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-NEXT: mtlr r0 -; BE-32BIT-P9-NEXT: hashchk r0, -24(r1) +; BE-32BIT-P9-NEXT: hashchk r0, -16(r1) ; BE-32BIT-P9-NEXT: blr ; ; BE-32BIT-P8-LABEL: aligned: @@ -2525,24 +2515,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-NEXT: lis r12, -1 ; BE-32BIT-P8-NEXT: mr r30, r1 ; BE-32BIT-P8-NEXT: stw r0, 8(r1) -; BE-32BIT-P8-NEXT: hashst r0, -24(r1) +; BE-32BIT-P8-NEXT: hashst r0, -16(r1) ; BE-32BIT-P8-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P8-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P8-NEXT: mr r29, r3 +; BE-32BIT-P8-NEXT: mr r31, r3 ; BE-32BIT-P8-NEXT: lwz r3, 4(r3) ; BE-32BIT-P8-NEXT: addi r5, r1, 32764 -; BE-32BIT-P8-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-NEXT: ori r4, r4, 65516 ; BE-32BIT-P8-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: lwz r3, 12(r29) +; BE-32BIT-P8-NEXT: lwz r3, 12(r31) ; BE-32BIT-P8-NEXT: ori r4, r4, 32768 ; BE-32BIT-P8-NEXT: stwx r3, r1, r4 -; BE-32BIT-P8-NEXT: lwz r3, 20(r29) +; BE-32BIT-P8-NEXT: lwz r3, 20(r31) ; BE-32BIT-P8-NEXT: lis r4, 0 -; BE-32BIT-P8-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-NEXT: ori r4, r4, 65516 ; BE-32BIT-P8-NEXT: stw r3, 32764(r1) ; BE-32BIT-P8-NEXT: lis r3, 0 ; BE-32BIT-P8-NEXT: add r4, r1, r4 @@ -2550,14 +2539,13 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-NEXT: add r3, r1, r3 ; BE-32BIT-P8-NEXT: bl .callee3[PR] ; BE-32BIT-P8-NEXT: nop -; BE-32BIT-P8-NEXT: lwz r4, 16(r29) -; BE-32BIT-P8-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P8-NEXT: lwz r4, 16(r31) ; BE-32BIT-P8-NEXT: add r3, r4, r3 ; BE-32BIT-P8-NEXT: mr r1, r30 ; BE-32BIT-P8-NEXT: lwz r0, 8(r1) ; BE-32BIT-P8-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-NEXT: lwz r30, -8(r1) -; BE-32BIT-P8-NEXT: hashchk r0, -24(r1) +; BE-32BIT-P8-NEXT: hashchk r0, -16(r1) ; BE-32BIT-P8-NEXT: mtlr r0 ; BE-32BIT-P8-NEXT: blr ; @@ -2569,24 +2557,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: lis r12, -1 ; BE-P10-PRIV-NEXT: mr r30, r1 ; BE-P10-PRIV-NEXT: std r0, 16(r1) -; BE-P10-PRIV-NEXT: hashstp r0, -32(r1) +; BE-P10-PRIV-NEXT: hashstp r0, -24(r1) ; BE-P10-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-P10-PRIV-NEXT: stdux r1, r1, r0 -; BE-P10-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P10-PRIV-NEXT: mr r29, r3 +; BE-P10-PRIV-NEXT: mr r31, r3 ; BE-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-P10-PRIV-NEXT: lis r4, 0 ; BE-P10-PRIV-NEXT: addi r5, r1, 32764 -; BE-P10-PRIV-NEXT: ori r4, r4, 65500 +; BE-P10-PRIV-NEXT: ori r4, r4, 65508 ; BE-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-P10-PRIV-NEXT: lwz r3, 12(r29) +; BE-P10-PRIV-NEXT: lwz r3, 12(r31) ; BE-P10-PRIV-NEXT: lis r4, 0 ; BE-P10-PRIV-NEXT: ori r4, r4, 32768 ; BE-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-P10-PRIV-NEXT: lwz r3, 20(r29) +; BE-P10-PRIV-NEXT: lwz r3, 20(r31) ; BE-P10-PRIV-NEXT: lis r4, 0 -; BE-P10-PRIV-NEXT: ori r4, r4, 65500 +; BE-P10-PRIV-NEXT: ori r4, r4, 65508 ; BE-P10-PRIV-NEXT: add r4, r1, r4 ; BE-P10-PRIV-NEXT: stw r3, 32764(r1) ; BE-P10-PRIV-NEXT: lis r3, 0 @@ -2594,8 +2581,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: add r3, r1, r3 ; BE-P10-PRIV-NEXT: bl .callee3[PR] ; BE-P10-PRIV-NEXT: nop -; BE-P10-PRIV-NEXT: lwz r4, 16(r29) -; BE-P10-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P10-PRIV-NEXT: lwz r4, 16(r31) ; BE-P10-PRIV-NEXT: add r3, r4, r3 ; BE-P10-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P10-PRIV-NEXT: mr r1, r30 @@ -2603,7 +2589,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: ld r31, -8(r1) ; BE-P10-PRIV-NEXT: mtlr r0 ; BE-P10-PRIV-NEXT: ld r30, -16(r1) -; BE-P10-PRIV-NEXT: hashchkp r0, -32(r1) +; BE-P10-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-P10-PRIV-NEXT: blr ; ; BE-P9-PRIV-LABEL: aligned: @@ -2614,24 +2600,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-PRIV-NEXT: std r30, -16(r1) ; BE-P9-PRIV-NEXT: mr r30, r1 ; BE-P9-PRIV-NEXT: std r0, 16(r1) -; BE-P9-PRIV-NEXT: hashstp r0, -32(r1) +; BE-P9-PRIV-NEXT: hashstp r0, -24(r1) ; BE-P9-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-P9-PRIV-NEXT: stdux r1, r1, r0 -; BE-P9-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P9-PRIV-NEXT: mr r29, r3 +; BE-P9-PRIV-NEXT: mr r31, r3 ; BE-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-P9-PRIV-NEXT: lis r4, 0 ; BE-P9-PRIV-NEXT: addi r5, r1, 32764 -; BE-P9-PRIV-NEXT: ori r4, r4, 65500 +; BE-P9-PRIV-NEXT: ori r4, r4, 65508 ; BE-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-P9-PRIV-NEXT: lwz r3, 12(r29) +; BE-P9-PRIV-NEXT: lwz r3, 12(r31) ; BE-P9-PRIV-NEXT: lis r4, 0 ; BE-P9-PRIV-NEXT: ori r4, r4, 32768 ; BE-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-P9-PRIV-NEXT: lwz r3, 20(r29) +; BE-P9-PRIV-NEXT: lwz r3, 20(r31) ; BE-P9-PRIV-NEXT: lis r4, 0 -; BE-P9-PRIV-NEXT: ori r4, r4, 65500 +; BE-P9-PRIV-NEXT: ori r4, r4, 65508 ; BE-P9-PRIV-NEXT: stw r3, 32764(r1) ; BE-P9-PRIV-NEXT: lis r3, 0 ; BE-P9-PRIV-NEXT: add r4, r1, r4 @@ -2639,8 +2624,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-PRIV-NEXT: add r3, r1, r3 ; BE-P9-PRIV-NEXT: bl .callee3[PR] ; BE-P9-PRIV-NEXT: nop -; BE-P9-PRIV-NEXT: lwz r4, 16(r29) -; BE-P9-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P9-PRIV-NEXT: lwz r4, 16(r31) ; BE-P9-PRIV-NEXT: add r3, r4, r3 ; BE-P9-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P9-PRIV-NEXT: mr r1, r30 @@ -2648,7 +2632,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-PRIV-NEXT: ld r31, -8(r1) ; BE-P9-PRIV-NEXT: ld r30, -16(r1) ; BE-P9-PRIV-NEXT: mtlr r0 -; BE-P9-PRIV-NEXT: hashchkp r0, -32(r1) +; BE-P9-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-P9-PRIV-NEXT: blr ; ; BE-P8-PRIV-LABEL: aligned: @@ -2659,24 +2643,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-NEXT: lis r12, -1 ; BE-P8-PRIV-NEXT: mr r30, r1 ; BE-P8-PRIV-NEXT: std r0, 16(r1) -; BE-P8-PRIV-NEXT: hashstp r0, -32(r1) +; BE-P8-PRIV-NEXT: hashstp r0, -24(r1) ; BE-P8-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-P8-PRIV-NEXT: stdux r1, r1, r0 ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: std r29, -24(r30) # 8-byte Folded Spill -; BE-P8-PRIV-NEXT: mr r29, r3 +; BE-P8-PRIV-NEXT: mr r31, r3 ; BE-P8-PRIV-NEXT: lwz r3, 4(r3) ; BE-P8-PRIV-NEXT: addi r5, r1, 32764 -; BE-P8-PRIV-NEXT: ori r4, r4, 65500 +; BE-P8-PRIV-NEXT: ori r4, r4, 65508 ; BE-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: lwz r3, 12(r29) +; BE-P8-PRIV-NEXT: lwz r3, 12(r31) ; BE-P8-PRIV-NEXT: ori r4, r4, 32768 ; BE-P8-PRIV-NEXT: stwx r3, r1, r4 -; BE-P8-PRIV-NEXT: lwz r3, 20(r29) +; BE-P8-PRIV-NEXT: lwz r3, 20(r31) ; BE-P8-PRIV-NEXT: lis r4, 0 -; BE-P8-PRIV-NEXT: ori r4, r4, 65500 +; BE-P8-PRIV-NEXT: ori r4, r4, 65508 ; BE-P8-PRIV-NEXT: stw r3, 32764(r1) ; BE-P8-PRIV-NEXT: lis r3, 0 ; BE-P8-PRIV-NEXT: add r4, r1, r4 @@ -2684,15 +2667,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-NEXT: add r3, r1, r3 ; BE-P8-PRIV-NEXT: bl .callee3[PR] ; BE-P8-PRIV-NEXT: nop -; BE-P8-PRIV-NEXT: lwz r4, 16(r29) -; BE-P8-PRIV-NEXT: ld r29, -24(r30) # 8-byte Folded Reload +; BE-P8-PRIV-NEXT: lwz r4, 16(r31) ; BE-P8-PRIV-NEXT: add r3, r4, r3 ; BE-P8-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P8-PRIV-NEXT: mr r1, r30 ; BE-P8-PRIV-NEXT: ld r0, 16(r1) ; BE-P8-PRIV-NEXT: ld r31, -8(r1) ; BE-P8-PRIV-NEXT: ld r30, -16(r1) -; BE-P8-PRIV-NEXT: hashchkp r0, -32(r1) +; BE-P8-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-P8-PRIV-NEXT: mtlr r0 ; BE-P8-PRIV-NEXT: blr ; @@ -2704,24 +2686,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P10-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P10-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P10-PRIV-NEXT: hashstp r0, -24(r1) +; BE-32BIT-P10-PRIV-NEXT: hashstp r0, -16(r1) ; BE-32BIT-P10-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-PRIV-NEXT: stwux r1, r1, r0 -; BE-32BIT-P10-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P10-PRIV-NEXT: mr r29, r3 +; BE-32BIT-P10-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P10-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-PRIV-NEXT: lwz r3, 12(r29) +; BE-32BIT-P10-PRIV-NEXT: lwz r3, 12(r31) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 32768 ; BE-32BIT-P10-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P10-PRIV-NEXT: lwz r3, 20(r29) +; BE-32BIT-P10-PRIV-NEXT: lwz r3, 20(r31) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P10-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P10-PRIV-NEXT: add r4, r1, r4 ; BE-32BIT-P10-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P10-PRIV-NEXT: lis r3, 0 @@ -2729,15 +2710,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P10-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P10-PRIV-NEXT: nop -; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r29) -; BE-32BIT-P10-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r31) ; BE-32BIT-P10-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P10-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P10-PRIV-NEXT: lwz r0, 8(r1) ; BE-32BIT-P10-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P10-PRIV-NEXT: mtlr r0 ; BE-32BIT-P10-PRIV-NEXT: lwz r30, -8(r1) -; BE-32BIT-P10-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-32BIT-P10-PRIV-NEXT: hashchkp r0, -16(r1) ; BE-32BIT-P10-PRIV-NEXT: blr ; ; BE-32BIT-P9-PRIV-LABEL: aligned: @@ -2748,24 +2728,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P9-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P9-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P9-PRIV-NEXT: hashstp r0, -24(r1) +; BE-32BIT-P9-PRIV-NEXT: hashstp r0, -16(r1) ; BE-32BIT-P9-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-PRIV-NEXT: stwux r1, r1, r0 -; BE-32BIT-P9-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P9-PRIV-NEXT: mr r29, r3 +; BE-32BIT-P9-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P9-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-PRIV-NEXT: lwz r3, 12(r29) +; BE-32BIT-P9-PRIV-NEXT: lwz r3, 12(r31) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 ; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 32768 ; BE-32BIT-P9-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P9-PRIV-NEXT: lwz r3, 20(r29) +; BE-32BIT-P9-PRIV-NEXT: lwz r3, 20(r31) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P9-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P9-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P9-PRIV-NEXT: lis r3, 0 ; BE-32BIT-P9-PRIV-NEXT: add r4, r1, r4 @@ -2773,15 +2752,14 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P9-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P9-PRIV-NEXT: nop -; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r29) -; BE-32BIT-P9-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r31) ; BE-32BIT-P9-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P9-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P9-PRIV-NEXT: lwz r0, 8(r1) ; BE-32BIT-P9-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-PRIV-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-PRIV-NEXT: mtlr r0 -; BE-32BIT-P9-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-32BIT-P9-PRIV-NEXT: hashchkp r0, -16(r1) ; BE-32BIT-P9-PRIV-NEXT: blr ; ; BE-32BIT-P8-PRIV-LABEL: aligned: @@ -2792,24 +2770,23 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P8-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P8-PRIV-NEXT: stw r0, 8(r1) -; BE-32BIT-P8-PRIV-NEXT: hashstp r0, -24(r1) +; BE-32BIT-P8-PRIV-NEXT: hashstp r0, -16(r1) ; BE-32BIT-P8-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-PRIV-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: stw r29, -12(r30) # 4-byte Folded Spill -; BE-32BIT-P8-PRIV-NEXT: mr r29, r3 +; BE-32BIT-P8-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P8-PRIV-NEXT: addi r5, r1, 32764 -; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: lwz r3, 12(r29) +; BE-32BIT-P8-PRIV-NEXT: lwz r3, 12(r31) ; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 32768 ; BE-32BIT-P8-PRIV-NEXT: stwx r3, r1, r4 -; BE-32BIT-P8-PRIV-NEXT: lwz r3, 20(r29) +; BE-32BIT-P8-PRIV-NEXT: lwz r3, 20(r31) ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 -; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65508 +; BE-32BIT-P8-PRIV-NEXT: ori r4, r4, 65516 ; BE-32BIT-P8-PRIV-NEXT: stw r3, 32764(r1) ; BE-32BIT-P8-PRIV-NEXT: lis r3, 0 ; BE-32BIT-P8-PRIV-NEXT: add r4, r1, r4 @@ -2817,14 +2794,13 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-NEXT: add r3, r1, r3 ; BE-32BIT-P8-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P8-PRIV-NEXT: nop -; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r29) -; BE-32BIT-P8-PRIV-NEXT: lwz r29, -12(r30) # 4-byte Folded Reload +; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r31) ; BE-32BIT-P8-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P8-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P8-PRIV-NEXT: lwz r0, 8(r1) ; BE-32BIT-P8-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-PRIV-NEXT: lwz r30, -8(r1) -; BE-32BIT-P8-PRIV-NEXT: hashchkp r0, -24(r1) +; BE-32BIT-P8-PRIV-NEXT: hashchkp r0, -16(r1) ; BE-32BIT-P8-PRIV-NEXT: mtlr r0 ; BE-32BIT-P8-PRIV-NEXT: blr entry: From d0a24521774b468f98f0dc25a6298dcd84d7ae7d Mon Sep 17 00:00:00 2001 From: Zaara Syeda Date: Thu, 1 Aug 2024 15:12:31 -0400 Subject: [PATCH 4/5] Address review comments --- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 37 +++++++---- llvm/test/CodeGen/PowerPC/aix-base-pointer.ll | 8 +-- .../PowerPC/ppc64-rop-protection-aix.ll | 64 +++++++++---------- 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 630e21796f312b..a57ed33bda9c77 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -696,7 +696,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, int64_t LROffset = getReturnSaveOffset(); int64_t FPOffset = 0; - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP) { MachineFrameInfo &MFI = MF.getFrameInfo(); int FPIndex = FI->getFramePointerSaveIndex(); assert(FPIndex && "No Frame Pointer Save Slot!"); @@ -821,7 +821,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, BuildMoveFromCR(); if (HasRedZone) { - if (HasFP || (HasBP && Subtarget.isAIXABI())) + if (HasFP) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FPOffset) @@ -1007,7 +1007,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // R0 cannot be used as a base register, but it can be used as an // index in a store-indexed. int LastOffset = 0; - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP) { // R0 += (FPOffset-LastOffset). // Need addic, since addi treats R0 as 0. BuildMI(MBB, MBBI, dl, TII.get(PPC::ADDIC), ScratchReg) @@ -1052,7 +1052,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // Now that the stack frame has been allocated, save all the necessary // registers using ScratchReg as the base address. - if (HasFP || (HasBP && Subtarget.isAIXABI())) + if (HasFP) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FPOffset) @@ -1077,7 +1077,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // field of STWU). To be here we have to be compiling for PPC32. // Since the SPReg has been decreased by FrameSize, add it back to each // offset. - if (HasFP || (HasBP && Subtarget.isAIXABI())) + if (HasFP) BuildMI(MBB, MBBI, dl, StoreInst) .addReg(FPReg) .addImm(FrameSize + FPOffset) @@ -1123,7 +1123,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP) { // Describe where FP was saved, at a fixed offset from CFA. unsigned Reg = MRI->getDwarfRegNum(FPReg, true); CFIIndex = MF.addFrameInst( @@ -1606,7 +1606,7 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF, SingleScratchReg = ScratchReg == TempReg; - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP) { int FPIndex = FI->getFramePointerSaveIndex(); assert(FPIndex && "No Frame Pointer Save Slot!"); FPOffset = MFI.getObjectOffset(FPIndex); @@ -1802,7 +1802,7 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF, .addReg(RBReg); } - if (HasFP || (HasBP && Subtarget.isAIXABI())) { + if (HasFP) { // If there is red zone, restore FP directly, since SP has already been // restored. Otherwise, restore the value of FP into ScratchReg. if (HasRedZone || RBReg == SPReg) @@ -1994,8 +1994,7 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, MachineFrameInfo &MFI = MF.getFrameInfo(); // If the frame pointer save index hasn't been defined yet. - if (!FPSI && - (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI()))) { + if (!FPSI && needsFP(MF)) { // Find out what the fix offset of the frame pointer save area. int FPOffset = getFramePointerSaveOffset(); // Allocate the frame index for frame pointer save area. @@ -2024,10 +2023,20 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, // some inline asm which explicitly clobbers it, when we otherwise have a // frame pointer and are using r31's spill slot for the prologue/epilogue // code. Same goes for the base pointer and the PIC base register. - if (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI())) + if (needsFP(MF)) SavedRegs.reset(isPPC64 ? PPC::X31 : PPC::R31); - if (RegInfo->hasBasePointer(MF)) + if (RegInfo->hasBasePointer(MF)) { SavedRegs.reset(RegInfo->getBaseRegister(MF)); + // On AIX, when BaseRegister(R30) is used, need to spill r31 too to match + // AIX trackback table requirement. + if (!needsFP(MF) && !SavedRegs.test(isPPC64 ? PPC::X31 : PPC::R31) && + Subtarget.isAIXABI()) { + assert( + (RegInfo->getBaseRegister(MF) == (isPPC64 ? PPC::X30 : PPC::R30)) && + "Invalid base register on AIX!"); + SavedRegs.set(isPPC64 ? PPC::X31 : PPC::R31); + } + } if (FI->usesPICBase()) SavedRegs.reset(PPC::R30); @@ -2167,10 +2176,9 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF, LowerBound -= (31 - TRI->getEncodingValue(MinFPR) + 1) * 8; } - const PPCRegisterInfo *RegInfo = Subtarget.getRegisterInfo(); // Check whether the frame pointer register is allocated. If so, make sure it // is spilled to the correct offset. - if (needsFP(MF) || (RegInfo->hasBasePointer(MF) && Subtarget.isAIXABI())) { + if (needsFP(MF)) { int FI = PFI->getFramePointerSaveIndex(); assert(FI && "No Frame Pointer Save Slot!"); MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI)); @@ -2187,6 +2195,7 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF, HasGPSaveArea = true; } + const PPCRegisterInfo *RegInfo = Subtarget.getRegisterInfo(); if (RegInfo->hasBasePointer(MF)) { int FI = PFI->getBasePointerSaveIndex(); assert(FI && "No Base Pointer Save Slot!"); diff --git a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll index 18894e6c97c435..f99e0eb4e8b480 100644 --- a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll +++ b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll @@ -20,27 +20,27 @@ define float @caller(float %f) { declare void @callee(ptr) ; 32BIT-LABEL: .caller: -; 32BIT: stw 31, -12(1) ; 32BIT: stw 30, -16(1) ; 32BIT: mr 30, 1 ; 32BIT: clrlwi 0, 1, 27 ; 32BIT: subfic 0, 0, -224 ; 32BIT: stwux 1, 1, 0 ; 32BIT: addi 3, 1, 64 +; 32BIT: stw 31, -12(30) ; 32BIT: bl .callee +; 32BIT: lwz 31, -12(30) ; 32BIT: mr 1, 30 -; 32BIT: lwz 31, -12(1) ; 32BIT: lwz 30, -16(1) ; 64BIT-LABEL: .caller: -; 64BIT: std 31, -16(1) ; 64BIT: std 30, -24(1) ; 64BIT: mr 30, 1 ; 64BIT: clrldi 0, 1, 59 ; 64BIT: subfic 0, 0, -288 ; 64BIT: stdux 1, 1, 0 ; 64BIT: addi 3, 1, 128 +; 64BIT: std 31, -16(30) ; 64BIT: bl .callee +; 64BIT: ld 31, -16(30) ; 64BIT: mr 1, 30 -; 64BIT: ld 31, -16(1) ; 64BIT: ld 30, -24(1) diff --git a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll index c4517714526c74..8955835f41ea6c 100644 --- a/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll +++ b/llvm/test/CodeGen/PowerPC/ppc64-rop-protection-aix.ll @@ -2297,7 +2297,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-LABEL: aligned: ; BE-P10: # %bb.0: # %entry ; BE-P10-NEXT: mflr r0 -; BE-P10-NEXT: std r31, -8(r1) ; BE-P10-NEXT: std r30, -16(r1) ; BE-P10-NEXT: lis r12, -1 ; BE-P10-NEXT: mr r30, r1 @@ -2306,6 +2305,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: clrldi r0, r1, 49 ; BE-P10-NEXT: subc r0, r12, r0 ; BE-P10-NEXT: stdux r1, r1, r0 +; BE-P10-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P10-NEXT: mr r31, r3 ; BE-P10-NEXT: lwz r3, 4(r3) ; BE-P10-NEXT: lis r4, 0 @@ -2327,28 +2327,28 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-NEXT: bl .callee3[PR] ; BE-P10-NEXT: nop ; BE-P10-NEXT: lwz r4, 16(r31) +; BE-P10-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P10-NEXT: add r3, r4, r3 ; BE-P10-NEXT: clrldi r3, r3, 32 ; BE-P10-NEXT: mr r1, r30 ; BE-P10-NEXT: ld r0, 16(r1) -; BE-P10-NEXT: ld r31, -8(r1) -; BE-P10-NEXT: mtlr r0 ; BE-P10-NEXT: ld r30, -16(r1) +; BE-P10-NEXT: mtlr r0 ; BE-P10-NEXT: hashchk r0, -24(r1) ; BE-P10-NEXT: blr ; ; BE-P9-LABEL: aligned: ; BE-P9: # %bb.0: # %entry ; BE-P9-NEXT: mflr r0 -; BE-P9-NEXT: std r31, -8(r1) -; BE-P9-NEXT: lis r12, -1 ; BE-P9-NEXT: std r30, -16(r1) +; BE-P9-NEXT: lis r12, -1 ; BE-P9-NEXT: mr r30, r1 ; BE-P9-NEXT: std r0, 16(r1) ; BE-P9-NEXT: hashst r0, -24(r1) ; BE-P9-NEXT: clrldi r0, r1, 49 ; BE-P9-NEXT: subc r0, r12, r0 ; BE-P9-NEXT: stdux r1, r1, r0 +; BE-P9-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P9-NEXT: mr r31, r3 ; BE-P9-NEXT: lwz r3, 4(r3) ; BE-P9-NEXT: lis r4, 0 @@ -2370,11 +2370,11 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-NEXT: bl .callee3[PR] ; BE-P9-NEXT: nop ; BE-P9-NEXT: lwz r4, 16(r31) +; BE-P9-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P9-NEXT: add r3, r4, r3 ; BE-P9-NEXT: clrldi r3, r3, 32 ; BE-P9-NEXT: mr r1, r30 ; BE-P9-NEXT: ld r0, 16(r1) -; BE-P9-NEXT: ld r31, -8(r1) ; BE-P9-NEXT: ld r30, -16(r1) ; BE-P9-NEXT: mtlr r0 ; BE-P9-NEXT: hashchk r0, -24(r1) @@ -2383,7 +2383,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-LABEL: aligned: ; BE-P8: # %bb.0: # %entry ; BE-P8-NEXT: mflr r0 -; BE-P8-NEXT: std r31, -8(r1) ; BE-P8-NEXT: std r30, -16(r1) ; BE-P8-NEXT: lis r12, -1 ; BE-P8-NEXT: mr r30, r1 @@ -2393,6 +2392,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-NEXT: subc r0, r12, r0 ; BE-P8-NEXT: stdux r1, r1, r0 ; BE-P8-NEXT: lis r4, 0 +; BE-P8-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P8-NEXT: mr r31, r3 ; BE-P8-NEXT: lwz r3, 4(r3) ; BE-P8-NEXT: addi r5, r1, 32764 @@ -2413,11 +2413,11 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-NEXT: bl .callee3[PR] ; BE-P8-NEXT: nop ; BE-P8-NEXT: lwz r4, 16(r31) +; BE-P8-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P8-NEXT: add r3, r4, r3 ; BE-P8-NEXT: clrldi r3, r3, 32 ; BE-P8-NEXT: mr r1, r30 ; BE-P8-NEXT: ld r0, 16(r1) -; BE-P8-NEXT: ld r31, -8(r1) ; BE-P8-NEXT: ld r30, -16(r1) ; BE-P8-NEXT: hashchk r0, -24(r1) ; BE-P8-NEXT: mtlr r0 @@ -2426,7 +2426,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-LABEL: aligned: ; BE-32BIT-P10: # %bb.0: # %entry ; BE-32BIT-P10-NEXT: mflr r0 -; BE-32BIT-P10-NEXT: stw r31, -4(r1) ; BE-32BIT-P10-NEXT: stw r30, -8(r1) ; BE-32BIT-P10-NEXT: lis r12, -1 ; BE-32BIT-P10-NEXT: mr r30, r1 @@ -2435,6 +2434,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-NEXT: stwux r1, r1, r0 +; BE-32BIT-P10-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P10-NEXT: mr r31, r3 ; BE-32BIT-P10-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-NEXT: lis r4, 0 @@ -2456,27 +2456,27 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-NEXT: bl .callee3[PR] ; BE-32BIT-P10-NEXT: nop ; BE-32BIT-P10-NEXT: lwz r4, 16(r31) +; BE-32BIT-P10-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P10-NEXT: add r3, r4, r3 ; BE-32BIT-P10-NEXT: mr r1, r30 ; BE-32BIT-P10-NEXT: lwz r0, 8(r1) -; BE-32BIT-P10-NEXT: lwz r31, -4(r1) -; BE-32BIT-P10-NEXT: mtlr r0 ; BE-32BIT-P10-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-NEXT: mtlr r0 ; BE-32BIT-P10-NEXT: hashchk r0, -16(r1) ; BE-32BIT-P10-NEXT: blr ; ; BE-32BIT-P9-LABEL: aligned: ; BE-32BIT-P9: # %bb.0: # %entry ; BE-32BIT-P9-NEXT: mflr r0 -; BE-32BIT-P9-NEXT: stw r31, -4(r1) -; BE-32BIT-P9-NEXT: lis r12, -1 ; BE-32BIT-P9-NEXT: stw r30, -8(r1) +; BE-32BIT-P9-NEXT: lis r12, -1 ; BE-32BIT-P9-NEXT: mr r30, r1 ; BE-32BIT-P9-NEXT: stw r0, 8(r1) ; BE-32BIT-P9-NEXT: hashst r0, -16(r1) ; BE-32BIT-P9-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-NEXT: stwux r1, r1, r0 +; BE-32BIT-P9-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P9-NEXT: mr r31, r3 ; BE-32BIT-P9-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-NEXT: lis r4, 0 @@ -2498,10 +2498,10 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-NEXT: bl .callee3[PR] ; BE-32BIT-P9-NEXT: nop ; BE-32BIT-P9-NEXT: lwz r4, 16(r31) +; BE-32BIT-P9-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P9-NEXT: add r3, r4, r3 ; BE-32BIT-P9-NEXT: mr r1, r30 ; BE-32BIT-P9-NEXT: lwz r0, 8(r1) -; BE-32BIT-P9-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-NEXT: mtlr r0 ; BE-32BIT-P9-NEXT: hashchk r0, -16(r1) @@ -2510,7 +2510,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-LABEL: aligned: ; BE-32BIT-P8: # %bb.0: # %entry ; BE-32BIT-P8-NEXT: mflr r0 -; BE-32BIT-P8-NEXT: stw r31, -4(r1) ; BE-32BIT-P8-NEXT: stw r30, -8(r1) ; BE-32BIT-P8-NEXT: lis r12, -1 ; BE-32BIT-P8-NEXT: mr r30, r1 @@ -2520,6 +2519,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-NEXT: lis r4, 0 +; BE-32BIT-P8-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P8-NEXT: mr r31, r3 ; BE-32BIT-P8-NEXT: lwz r3, 4(r3) ; BE-32BIT-P8-NEXT: addi r5, r1, 32764 @@ -2540,10 +2540,10 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-NEXT: bl .callee3[PR] ; BE-32BIT-P8-NEXT: nop ; BE-32BIT-P8-NEXT: lwz r4, 16(r31) +; BE-32BIT-P8-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P8-NEXT: add r3, r4, r3 ; BE-32BIT-P8-NEXT: mr r1, r30 ; BE-32BIT-P8-NEXT: lwz r0, 8(r1) -; BE-32BIT-P8-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-NEXT: lwz r30, -8(r1) ; BE-32BIT-P8-NEXT: hashchk r0, -16(r1) ; BE-32BIT-P8-NEXT: mtlr r0 @@ -2552,7 +2552,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-LABEL: aligned: ; BE-P10-PRIV: # %bb.0: # %entry ; BE-P10-PRIV-NEXT: mflr r0 -; BE-P10-PRIV-NEXT: std r31, -8(r1) ; BE-P10-PRIV-NEXT: std r30, -16(r1) ; BE-P10-PRIV-NEXT: lis r12, -1 ; BE-P10-PRIV-NEXT: mr r30, r1 @@ -2561,6 +2560,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-P10-PRIV-NEXT: stdux r1, r1, r0 +; BE-P10-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P10-PRIV-NEXT: mr r31, r3 ; BE-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-P10-PRIV-NEXT: lis r4, 0 @@ -2582,28 +2582,28 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P10-PRIV-NEXT: bl .callee3[PR] ; BE-P10-PRIV-NEXT: nop ; BE-P10-PRIV-NEXT: lwz r4, 16(r31) +; BE-P10-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P10-PRIV-NEXT: add r3, r4, r3 ; BE-P10-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P10-PRIV-NEXT: mr r1, r30 ; BE-P10-PRIV-NEXT: ld r0, 16(r1) -; BE-P10-PRIV-NEXT: ld r31, -8(r1) -; BE-P10-PRIV-NEXT: mtlr r0 ; BE-P10-PRIV-NEXT: ld r30, -16(r1) +; BE-P10-PRIV-NEXT: mtlr r0 ; BE-P10-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-P10-PRIV-NEXT: blr ; ; BE-P9-PRIV-LABEL: aligned: ; BE-P9-PRIV: # %bb.0: # %entry ; BE-P9-PRIV-NEXT: mflr r0 -; BE-P9-PRIV-NEXT: std r31, -8(r1) -; BE-P9-PRIV-NEXT: lis r12, -1 ; BE-P9-PRIV-NEXT: std r30, -16(r1) +; BE-P9-PRIV-NEXT: lis r12, -1 ; BE-P9-PRIV-NEXT: mr r30, r1 ; BE-P9-PRIV-NEXT: std r0, 16(r1) ; BE-P9-PRIV-NEXT: hashstp r0, -24(r1) ; BE-P9-PRIV-NEXT: clrldi r0, r1, 49 ; BE-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-P9-PRIV-NEXT: stdux r1, r1, r0 +; BE-P9-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P9-PRIV-NEXT: mr r31, r3 ; BE-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-P9-PRIV-NEXT: lis r4, 0 @@ -2625,11 +2625,11 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P9-PRIV-NEXT: bl .callee3[PR] ; BE-P9-PRIV-NEXT: nop ; BE-P9-PRIV-NEXT: lwz r4, 16(r31) +; BE-P9-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P9-PRIV-NEXT: add r3, r4, r3 ; BE-P9-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P9-PRIV-NEXT: mr r1, r30 ; BE-P9-PRIV-NEXT: ld r0, 16(r1) -; BE-P9-PRIV-NEXT: ld r31, -8(r1) ; BE-P9-PRIV-NEXT: ld r30, -16(r1) ; BE-P9-PRIV-NEXT: mtlr r0 ; BE-P9-PRIV-NEXT: hashchkp r0, -24(r1) @@ -2638,7 +2638,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-LABEL: aligned: ; BE-P8-PRIV: # %bb.0: # %entry ; BE-P8-PRIV-NEXT: mflr r0 -; BE-P8-PRIV-NEXT: std r31, -8(r1) ; BE-P8-PRIV-NEXT: std r30, -16(r1) ; BE-P8-PRIV-NEXT: lis r12, -1 ; BE-P8-PRIV-NEXT: mr r30, r1 @@ -2648,6 +2647,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-P8-PRIV-NEXT: stdux r1, r1, r0 ; BE-P8-PRIV-NEXT: lis r4, 0 +; BE-P8-PRIV-NEXT: std r31, -8(r30) # 8-byte Folded Spill ; BE-P8-PRIV-NEXT: mr r31, r3 ; BE-P8-PRIV-NEXT: lwz r3, 4(r3) ; BE-P8-PRIV-NEXT: addi r5, r1, 32764 @@ -2668,11 +2668,11 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-P8-PRIV-NEXT: bl .callee3[PR] ; BE-P8-PRIV-NEXT: nop ; BE-P8-PRIV-NEXT: lwz r4, 16(r31) +; BE-P8-PRIV-NEXT: ld r31, -8(r30) # 8-byte Folded Reload ; BE-P8-PRIV-NEXT: add r3, r4, r3 ; BE-P8-PRIV-NEXT: clrldi r3, r3, 32 ; BE-P8-PRIV-NEXT: mr r1, r30 ; BE-P8-PRIV-NEXT: ld r0, 16(r1) -; BE-P8-PRIV-NEXT: ld r31, -8(r1) ; BE-P8-PRIV-NEXT: ld r30, -16(r1) ; BE-P8-PRIV-NEXT: hashchkp r0, -24(r1) ; BE-P8-PRIV-NEXT: mtlr r0 @@ -2681,7 +2681,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-LABEL: aligned: ; BE-32BIT-P10-PRIV: # %bb.0: # %entry ; BE-32BIT-P10-PRIV-NEXT: mflr r0 -; BE-32BIT-P10-PRIV-NEXT: stw r31, -4(r1) ; BE-32BIT-P10-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P10-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P10-PRIV-NEXT: mr r30, r1 @@ -2690,6 +2689,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P10-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P10-PRIV-NEXT: stwux r1, r1, r0 +; BE-32BIT-P10-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P10-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P10-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P10-PRIV-NEXT: lis r4, 0 @@ -2711,27 +2711,27 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P10-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P10-PRIV-NEXT: nop ; BE-32BIT-P10-PRIV-NEXT: lwz r4, 16(r31) +; BE-32BIT-P10-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P10-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P10-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P10-PRIV-NEXT: lwz r0, 8(r1) -; BE-32BIT-P10-PRIV-NEXT: lwz r31, -4(r1) -; BE-32BIT-P10-PRIV-NEXT: mtlr r0 ; BE-32BIT-P10-PRIV-NEXT: lwz r30, -8(r1) +; BE-32BIT-P10-PRIV-NEXT: mtlr r0 ; BE-32BIT-P10-PRIV-NEXT: hashchkp r0, -16(r1) ; BE-32BIT-P10-PRIV-NEXT: blr ; ; BE-32BIT-P9-PRIV-LABEL: aligned: ; BE-32BIT-P9-PRIV: # %bb.0: # %entry ; BE-32BIT-P9-PRIV-NEXT: mflr r0 -; BE-32BIT-P9-PRIV-NEXT: stw r31, -4(r1) -; BE-32BIT-P9-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P9-PRIV-NEXT: stw r30, -8(r1) +; BE-32BIT-P9-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P9-PRIV-NEXT: mr r30, r1 ; BE-32BIT-P9-PRIV-NEXT: stw r0, 8(r1) ; BE-32BIT-P9-PRIV-NEXT: hashstp r0, -16(r1) ; BE-32BIT-P9-PRIV-NEXT: clrlwi r0, r1, 17 ; BE-32BIT-P9-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P9-PRIV-NEXT: stwux r1, r1, r0 +; BE-32BIT-P9-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P9-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P9-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P9-PRIV-NEXT: lis r4, 0 @@ -2753,10 +2753,10 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P9-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P9-PRIV-NEXT: nop ; BE-32BIT-P9-PRIV-NEXT: lwz r4, 16(r31) +; BE-32BIT-P9-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P9-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P9-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P9-PRIV-NEXT: lwz r0, 8(r1) -; BE-32BIT-P9-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P9-PRIV-NEXT: lwz r30, -8(r1) ; BE-32BIT-P9-PRIV-NEXT: mtlr r0 ; BE-32BIT-P9-PRIV-NEXT: hashchkp r0, -16(r1) @@ -2765,7 +2765,6 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-LABEL: aligned: ; BE-32BIT-P8-PRIV: # %bb.0: # %entry ; BE-32BIT-P8-PRIV-NEXT: mflr r0 -; BE-32BIT-P8-PRIV-NEXT: stw r31, -4(r1) ; BE-32BIT-P8-PRIV-NEXT: stw r30, -8(r1) ; BE-32BIT-P8-PRIV-NEXT: lis r12, -1 ; BE-32BIT-P8-PRIV-NEXT: mr r30, r1 @@ -2775,6 +2774,7 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-NEXT: subc r0, r12, r0 ; BE-32BIT-P8-PRIV-NEXT: stwux r1, r1, r0 ; BE-32BIT-P8-PRIV-NEXT: lis r4, 0 +; BE-32BIT-P8-PRIV-NEXT: stw r31, -4(r30) # 4-byte Folded Spill ; BE-32BIT-P8-PRIV-NEXT: mr r31, r3 ; BE-32BIT-P8-PRIV-NEXT: lwz r3, 4(r3) ; BE-32BIT-P8-PRIV-NEXT: addi r5, r1, 32764 @@ -2795,10 +2795,10 @@ define dso_local zeroext i32 @aligned(ptr nocapture readonly %in) #0 { ; BE-32BIT-P8-PRIV-NEXT: bl .callee3[PR] ; BE-32BIT-P8-PRIV-NEXT: nop ; BE-32BIT-P8-PRIV-NEXT: lwz r4, 16(r31) +; BE-32BIT-P8-PRIV-NEXT: lwz r31, -4(r30) # 4-byte Folded Reload ; BE-32BIT-P8-PRIV-NEXT: add r3, r4, r3 ; BE-32BIT-P8-PRIV-NEXT: mr r1, r30 ; BE-32BIT-P8-PRIV-NEXT: lwz r0, 8(r1) -; BE-32BIT-P8-PRIV-NEXT: lwz r31, -4(r1) ; BE-32BIT-P8-PRIV-NEXT: lwz r30, -8(r1) ; BE-32BIT-P8-PRIV-NEXT: hashchkp r0, -16(r1) ; BE-32BIT-P8-PRIV-NEXT: mtlr r0 From 4545ed630e5e60a42b47d084194646130780620c Mon Sep 17 00:00:00 2001 From: Zaara Syeda Date: Thu, 1 Aug 2024 15:17:03 -0400 Subject: [PATCH 5/5] Fix testcase comment --- llvm/test/CodeGen/PowerPC/aix-base-pointer.ll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll index f99e0eb4e8b480..5e66e5ec276389 100644 --- a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll +++ b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll @@ -8,7 +8,7 @@ ; - base pointer register (r30) is saved/defined/restored. ; - frame pointer register (r31) is saved/defined/restored. ; - stack frame is allocated with correct alignment. -; - Address of %AlignedBuffer is calculated based off offset from the frame +; - Address of %AlignedBuffer is calculated based off offset from the stack ; pointer. define float @caller(float %f) {