Commit ceacdcd0 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[x64] Word32 comparisons automatically truncate Word64 inputs.

On Intel platforms, the kX64Cmp32 and kX64Test32 operations in
TurboFan's backend automatically truncate their inputs to Word32
(aka they don't look at the upper bits), so the instruction selection
can silently ignore TruncateInt64ToInt32 on the inputs.

Bug: v8:8178
Change-Id: Ia50a38cac927e5b2155f092a8885da255a3dddca
Reviewed-on: https://chromium-review.googlesource.com/1227935Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55968}
parent 1fc9327f
...@@ -1667,6 +1667,17 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, ...@@ -1667,6 +1667,17 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
Node* left = node->InputAt(0); Node* left = node->InputAt(0);
Node* right = node->InputAt(1); Node* right = node->InputAt(1);
// The 32-bit comparisons automatically truncate Word64
// values to Word32 range, no need to do that explicitly.
if (opcode == kX64Cmp32 || opcode == kX64Test32) {
while (left->opcode() == IrOpcode::kTruncateInt64ToInt32) {
left = left->InputAt(0);
}
while (right->opcode() == IrOpcode::kTruncateInt64ToInt32) {
right = right->InputAt(0);
}
}
opcode = TryNarrowOpcodeSize(opcode, left, right, cont); opcode = TryNarrowOpcodeSize(opcode, left, right, cont);
// If one of the two inputs is an immediate, make sure it's on the right, or // If one of the two inputs is an immediate, make sure it's on the right, or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment