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

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

Issue 2170343002: [turbofan] Change Float64Max/Float64Min to JavaScript semantics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips/mips64 ports. Created 4 years, 5 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 unified diff | Download patch
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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 #include "src/compiler/code-generator.h" 6 #include "src/compiler/code-generator.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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 } 1384 }
1385 case kMips64Float64RoundTiesEven: { 1385 case kMips64Float64RoundTiesEven: {
1386 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round); 1386 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round);
1387 break; 1387 break;
1388 } 1388 }
1389 case kMips64Float32RoundTiesEven: { 1389 case kMips64Float32RoundTiesEven: {
1390 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round); 1390 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round);
1391 break; 1391 break;
1392 } 1392 }
1393 case kMips64Float64Max: { 1393 case kMips64Float64Max: {
1394 // (b < a) ? a : b 1394 Label compare_nan, done_compare;
1395 if (kArchVariant == kMips64r6) { 1395 __ MaxNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1396 __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1), 1396 i.InputDoubleRegister(1), &compare_nan);
1397 i.InputDoubleRegister(0)); 1397 __ Branch(&done_compare);
1398 __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1), 1398 __ bind(&compare_nan);
1399 i.InputDoubleRegister(0)); 1399 __ Move(i.OutputDoubleRegister(),
1400 } else { 1400 std::numeric_limits<double>::quiet_NaN());
1401 __ c_d(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 1401 __ bind(&done_compare);
1402 // Left operand is result, passthrough if false.
1403 __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1404 }
1405 break; 1402 break;
1406 } 1403 }
1407 case kMips64Float64Min: { 1404 case kMips64Float64Min: {
1408 // (a < b) ? a : b 1405 Label compare_nan, done_compare;
1409 if (kArchVariant == kMips64r6) { 1406 __ MinNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1410 __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1407 i.InputDoubleRegister(1), &compare_nan);
1411 i.InputDoubleRegister(1)); 1408 __ Branch(&done_compare);
1412 __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1), 1409 __ bind(&compare_nan);
1413 i.InputDoubleRegister(0)); 1410 __ Move(i.OutputDoubleRegister(),
1414 } else { 1411 std::numeric_limits<double>::quiet_NaN());
1415 __ c_d(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0)); 1412 __ bind(&done_compare);
1416 // Right operand is result, passthrough if false.
1417 __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1418 }
1419 break; 1413 break;
1420 } 1414 }
1421 case kMips64Float64SilenceNaN: 1415 case kMips64Float64SilenceNaN:
1422 __ FPUCanonicalizeNaN(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 1416 __ FPUCanonicalizeNaN(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1423 break; 1417 break;
1424 case kMips64Float32Max: {
1425 // (b < a) ? a : b
1426 if (kArchVariant == kMips64r6) {
1427 __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1),
1428 i.InputDoubleRegister(0));
1429 __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
1430 i.InputDoubleRegister(0));
1431 } else {
1432 __ c_s(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1433 // Left operand is result, passthrough if false.
1434 __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1435 }
1436 break;
1437 }
1438 case kMips64Float32Min: {
1439 // (a < b) ? a : b
1440 if (kArchVariant == kMips64r6) {
1441 __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1442 i.InputDoubleRegister(1));
1443 __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
1444 i.InputDoubleRegister(0));
1445 } else {
1446 __ c_s(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0));
1447 // Right operand is result, passthrough if false.
1448 __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1449 }
1450 break;
1451 }
1452 case kMips64CvtSD: 1418 case kMips64CvtSD:
1453 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0)); 1419 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0));
1454 break; 1420 break;
1455 case kMips64CvtDS: 1421 case kMips64CvtDS:
1456 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0)); 1422 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0));
1457 break; 1423 break;
1458 case kMips64CvtDW: { 1424 case kMips64CvtDW: {
1459 FPURegister scratch = kScratchDoubleReg; 1425 FPURegister scratch = kScratchDoubleReg;
1460 __ mtc1(i.InputRegister(0), scratch); 1426 __ mtc1(i.InputRegister(0), scratch);
1461 __ cvt_d_w(i.OutputDoubleRegister(), scratch); 1427 __ cvt_d_w(i.OutputDoubleRegister(), scratch);
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 padding_size -= v8::internal::Assembler::kInstrSize; 2417 padding_size -= v8::internal::Assembler::kInstrSize;
2452 } 2418 }
2453 } 2419 }
2454 } 2420 }
2455 2421
2456 #undef __ 2422 #undef __
2457 2423
2458 } // namespace compiler 2424 } // namespace compiler
2459 } // namespace internal 2425 } // namespace internal
2460 } // namespace v8 2426 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | src/compiler/mips64/instruction-codes-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698