[llvm] 0bcef1d - [PowerPC] remove XXSWAPD after vector splat immediate

Ting Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 21:58:51 PDT 2023


Author: Ting Wang
Date: 2023-07-12T00:58:36-04:00
New Revision: 0bcef1d93de828950eef305640a0295f2181770a

URL: https://github.com/llvm/llvm-project/commit/0bcef1d93de828950eef305640a0295f2181770a
DIFF: https://github.com/llvm/llvm-project/commit/0bcef1d93de828950eef305640a0295f2181770a.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCMIPeephole.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
index 34da55e40c7280..410f4cba97c621 100644
--- a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
@@ -657,12 +657,14 @@ bool PPCMIPeephole::simplifyCode() {
           LLVM_DEBUG(MI.dump());
         } else if (Immed == 2 &&
                    (DefOpc == PPC::VSPLTB || DefOpc == PPC::VSPLTH ||
-                    DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW)) {
+                    DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW ||
+                    DefOpc == PPC::VSPLTISB || DefOpc == PPC::VSPLTISH ||
+                    DefOpc == PPC::VSPLTISW)) {
           // 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(dbgs() << "Optimizing swap(vsplt(is)?[b|h|w]|xxspltw) => "
+                               "copy(vsplt(is)?[b|h|w]|xxspltw): ");
           LLVM_DEBUG(MI.dump());
           BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(PPC::COPY),
                   MI.getOperand(0).getReg())


        


More information about the llvm-commits mailing list