Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
Show First 20 Lines • Show All 2,316 Lines • ▼ Show 20 Lines | WebAssemblyTargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, | ||||
SDValue Ops[18]; | SDValue Ops[18]; | ||||
size_t OpIdx = 0; | size_t OpIdx = 0; | ||||
Ops[OpIdx++] = Op.getOperand(0); | Ops[OpIdx++] = Op.getOperand(0); | ||||
Ops[OpIdx++] = Op.getOperand(1); | Ops[OpIdx++] = Op.getOperand(1); | ||||
// Expand mask indices to byte indices and materialize them as operands | // Expand mask indices to byte indices and materialize them as operands | ||||
for (int M : Mask) { | for (int M : Mask) { | ||||
for (size_t J = 0; J < LaneBytes; ++J) { | for (size_t J = 0; J < LaneBytes; ++J) { | ||||
// Lower undefs (represented by -1 in mask) to zero | // Lower undefs (represented by -1 in mask) to {0..J}, to allow further | ||||
penzn: Nit: maybe expand on why '{0..J}', it might be not immediately obvious for those who didn't… | |||||
uint64_t ByteIndex = M == -1 ? 0 : (uint64_t)M * LaneBytes + J; | // reduction at VM, eg. to dword shuffle. | ||||
uint64_t ByteIndex = M == -1 ? J : (uint64_t)M * LaneBytes + J; | |||||
Ops[OpIdx++] = DAG.getConstant(ByteIndex, DL, MVT::i32); | Ops[OpIdx++] = DAG.getConstant(ByteIndex, DL, MVT::i32); | ||||
} | } | ||||
} | } | ||||
return DAG.getNode(WebAssemblyISD::SHUFFLE, DL, Op.getValueType(), Ops); | return DAG.getNode(WebAssemblyISD::SHUFFLE, DL, Op.getValueType(), Ops); | ||||
} | } | ||||
SDValue WebAssemblyTargetLowering::LowerSETCC(SDValue Op, | SDValue WebAssemblyTargetLowering::LowerSETCC(SDValue Op, | ||||
▲ Show 20 Lines • Show All 428 Lines • Show Last 20 Lines |
Nit: maybe expand on why '{0..J}', it might be not immediately obvious for those who didn't look at shuffles recently.