Commit 9da259fb authored by bmeurer's avatar bmeurer Committed by Commit bot

[x86] Use better left operand heuristic for Float64Add and Float64Mul.

R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/958583003

Cr-Commit-Position: refs/heads/master@{#26849}
parent 49b112e1
......@@ -634,12 +634,15 @@ void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
void InstructionSelector::VisitFloat64Add(Node* node) {
IA32OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (g.CanBeBetterLeftOperand(right)) std::swap(left, right);
if (IsSupported(AVX)) {
Emit(kAVXFloat64Add, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kAVXFloat64Add, g.DefineAsRegister(node), g.UseRegister(left),
g.Use(right));
} else {
Emit(kSSEFloat64Add, g.DefineSameAsFirst(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), g.UseRegister(left),
g.Use(right));
}
}
......@@ -658,12 +661,15 @@ void InstructionSelector::VisitFloat64Sub(Node* node) {
void InstructionSelector::VisitFloat64Mul(Node* node) {
IA32OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (g.CanBeBetterLeftOperand(right)) std::swap(left, right);
if (IsSupported(AVX)) {
Emit(kAVXFloat64Mul, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kAVXFloat64Mul, g.DefineAsRegister(node), g.UseRegister(left),
g.Use(right));
} else {
Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), g.UseRegister(left),
g.Use(right));
}
}
......
......@@ -832,12 +832,15 @@ void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
void InstructionSelector::VisitFloat64Add(Node* node) {
X64OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (g.CanBeBetterLeftOperand(right)) std::swap(left, right);
if (IsSupported(AVX)) {
Emit(kAVXFloat64Add, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kAVXFloat64Add, g.DefineAsRegister(node), g.UseRegister(left),
g.Use(right));
} else {
Emit(kSSEFloat64Add, g.DefineSameAsFirst(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), g.UseRegister(left),
g.Use(right));
}
}
......@@ -856,12 +859,15 @@ void InstructionSelector::VisitFloat64Sub(Node* node) {
void InstructionSelector::VisitFloat64Mul(Node* node) {
X64OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (g.CanBeBetterLeftOperand(right)) std::swap(left, right);
if (IsSupported(AVX)) {
Emit(kAVXFloat64Mul, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kAVXFloat64Mul, g.DefineAsRegister(node), g.UseRegister(left),
g.Use(right));
} else {
Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node),
g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), g.UseRegister(left),
g.Use(right));
}
}
......
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