[llvm] [WebAssembly] Add fold support for dot (PR #151775)
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 00:34:48 PDT 2025
================
@@ -3436,6 +3439,53 @@ static SDValue performSETCCCombine(SDNode *N,
return SDValue();
}
+static SDValue performAddCombine(SDNode *N, SelectionDAG &DAG) {
+ assert(N->getOpcode() == ISD::ADD);
+ EVT VT = N->getValueType(0);
+ SDValue N0 = N->getOperand(0), N1 = N->getOperand(1);
+
+ if (VT != MVT::v4i32)
+ return SDValue();
+
+ auto IsShuffleWithMask = [](SDValue V, ArrayRef<int> ShuffleValue) {
+ if (V.getOpcode() != ISD::VECTOR_SHUFFLE)
+ return SDValue();
+ if (cast<ShuffleVectorSDNode>(V)->getMask() != ShuffleValue)
+ return SDValue();
+ return V;
+ };
+ auto ShuffleA = IsShuffleWithMask(N0, {0, 2, 4, 6});
+ auto ShuffleB = IsShuffleWithMask(N1, {1, 3, 5, 7});
+ // two SDValues must be muls
----------------
sparker-arm wrote:
Comment in the wrong place?
And it looks like you're assuming an order of these shuffles, is there some canonicalization that you're relying on?
https://github.com/llvm/llvm-project/pull/151775
More information about the llvm-commits
mailing list