Reviewers: Benedikt Meurer, titzer, paul.l..., akos.palfi.imgtec,
balazs.kilvady,
Description:
MIPS [turbofan]: Improve fpu branch assembling for unordered conditions.
TEST=
BUG=
Please review this at https://codereview.chromium.org/1124023005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+14, -40 lines):
M src/compiler/mips/code-generator-mips.cc
M src/compiler/mips64/code-generator-mips64.cc
Index: src/compiler/mips/code-generator-mips.cc
diff --git a/src/compiler/mips/code-generator-mips.cc
b/src/compiler/mips/code-generator-mips.cc
index
ac0d2e2fe8623d998e0e8fe8624a00692638daaf..0e45172a5b9919496dbfd927adfbaff4fd60d05c
100644
--- a/src/compiler/mips/code-generator-mips.cc
+++ b/src/compiler/mips/code-generator-mips.cc
@@ -829,30 +829,25 @@ void
CodeGenerator::AssembleArchInstruction(Instruction* instr) {
out << "Unsupported " << #opcode << " condition: \"" << condition
<< "\""; \
UNIMPLEMENTED();
-static bool convertCondition(FlagsCondition condition, Condition& cc,
- bool& acceptNaN) {
- acceptNaN = false;
+static bool convertCondition(FlagsCondition condition, Condition& cc) {
switch (condition) {
case kEqual:
cc = eq;
return true;
case kNotEqual:
cc = ne;
- acceptNaN = true;
return true;
case kUnsignedLessThan:
cc = lt;
return true;
case kUnsignedGreaterThanOrEqual:
- cc = ge;
- acceptNaN = true;
+ cc = uge;
return true;
case kUnsignedLessThanOrEqual:
cc = le;
return true;
case kUnsignedGreaterThan:
- cc = gt;
- acceptNaN = true;
+ cc = ugt;
return true;
default:
break;
@@ -895,27 +890,19 @@ void CodeGenerator::AssembleArchBranch(Instruction*
instr, BranchInfo* branch) {
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMipsCmpS) {
- // TODO(dusmil) optimize unordered checks to use fewer instructions
- // even if we have to unfold BranchF macro.
- bool acceptNaN = false;
- if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ if (!convertCondition(branch->condition, cc)) {
UNSUPPORTED_COND(kMips64CmpS, branch->condition);
}
- Label* nan = acceptNaN ? tlabel : flabel;
- __ BranchF32(tlabel, nan, cc, i.InputSingleRegister(0),
+ __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0),
i.InputSingleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMipsCmpD) {
- // TODO(dusmil) optimize unordered checks to use fewer instructions
- // even if we have to unfold BranchF macro.
- bool acceptNaN = false;
- if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ if (!convertCondition(branch->condition, cc)) {
UNSUPPORTED_COND(kMips64CmpD, branch->condition);
}
- Label* nan = acceptNaN ? tlabel : flabel;
- __ BranchF64(tlabel, nan, cc, i.InputDoubleRegister(0),
+ __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
Index: src/compiler/mips64/code-generator-mips64.cc
diff --git a/src/compiler/mips64/code-generator-mips64.cc
b/src/compiler/mips64/code-generator-mips64.cc
index
6aa735d244f0abe8a42954ab65870fe82db0ea08..5fcf95befedeb36381363a88c9b9fbde20099de0
100644
--- a/src/compiler/mips64/code-generator-mips64.cc
+++ b/src/compiler/mips64/code-generator-mips64.cc
@@ -897,30 +897,25 @@ void
CodeGenerator::AssembleArchInstruction(Instruction* instr) {
out << "Unsupported " << #opcode << " condition: \"" << condition
<< "\""; \
UNIMPLEMENTED();
-static bool convertCondition(FlagsCondition condition, Condition& cc,
- bool& acceptNaN) {
- acceptNaN = false;
+static bool convertCondition(FlagsCondition condition, Condition& cc) {
switch (condition) {
case kEqual:
cc = eq;
return true;
case kNotEqual:
cc = ne;
- acceptNaN = true;
return true;
case kUnsignedLessThan:
cc = lt;
return true;
case kUnsignedGreaterThanOrEqual:
- cc = ge;
- acceptNaN = true;
+ cc = uge;
return true;
case kUnsignedLessThanOrEqual:
cc = le;
return true;
case kUnsignedGreaterThan:
- cc = gt;
- acceptNaN = true;
+ cc = ugt;
return true;
default:
break;
@@ -960,27 +955,19 @@ void CodeGenerator::AssembleArchBranch(Instruction*
instr, BranchInfo* branch) {
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMips64CmpS) {
- // TODO(dusmil) optimize unordered checks to use fewer instructions
- // even if we have to unfold BranchF macro.
- bool acceptNaN = false;
- if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ if (!convertCondition(branch->condition, cc)) {
UNSUPPORTED_COND(kMips64CmpS, branch->condition);
}
- Label* nan = acceptNaN ? tlabel : flabel;
- __ BranchF32(tlabel, nan, cc, i.InputSingleRegister(0),
+ __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0),
i.InputSingleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
} else if (instr->arch_opcode() == kMips64CmpD) {
- // TODO(dusmil) optimize unordered checks to use less instructions
- // even if we have to unfold BranchF macro.
- bool acceptNaN = false;
- if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ if (!convertCondition(branch->condition, cc)) {
UNSUPPORTED_COND(kMips64CmpD, branch->condition);
}
- Label* nan = acceptNaN ? tlabel : flabel;
- __ BranchF64(tlabel, nan, cc, i.InputDoubleRegister(0),
+ __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.