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

Side by Side Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 2534413002: MIPS: Improve Float(32|64)(Max|Min). (Closed)
Patch Set: MIPS: Improve Float(32|64)(Max|Min). Created 4 years 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 unified diff | Download patch
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 private: 263 private:
264 Register const object_; 264 Register const object_;
265 Register const index_; 265 Register const index_;
266 Register const value_; 266 Register const value_;
267 Register const scratch0_; 267 Register const scratch0_;
268 Register const scratch1_; 268 Register const scratch1_;
269 RecordWriteMode const mode_; 269 RecordWriteMode const mode_;
270 bool must_save_lr_; 270 bool must_save_lr_;
271 }; 271 };
272 272
273 #define CREATE_OOL_CLASS(ool_name, masm_ool_name, T) \
274 class ool_name final : public OutOfLineCode { \
275 public: \
276 ool_name(CodeGenerator* gen, T dst, T src1, T src2) \
277 : OutOfLineCode(gen), dst_(dst), src1_(src1), src2_(src2) {} \
278 \
279 void Generate() final { __ masm_ool_name(dst_, src1_, src2_); } \
280 \
281 private: \
282 T const dst_; \
283 T const src1_; \
284 T const src2_; \
285 }
286
287 CREATE_OOL_CLASS(OutOfLineFloat32Max, Float32MaxOutOfLine, FPURegister);
288 CREATE_OOL_CLASS(OutOfLineFloat32Min, Float32MinOutOfLine, FPURegister);
289 CREATE_OOL_CLASS(OutOfLineFloat64Max, Float64MaxOutOfLine, FPURegister);
290 CREATE_OOL_CLASS(OutOfLineFloat64Min, Float64MinOutOfLine, FPURegister);
291
292 #undef CREATE_OOL_CLASS
273 293
274 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { 294 Condition FlagsConditionToConditionCmp(FlagsCondition condition) {
275 switch (condition) { 295 switch (condition) {
276 case kEqual: 296 case kEqual:
277 return eq; 297 return eq;
278 case kNotEqual: 298 case kNotEqual:
279 return ne; 299 return ne;
280 case kSignedLessThan: 300 case kSignedLessThan:
281 return lt; 301 return lt;
282 case kSignedGreaterThanOrEqual: 302 case kSignedGreaterThanOrEqual:
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 } 1443 }
1424 case kMips64Float64RoundTiesEven: { 1444 case kMips64Float64RoundTiesEven: {
1425 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round); 1445 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round);
1426 break; 1446 break;
1427 } 1447 }
1428 case kMips64Float32RoundTiesEven: { 1448 case kMips64Float32RoundTiesEven: {
1429 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round); 1449 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round);
1430 break; 1450 break;
1431 } 1451 }
1432 case kMips64Float32Max: { 1452 case kMips64Float32Max: {
1433 Label compare_nan, done_compare; 1453 FPURegister dst = i.OutputSingleRegister();
1434 __ MaxNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0), 1454 FPURegister src1 = i.InputSingleRegister(0);
1435 i.InputSingleRegister(1), &compare_nan); 1455 FPURegister src2 = i.InputSingleRegister(1);
1436 __ Branch(&done_compare); 1456 if (src1.is(src2)) {
1437 __ bind(&compare_nan); 1457 __ Move_s(dst, src1);
1438 __ Move(i.OutputSingleRegister(), 1458 } else {
1439 std::numeric_limits<float>::quiet_NaN()); 1459 auto ool = new (zone()) OutOfLineFloat32Max(this, dst, src1, src2);
1440 __ bind(&done_compare); 1460 __ Float32Max(dst, src1, src2, ool->entry());
1461 __ bind(ool->exit());
1462 }
1441 break; 1463 break;
1442 } 1464 }
1443 case kMips64Float64Max: { 1465 case kMips64Float64Max: {
1444 Label compare_nan, done_compare; 1466 FPURegister dst = i.OutputDoubleRegister();
1445 __ MaxNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1467 FPURegister src1 = i.InputDoubleRegister(0);
1446 i.InputDoubleRegister(1), &compare_nan); 1468 FPURegister src2 = i.InputDoubleRegister(1);
1447 __ Branch(&done_compare); 1469 if (src1.is(src2)) {
1448 __ bind(&compare_nan); 1470 __ Move_d(dst, src1);
1449 __ Move(i.OutputDoubleRegister(), 1471 } else {
1450 std::numeric_limits<double>::quiet_NaN()); 1472 auto ool = new (zone()) OutOfLineFloat64Max(this, dst, src1, src2);
1451 __ bind(&done_compare); 1473 __ Float64Max(dst, src1, src2, ool->entry());
1474 __ bind(ool->exit());
1475 }
1452 break; 1476 break;
1453 } 1477 }
1454 case kMips64Float32Min: { 1478 case kMips64Float32Min: {
1455 Label compare_nan, done_compare; 1479 FPURegister dst = i.OutputSingleRegister();
1456 __ MinNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0), 1480 FPURegister src1 = i.InputSingleRegister(0);
1457 i.InputSingleRegister(1), &compare_nan); 1481 FPURegister src2 = i.InputSingleRegister(1);
1458 __ Branch(&done_compare); 1482 if (src1.is(src2)) {
1459 __ bind(&compare_nan); 1483 __ Move_s(dst, src1);
1460 __ Move(i.OutputSingleRegister(), 1484 } else {
1461 std::numeric_limits<float>::quiet_NaN()); 1485 auto ool = new (zone()) OutOfLineFloat32Min(this, dst, src1, src2);
1462 __ bind(&done_compare); 1486 __ Float32Min(dst, src1, src2, ool->entry());
1487 __ bind(ool->exit());
1488 }
1463 break; 1489 break;
1464 } 1490 }
1465 case kMips64Float64Min: { 1491 case kMips64Float64Min: {
1466 Label compare_nan, done_compare; 1492 FPURegister dst = i.OutputDoubleRegister();
1467 __ MinNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1493 FPURegister src1 = i.InputDoubleRegister(0);
1468 i.InputDoubleRegister(1), &compare_nan); 1494 FPURegister src2 = i.InputDoubleRegister(1);
1469 __ Branch(&done_compare); 1495 if (src1.is(src2)) {
1470 __ bind(&compare_nan); 1496 __ Move_d(dst, src1);
1471 __ Move(i.OutputDoubleRegister(), 1497 } else {
1472 std::numeric_limits<double>::quiet_NaN()); 1498 auto ool = new (zone()) OutOfLineFloat64Min(this, dst, src1, src2);
1473 __ bind(&done_compare); 1499 __ Float64Min(dst, src1, src2, ool->entry());
1500 __ bind(ool->exit());
1501 }
1474 break; 1502 break;
1475 } 1503 }
1476 case kMips64Float64SilenceNaN: 1504 case kMips64Float64SilenceNaN:
1477 __ FPUCanonicalizeNaN(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 1505 __ FPUCanonicalizeNaN(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1478 break; 1506 break;
1479 case kMips64CvtSD: 1507 case kMips64CvtSD:
1480 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0)); 1508 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0));
1481 break; 1509 break;
1482 case kMips64CvtDS: 1510 case kMips64CvtDS:
1483 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0)); 1511 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0));
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 padding_size -= v8::internal::Assembler::kInstrSize; 2610 padding_size -= v8::internal::Assembler::kInstrSize;
2583 } 2611 }
2584 } 2612 }
2585 } 2613 }
2586 2614
2587 #undef __ 2615 #undef __
2588 2616
2589 } // namespace compiler 2617 } // namespace compiler
2590 } // namespace internal 2618 } // namespace internal
2591 } // namespace v8 2619 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698