diff options
author | Ting Wang <Ting.Wang.SH@ibm.com> | 2023-02-02 20:52:52 -0500 |
---|---|---|
committer | Ting Wang <Ting.Wang.SH@ibm.com> | 2023-02-02 20:52:52 -0500 |
commit | 1d8f13ae4538fe49ecf3f59ddbd4e63b911107da (patch) | |
tree | 5fb7e20e5589d199039441b8564abbe5e5b8fb65 /llvm/lib/Target/PowerPC/PPCMIPeephole.cpp | |
parent | 41fdb4c53f44281e4c7e26c2571395b9fc692cc4 (diff) | |
download | llvm-1d8f13ae4538fe49ecf3f59ddbd4e63b911107da.zip llvm-1d8f13ae4538fe49ecf3f59ddbd4e63b911107da.tar.gz llvm-1d8f13ae4538fe49ecf3f59ddbd4e63b911107da.tar.bz2 |
[PowerPC] add a peephole to remove redundant swap instructions after vector splats on P8
Vector store on P8 little endian will have swap instruction added before
the store in PPCISelLowring. If the vector is generated by splat, the
swap instruction can be eliminated.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D139691
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMIPeephole.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCMIPeephole.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp index 5b7761f..af35669 100644 --- a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp +++ b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp @@ -641,6 +641,18 @@ bool PPCMIPeephole::simplifyCode() { DefMI->getOperand(0).setReg(MI.getOperand(0).getReg()); LLVM_DEBUG(dbgs() << "Removing redundant splat: "); LLVM_DEBUG(MI.dump()); + } else if (Immed == 2 && + (DefOpc == PPC::VSPLTB || DefOpc == PPC::VSPLTH || + DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW)) { + // Swap of various vector splats, convert to copy. + ToErase = &MI; + Simplified = true; + LLVM_DEBUG(dbgs() << "Optimizing swap(vsplt[b|h|w]|xxspltw) => " + "copy(vsplt[b|h|w]|xxspltw): "); + LLVM_DEBUG(MI.dump()); + BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(PPC::COPY), + MI.getOperand(0).getReg()) + .add(MI.getOperand(1)); } break; } |