From 6a0e6322055dcaaa30ed485434dd40b4db08eb5d Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 2 Apr 2025 22:48:26 +0100 Subject: [PATCH] [X86] getFauxShuffleMask - only handle VTRUNC nodes with matching src/dst sizes Cleanup work for #133947 - we need to handle VTRUNC nodes with large source vectors directly to allow us to widen the size of the shuffle combine We currently discard these results in combineX86ShufflesRecursively anyhow as we don't allow inputs from getTargetShuffleInputs to be larger than the shuffle value type --- llvm/lib/Target/X86/X86ISelLowering.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 8e6a891444bf1..aea80120a0481 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -6413,9 +6413,7 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts, case X86ISD::VTRUNC: { SDValue Src = N.getOperand(0); EVT SrcVT = Src.getValueType(); - // Truncated source must be a simple vector. - if (!SrcVT.isSimple() || (SrcVT.getSizeInBits() % 128) != 0 || - (SrcVT.getScalarSizeInBits() % 8) != 0) + if (SrcVT.getSizeInBits() != NumSizeInBits) return false; unsigned NumSrcElts = SrcVT.getVectorNumElements(); unsigned NumBitsPerSrcElt = SrcVT.getScalarSizeInBits();