[llvm] [X86] Fold chained i32 CLMUL operands (PR #202250)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 07:59:35 PDT 2026


================
@@ -45461,6 +45461,71 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
     }
     break;
   }
+  case X86ISD::PCLMULQDQ: {
+    // Carry-less product bit i only depends on source bits [0, i], so a
+    // low-qword extract+narrow+scalar_to_vector round-trip on an operand can be
+    // replaced by its source vector when only those low result bits are wanted.
+    unsigned NumElts = VT.getVectorNumElements();
+    APInt HighElts = APInt::getSplat(NumElts, APInt(2, 0b10));
+    unsigned DemandedLoBits = OriginalDemandedBits.getActiveBits();
----------------
RKSimon wrote:

We shouldn't ever get here if OriginalDemandedBits == 0

https://github.com/llvm/llvm-project/pull/202250


More information about the llvm-commits mailing list