[llvm] [X86] X86InstrInfo::commuteInstructionImpl - remove (V)BLENDPD/S commutation to (V)MOVSD/S optsize handling (PR #144051)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 03:24:22 PDT 2025
https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/144051
Just commute with (V)BLENDPD/S like all other BLEND instructions
This is now handled more generally by the X86FixupInstTuningPass (OptSize fold occurs even without a scheduler model).
First step towards #142972
>From 313b1fb19c591237b69bb10d6bc28ee006539e54 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Fri, 13 Jun 2025 11:22:59 +0100
Subject: [PATCH] [X86] X86InstrInfo::commuteInstructionImpl - remove
(V)BLENDPD/S commutation to (V)MOVSD/S optsize handling
This is now handled more generally by the X86FixupInstTuningPass (OptSize fold occurs even without a scheduler model).
First step towards #142972
---
llvm/lib/Target/X86/X86InstrInfo.cpp | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 212e134c512a7..abf365eedec39 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -2353,33 +2353,9 @@ MachineInstr *X86InstrInfo::commuteInstructionImpl(MachineInstr &MI, bool NewMI,
break;
case X86::BLENDPDrri:
case X86::BLENDPSrri:
+ case X86::PBLENDWrri:
case X86::VBLENDPDrri:
case X86::VBLENDPSrri:
- // If we're optimizing for size, try to use MOVSD/MOVSS.
- if (MI.getParent()->getParent()->getFunction().hasOptSize()) {
- unsigned Mask = (Opc == X86::BLENDPDrri || Opc == X86::VBLENDPDrri) ? 0x03: 0x0F;
- if ((MI.getOperand(3).getImm() ^ Mask) == 1) {
-#define FROM_TO(FROM, TO) \
- case X86::FROM: \
- Opc = X86::TO; \
- break;
- switch (Opc) {
- default:
- llvm_unreachable("Unreachable!");
- FROM_TO(BLENDPDrri, MOVSDrr)
- FROM_TO(BLENDPSrri, MOVSSrr)
- FROM_TO(VBLENDPDrri, VMOVSDrr)
- FROM_TO(VBLENDPSrri, VMOVSSrr)
- }
- WorkingMI = CloneIfNew(MI);
- WorkingMI->setDesc(get(Opc));
- WorkingMI->removeOperand(3);
- break;
- }
-#undef FROM_TO
- }
- [[fallthrough]];
- case X86::PBLENDWrri:
case X86::VBLENDPDYrri:
case X86::VBLENDPSYrri:
case X86::VPBLENDDrri:
More information about the llvm-commits
mailing list