[llvm] [X86] lowerShuffleAsBroadcast - use isShuffleEquivalent to search for a hidden broadcast pattern (PR #126517)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 08:52:26 PST 2025


================
@@ -9799,6 +9799,24 @@ static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp,
         MaskSize == (int)ExpectedOp.getNumOperands())
       return Op.getOperand(Idx) == ExpectedOp.getOperand(ExpectedIdx);
     break;
+  case ISD::BITCAST:
+    if (Op == ExpectedOp && (int)VT.getVectorNumElements() == MaskSize) {
+      SDValue Src = peekThroughBitcasts(Op);
----------------
RKSimon wrote:

Yes, it happens as DAG combines still don't occur in topological order - and its common in shuffle lowering where we are bitcasting between shuffle widths so much.

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


More information about the llvm-commits mailing list