Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: src/compiler/mips/code-generator-mips.cc

Issue 1047213002: Finish 'MIPS: [turbofan] Add backend support for float32 operations.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix #1 Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | test/cctest/test-assembler-mips.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73ed10a3562e2cec35ad9bfea2b6a2dbe204b0c1..f9068644bb31c231718fac4589ca448e53678d63 100644
--- a/src/compiler/mips/code-generator-mips.cc
+++ b/src/compiler/mips/code-generator-mips.cc
@@ -787,6 +787,38 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
UNIMPLEMENTED();
+static bool convertCondition(FlagsCondition condition, Condition& cc,
+ bool& acceptNaN) {
+ acceptNaN = false;
+ 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;
+ return true;
+ case kUnsignedLessThanOrEqual:
+ cc = le;
+ return true;
+ case kUnsignedGreaterThan:
+ cc = gt;
+ acceptNaN = true;
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+
// Assembles branches after an instruction.
void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
MipsOperandConverter i(this, instr);
@@ -823,68 +855,24 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
} else if (instr->arch_opcode() == kMipsCmpS) {
// TODO(dusmil) optimize unordered checks to use fewer instructions
// even if we have to unfold BranchF macro.
- Label* nan = flabel;
- switch (branch->condition) {
- case kEqual:
- cc = eq;
- break;
- case kNotEqual:
- cc = ne;
- nan = tlabel;
- break;
- case kUnsignedLessThan:
- cc = lt;
- break;
- case kUnsignedGreaterThanOrEqual:
- cc = ge;
- nan = tlabel;
- break;
- case kUnsignedLessThanOrEqual:
- cc = le;
- break;
- case kUnsignedGreaterThan:
- cc = gt;
- nan = tlabel;
- break;
- default:
- UNSUPPORTED_COND(kMipsCmpS, branch->condition);
- break;
+ bool acceptNaN = false;
+ if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ UNSUPPORTED_COND(kMips64CmpS, branch->condition);
}
- __ BranchFS(tlabel, nan, cc, i.InputDoubleRegister(0),
- i.InputDoubleRegister(1));
+ Label* nan = acceptNaN ? tlabel : flabel;
+ __ BranchFS(tlabel, nan, 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.
- Label* nan = flabel;
- switch (branch->condition) {
- case kEqual:
- cc = eq;
- break;
- case kNotEqual:
- cc = ne;
- nan = tlabel;
- break;
- case kUnsignedLessThan:
- cc = lt;
- break;
- case kUnsignedGreaterThanOrEqual:
- cc = ge;
- nan = tlabel;
- break;
- case kUnsignedLessThanOrEqual:
- cc = le;
- break;
- case kUnsignedGreaterThan:
- cc = gt;
- nan = tlabel;
- break;
- default:
- UNSUPPORTED_COND(kMipsCmpD, branch->condition);
- break;
+ bool acceptNaN = false;
+ if (!convertCondition(branch->condition, cc, acceptNaN)) {
+ UNSUPPORTED_COND(kMips64CmpD, branch->condition);
}
+ Label* nan = acceptNaN ? tlabel : flabel;
__ BranchF(tlabel, nan, cc, i.InputDoubleRegister(0),
i.InputDoubleRegister(1));
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | test/cctest/test-assembler-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698