[llvm] [WebAssembly] Recognise EXTEND_HIGH (PR #123325)
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 01:29:43 PST 2025
================
@@ -2143,6 +2143,32 @@ WebAssemblyTargetLowering::LowerSIGN_EXTEND_INREG(SDValue Op,
Op.getOperand(1));
}
+static SDValue GetExtendHigh(SDValue Op, unsigned UserOpc, EVT VT,
+ SelectionDAG &DAG) {
+ if (Op.getOpcode() != ISD::VECTOR_SHUFFLE)
+ return SDValue();
+
+ assert((UserOpc == WebAssemblyISD::EXTEND_LOW_U ||
+ UserOpc == WebAssemblyISD::EXTEND_LOW_S) &&
+ "expected extend_low");
+ auto *Shuffle = cast<ShuffleVectorSDNode>(Op.getNode());
+ ArrayRef<int> Mask = Shuffle->getMask();
+
+ // Look for a shuffle which moves from the high half to the low half.
+ size_t FirstIdx = Mask.size() / 2;
+ for (size_t i = 0; i < Mask.size() / 2; ++i) {
----------------
sparker-arm wrote:
We don't, but as the user is an `extend_low`, the high half of the result doesn't matter. But I will add a check that the extend is the only user.
https://github.com/llvm/llvm-project/pull/123325
More information about the llvm-commits
mailing list