Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,13 +1737,12 @@ void CodeGen::genCodeForShift(GenTree* tree)
GenTreeOp* treeNode = tree->AsOp();
genConsumeOperands(treeNode);

// TODO-WASM: Zero-extend the 2nd operand for shifts and rotates as needed when the 1st and 2nd operand are
// different types. The shift operand width in IR is always TYP_INT; the WASM operations have the same widths
// for both the shift and shiftee. So the shift may need to be extended (zero-extended) for TYP_LONG.

// The shift operand width in IR is always int or small int, so the operand's actual type should be TYP_INT.
// However, the WASM operations have the same widths for both the shift and shiftee so
// the shift width may need to be zero-extended if the shift result type is TYP_LONG.
if (treeNode->TypeIs(TYP_LONG))
{
assert(treeNode->gtGetOp2()->TypeIs(TYP_INT));
assert(genActualType(treeNode->gtGetOp2()->TypeGet()) == TYP_INT);
Comment thread
adamperlin marked this conversation as resolved.
// Zero-extend the shift amount to 64 bits for long shifts/rotates.
// Wasteful if the amount was a constant, perhaps we should contain it if so.
GetEmitter()->emitIns(INS_i64_extend_u_i32);
Expand Down
Loading