Commit ecd166d5 authored by ivica.bogosavljevic's avatar ivica.bogosavljevic Committed by Commit bot

MIPS[64]: Use immediates for kMips[64]Tst in code-generator-mips[64].cc

The patch optimizes the generation of code for kMips[64]Tst in code-generator-mips[64].cc.
We allow usage of immediate for kMips[64]Tst in VisitWordCompare in order to remove
an unnecessary immediate load to register. This fix is motivated by Richards benchark
in Octane benchmark suite, since it is used a lot there.

BUG=

Review-Url: https://codereview.chromium.org/2503833002
Cr-Commit-Position: refs/heads/master@{#40992}
parent 4cf8e2f1
......@@ -1453,6 +1453,10 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
// Match immediates on left or right side of comparison.
if (g.CanBeImmediate(right, opcode)) {
if (opcode == kMipsTst) {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right),
cont);
} else {
switch (cont->condition()) {
case kEqual:
case kNotEqual:
......@@ -1475,8 +1479,13 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
VisitCompare(selector, opcode, g.UseRegister(left),
g.UseRegister(right), cont);
}
}
} else if (g.CanBeImmediate(left, opcode)) {
if (!commutative) cont->Commute();
if (opcode == kMipsTst) {
VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left),
cont);
} else {
switch (cont->condition()) {
case kEqual:
case kNotEqual:
......@@ -1499,6 +1508,7 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
VisitCompare(selector, opcode, g.UseRegister(right),
g.UseRegister(left), cont);
}
}
} else {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right),
cont);
......
......@@ -1968,6 +1968,10 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
// Match immediates on left or right side of comparison.
if (g.CanBeImmediate(right, opcode)) {
if (opcode == kMips64Tst) {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right),
cont);
} else {
switch (cont->condition()) {
case kEqual:
case kNotEqual:
......@@ -1990,8 +1994,13 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
VisitCompare(selector, opcode, g.UseRegister(left),
g.UseRegister(right), cont);
}
}
} else if (g.CanBeImmediate(left, opcode)) {
if (!commutative) cont->Commute();
if (opcode == kMips64Tst) {
VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left),
cont);
} else {
switch (cont->condition()) {
case kEqual:
case kNotEqual:
......@@ -2014,6 +2023,7 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
VisitCompare(selector, opcode, g.UseRegister(right),
g.UseRegister(left), cont);
}
}
} else {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right),
cont);
......
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