[llvm] [X86] Truncate unused bit for blendw mask (PR #178883)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 30 05:00:47 PST 2026


https://github.com/mahesh-attarde updated https://github.com/llvm/llvm-project/pull/178883

>From 8b8c37790df4c37b1c75230ae3938de9210785c4 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Fri, 30 Jan 2026 04:32:41 -0800
Subject: [PATCH 1/2] [X86] Truncate unused bit for blendw mask

---
 llvm/lib/Target/X86/X86FixupInstTuning.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/X86/X86FixupInstTuning.cpp b/llvm/lib/Target/X86/X86FixupInstTuning.cpp
index 4747977e3f43b..4a81fc2ae604b 100644
--- a/llvm/lib/Target/X86/X86FixupInstTuning.cpp
+++ b/llvm/lib/Target/X86/X86FixupInstTuning.cpp
@@ -260,7 +260,8 @@ bool X86FixupInstTuningImpl::processInstruction(
       return false;
     // Convert to VPBLENDD if scaling the VPBLENDW mask down/up loses no bits.
     APInt MaskW =
-        APInt(8, MI.getOperand(NumOperands - 1).getImm(), /*IsSigned=*/false);
+        APInt(8, MI.getOperand(NumOperands - 1).getImm(), /*IsSigned=*/false,
+             /*implicitTrunc=*/true);
     APInt MaskD = APIntOps::ScaleBitMask(MaskW, 4, /*MatchAllBits=*/true);
     if (MaskW != APIntOps::ScaleBitMask(MaskD, 8, /*MatchAllBits=*/true))
       return false;

>From faf0d4cac75a3ffef298b783afc53f1065eade63 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Fri, 30 Jan 2026 05:00:18 -0800
Subject: [PATCH 2/2] nit

---
 llvm/lib/Target/X86/X86FixupInstTuning.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/X86/X86FixupInstTuning.cpp b/llvm/lib/Target/X86/X86FixupInstTuning.cpp
index 4a81fc2ae604b..af3c3af38e681 100644
--- a/llvm/lib/Target/X86/X86FixupInstTuning.cpp
+++ b/llvm/lib/Target/X86/X86FixupInstTuning.cpp
@@ -261,7 +261,7 @@ bool X86FixupInstTuningImpl::processInstruction(
     // Convert to VPBLENDD if scaling the VPBLENDW mask down/up loses no bits.
     APInt MaskW =
         APInt(8, MI.getOperand(NumOperands - 1).getImm(), /*IsSigned=*/false,
-             /*implicitTrunc=*/true);
+              /*implicitTrunc=*/true);
     APInt MaskD = APIntOps::ScaleBitMask(MaskW, 4, /*MatchAllBits=*/true);
     if (MaskW != APIntOps::ScaleBitMask(MaskD, 8, /*MatchAllBits=*/true))
       return false;



More information about the llvm-commits mailing list