[llvm] [X86] Fold BLEND(PERMUTE(X), PERMUTE(Y)) -> PERMUTE(BLEND(X, Y)) (PR #90219)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 11:28:00 PDT 2024


================
@@ -41754,6 +41754,61 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
     KnownUndef = SrcUndef.zextOrTrunc(NumElts);
     break;
   }
+  case X86ISD::BLENDI: {
+    SDValue N0 = Op.getOperand(0);
+    SDValue N1 = Op.getOperand(1);
+    if (VT.getScalarSizeInBits() < 32 || !N0.hasOneUse() || !N1.hasOneUse())
----------------
RKSimon wrote:

Yes, I think eventually I'd like to get BLENDV/VSELECT to work with this as well. This first version is trying very hard not to introduce extra variable blend masks, hence why its just for BLENDI, but with a bit of massaging I think we can get it beneficially working for BLENDV and predicate masks as well.

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


More information about the llvm-commits mailing list