Commit 1fbe587b authored by dusan.milosavljevic's avatar dusan.milosavljevic Committed by Commit bot

MIPS [turbofan]: Improve fpu branch assembling for unordered conditions.

TEST=
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28315}
parent 225f9bf2
...@@ -829,30 +829,25 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -829,30 +829,25 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
UNIMPLEMENTED(); UNIMPLEMENTED();
static bool convertCondition(FlagsCondition condition, Condition& cc, static bool convertCondition(FlagsCondition condition, Condition& cc) {
bool& acceptNaN) {
acceptNaN = false;
switch (condition) { switch (condition) {
case kEqual: case kEqual:
cc = eq; cc = eq;
return true; return true;
case kNotEqual: case kNotEqual:
cc = ne; cc = ne;
acceptNaN = true;
return true; return true;
case kUnsignedLessThan: case kUnsignedLessThan:
cc = lt; cc = lt;
return true; return true;
case kUnsignedGreaterThanOrEqual: case kUnsignedGreaterThanOrEqual:
cc = ge; cc = uge;
acceptNaN = true;
return true; return true;
case kUnsignedLessThanOrEqual: case kUnsignedLessThanOrEqual:
cc = le; cc = le;
return true; return true;
case kUnsignedGreaterThan: case kUnsignedGreaterThan:
cc = gt; cc = ugt;
acceptNaN = true;
return true; return true;
default: default:
break; break;
...@@ -895,27 +890,19 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { ...@@ -895,27 +890,19 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMipsCmpS) { } else if (instr->arch_opcode() == kMipsCmpS) {
// TODO(dusmil) optimize unordered checks to use fewer instructions if (!convertCondition(branch->condition, cc)) {
// even if we have to unfold BranchF macro.
bool acceptNaN = false;
if (!convertCondition(branch->condition, cc, acceptNaN)) {
UNSUPPORTED_COND(kMips64CmpS, branch->condition); UNSUPPORTED_COND(kMips64CmpS, branch->condition);
} }
Label* nan = acceptNaN ? tlabel : flabel; __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0),
__ BranchF32(tlabel, nan, cc, i.InputSingleRegister(0),
i.InputSingleRegister(1)); i.InputSingleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMipsCmpD) { } else if (instr->arch_opcode() == kMipsCmpD) {
// TODO(dusmil) optimize unordered checks to use fewer instructions if (!convertCondition(branch->condition, cc)) {
// even if we have to unfold BranchF macro.
bool acceptNaN = false;
if (!convertCondition(branch->condition, cc, acceptNaN)) {
UNSUPPORTED_COND(kMips64CmpD, branch->condition); UNSUPPORTED_COND(kMips64CmpD, branch->condition);
} }
Label* nan = acceptNaN ? tlabel : flabel; __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0),
__ BranchF64(tlabel, nan, cc, i.InputDoubleRegister(0),
i.InputDoubleRegister(1)); i.InputDoubleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
......
...@@ -897,30 +897,25 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -897,30 +897,25 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
UNIMPLEMENTED(); UNIMPLEMENTED();
static bool convertCondition(FlagsCondition condition, Condition& cc, static bool convertCondition(FlagsCondition condition, Condition& cc) {
bool& acceptNaN) {
acceptNaN = false;
switch (condition) { switch (condition) {
case kEqual: case kEqual:
cc = eq; cc = eq;
return true; return true;
case kNotEqual: case kNotEqual:
cc = ne; cc = ne;
acceptNaN = true;
return true; return true;
case kUnsignedLessThan: case kUnsignedLessThan:
cc = lt; cc = lt;
return true; return true;
case kUnsignedGreaterThanOrEqual: case kUnsignedGreaterThanOrEqual:
cc = ge; cc = uge;
acceptNaN = true;
return true; return true;
case kUnsignedLessThanOrEqual: case kUnsignedLessThanOrEqual:
cc = le; cc = le;
return true; return true;
case kUnsignedGreaterThan: case kUnsignedGreaterThan:
cc = gt; cc = ugt;
acceptNaN = true;
return true; return true;
default: default:
break; break;
...@@ -960,27 +955,19 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { ...@@ -960,27 +955,19 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMips64CmpS) { } else if (instr->arch_opcode() == kMips64CmpS) {
// TODO(dusmil) optimize unordered checks to use fewer instructions if (!convertCondition(branch->condition, cc)) {
// even if we have to unfold BranchF macro.
bool acceptNaN = false;
if (!convertCondition(branch->condition, cc, acceptNaN)) {
UNSUPPORTED_COND(kMips64CmpS, branch->condition); UNSUPPORTED_COND(kMips64CmpS, branch->condition);
} }
Label* nan = acceptNaN ? tlabel : flabel; __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0),
__ BranchF32(tlabel, nan, cc, i.InputSingleRegister(0),
i.InputSingleRegister(1)); i.InputSingleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMips64CmpD) { } else if (instr->arch_opcode() == kMips64CmpD) {
// TODO(dusmil) optimize unordered checks to use less instructions if (!convertCondition(branch->condition, cc)) {
// even if we have to unfold BranchF macro.
bool acceptNaN = false;
if (!convertCondition(branch->condition, cc, acceptNaN)) {
UNSUPPORTED_COND(kMips64CmpD, branch->condition); UNSUPPORTED_COND(kMips64CmpD, branch->condition);
} }
Label* nan = acceptNaN ? tlabel : flabel; __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0),
__ BranchF64(tlabel, nan, cc, i.InputDoubleRegister(0),
i.InputDoubleRegister(1)); i.InputDoubleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
......
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