Skip to content

Commit 0bcef1d

Browse files
Ting WangTing Wang
authored andcommitted
[PowerPC] remove XXSWAPD after vector splat immediate
Redundant XXSWAPD has been observed on little-endian in D138883 test case. Remove those associated with vector splat instructions. Reviewed By: shchenz Differential Revision: https://reviews.llvm.org/D139193
1 parent bd9b57d commit 0bcef1d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Target/PowerPC/PPCMIPeephole.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,14 @@ bool PPCMIPeephole::simplifyCode() {
657657
LLVM_DEBUG(MI.dump());
658658
} else if (Immed == 2 &&
659659
(DefOpc == PPC::VSPLTB || DefOpc == PPC::VSPLTH ||
660-
DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW)) {
660+
DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW ||
661+
DefOpc == PPC::VSPLTISB || DefOpc == PPC::VSPLTISH ||
662+
DefOpc == PPC::VSPLTISW)) {
661663
// Swap of various vector splats, convert to copy.
662664
ToErase = &MI;
663665
Simplified = true;
664-
LLVM_DEBUG(dbgs() << "Optimizing swap(vsplt[b|h|w]|xxspltw) => "
665-
"copy(vsplt[b|h|w]|xxspltw): ");
666+
LLVM_DEBUG(dbgs() << "Optimizing swap(vsplt(is)?[b|h|w]|xxspltw) => "
667+
"copy(vsplt(is)?[b|h|w]|xxspltw): ");
666668
LLVM_DEBUG(MI.dump());
667669
BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(PPC::COPY),
668670
MI.getOperand(0).getReg())

0 commit comments

Comments
 (0)