Index: lib/Target/WebAssembly/WebAssemblyISelLowering.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -1148,6 +1148,21 @@ // Only manually lower vector shifts assert(Op.getSimpleValueType().isVector()); + // Expand all vector shifts until V8 fixes its implementation + // TODO: remove this once V8 is fixed + if (!Subtarget->hasUnimplementedSIMD128()) { + // Mask the operand + SDValue Shift = Op.getOperand(1); + uint64_t MaskVal = + Op.getSimpleValueType().getVectorElementType().getSizeInBits() - 1; + SDValue MaskedShift = + DAG.getNode(ISD::AND, DL, Shift.getValueType(), Shift, + DAG.getConstant(MaskVal, DL, Shift.getValueType())); + return DAG.UnrollVectorOp(DAG.getNode(Op.getOpcode(), DL, Op.getValueType(), + Op.getOperand(0), MaskedShift) + .getNode()); + } + // Unroll non-splat vector shifts BuildVectorSDNode *ShiftVec; SDValue SplatVal;