Commit e16f83c7 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Int32Add/Sub/MulWithOverflow also zero extend to 64bit.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2338263004
Cr-Commit-Position: refs/heads/master@{#39437}
parent ce9dda2e
...@@ -1193,11 +1193,10 @@ void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { ...@@ -1193,11 +1193,10 @@ void InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
} }
} }
namespace {
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { bool ZeroExtendsWord32ToWord64(Node* node) {
X64OperandGenerator g(this); switch (node->opcode()) {
Node* value = node->InputAt(0);
switch (value->opcode()) {
case IrOpcode::kWord32And: case IrOpcode::kWord32And:
case IrOpcode::kWord32Or: case IrOpcode::kWord32Or:
case IrOpcode::kWord32Xor: case IrOpcode::kWord32Xor:
...@@ -1218,14 +1217,36 @@ void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { ...@@ -1218,14 +1217,36 @@ void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
case IrOpcode::kUint32LessThan: case IrOpcode::kUint32LessThan:
case IrOpcode::kUint32LessThanOrEqual: case IrOpcode::kUint32LessThanOrEqual:
case IrOpcode::kUint32Mod: case IrOpcode::kUint32Mod:
case IrOpcode::kUint32MulHigh: { case IrOpcode::kUint32MulHigh:
// These 32-bit operations implicitly zero-extend to 64-bit on x64, so the // These 32-bit operations implicitly zero-extend to 64-bit on x64, so the
// zero-extension is a no-op. // zero-extension is a no-op.
Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); return true;
return; case IrOpcode::kProjection: {
Node* const value = node->InputAt(0);
switch (value->opcode()) {
case IrOpcode::kInt32AddWithOverflow:
case IrOpcode::kInt32SubWithOverflow:
case IrOpcode::kInt32MulWithOverflow:
return true;
default:
return false;
}
} }
default: default:
break; return false;
}
}
} // namespace
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
X64OperandGenerator g(this);
Node* value = node->InputAt(0);
if (ZeroExtendsWord32ToWord64(value)) {
// These 32-bit operations implicitly zero-extend to 64-bit on x64, so the
// zero-extension is a no-op.
Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
return;
} }
Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value));
} }
......
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