[llvm] bc6370a - [X86] addConstantComments - split VPERMILPS/VPERMILPD handling to reduce repeated switch cases etc. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 05:48:34 PST 2024
Author: Simon Pilgrim
Date: 2024-02-05T13:48:15Z
New Revision: bc6370abd3f1e6b02100927095a2797472d6ff70
URL: https://github.com/llvm/llvm-project/commit/bc6370abd3f1e6b02100927095a2797472d6ff70
DIFF: https://github.com/llvm/llvm-project/commit/bc6370abd3f1e6b02100927095a2797472d6ff70.diff
LOG: [X86] addConstantComments - split VPERMILPS/VPERMILPD handling to reduce repeated switch cases etc. NFC.
Added:
Modified:
llvm/lib/Target/X86/X86MCInstLower.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index d1f835b20a72d..31779f62547a6 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1782,7 +1782,17 @@ static void addConstantComments(const MachineInstr *MI,
case X86::VPERMILPSZ256rmkz:
case X86::VPERMILPSZrm:
case X86::VPERMILPSZrmk:
- case X86::VPERMILPSZrmkz:
+ case X86::VPERMILPSZrmkz: {
+ unsigned SrcIdx = getSrcIdx(MI, 1);
+ if (auto *C = X86::getConstantFromPool(*MI, SrcIdx + 1)) {
+ unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]);
+ SmallVector<int, 16> Mask;
+ DecodeVPERMILPMask(C, 32, Width, Mask);
+ if (!Mask.empty())
+ OutStreamer.AddComment(getShuffleComment(MI, SrcIdx, SrcIdx, Mask));
+ }
+ break;
+ }
case X86::VPERMILPDrm:
case X86::VPERMILPDYrm:
case X86::VPERMILPDZ128rm:
@@ -1794,42 +1804,11 @@ static void addConstantComments(const MachineInstr *MI,
case X86::VPERMILPDZrm:
case X86::VPERMILPDZrmk:
case X86::VPERMILPDZrmkz: {
- unsigned ElSize;
- switch (MI->getOpcode()) {
- default: llvm_unreachable("Invalid opcode");
- case X86::VPERMILPSrm:
- case X86::VPERMILPSYrm:
- case X86::VPERMILPSZ128rm:
- case X86::VPERMILPSZ256rm:
- case X86::VPERMILPSZrm:
- case X86::VPERMILPSZ128rmkz:
- case X86::VPERMILPSZ256rmkz:
- case X86::VPERMILPSZrmkz:
- case X86::VPERMILPSZ128rmk:
- case X86::VPERMILPSZ256rmk:
- case X86::VPERMILPSZrmk:
- ElSize = 32;
- break;
- case X86::VPERMILPDrm:
- case X86::VPERMILPDYrm:
- case X86::VPERMILPDZ128rm:
- case X86::VPERMILPDZ256rm:
- case X86::VPERMILPDZrm:
- case X86::VPERMILPDZ128rmkz:
- case X86::VPERMILPDZ256rmkz:
- case X86::VPERMILPDZrmkz:
- case X86::VPERMILPDZ128rmk:
- case X86::VPERMILPDZ256rmk:
- case X86::VPERMILPDZrmk:
- ElSize = 64;
- break;
- }
-
unsigned SrcIdx = getSrcIdx(MI, 1);
if (auto *C = X86::getConstantFromPool(*MI, SrcIdx + 1)) {
unsigned Width = getRegisterWidth(MI->getDesc().operands()[0]);
SmallVector<int, 16> Mask;
- DecodeVPERMILPMask(C, ElSize, Width, Mask);
+ DecodeVPERMILPMask(C, 64, Width, Mask);
if (!Mask.empty())
OutStreamer.AddComment(getShuffleComment(MI, SrcIdx, SrcIdx, Mask));
}
More information about the llvm-commits
mailing list