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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 1120753010: MIPS: Fix long branch mode and FPU branches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed typo. Created 5 years, 7 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
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/constants-mips64.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 void MacroAssembler::Mfhc1(Register rt, FPURegister fs) { 1423 void MacroAssembler::Mfhc1(Register rt, FPURegister fs) {
1424 if (IsFp64Mode()) { 1424 if (IsFp64Mode()) {
1425 mfhc1(rt, fs); 1425 mfhc1(rt, fs);
1426 } else { 1426 } else {
1427 mfc1(rt, fs.high()); 1427 mfc1(rt, fs.high());
1428 } 1428 }
1429 } 1429 }
1430 1430
1431 1431
1432 void MacroAssembler::BranchFCommon(SecondaryField sizeField, Label* target, 1432 void MacroAssembler::BranchFCommon(SecondaryField sizeField, Label* target,
1433 Label* nan, Condition cc, FPURegister cmp1, 1433 Label* nan, Condition cond, FPURegister cmp1,
1434 FPURegister cmp2, BranchDelaySlot bd) { 1434 FPURegister cmp2, BranchDelaySlot bd) {
1435 BlockTrampolinePoolScope block_trampoline_pool(this); 1435 {
1436 if (cc == al) { 1436 BlockTrampolinePoolScope block_trampoline_pool(this);
1437 Branch(bd, target); 1437 if (cond == al) {
1438 return; 1438 Branch(bd, target);
1439 } 1439 return;
1440 }
1440 1441
1441 if (IsMipsArchVariant(kMips32r6)) { 1442 if (IsMipsArchVariant(kMips32r6)) {
1442 sizeField = sizeField == D ? L : W; 1443 sizeField = sizeField == D ? L : W;
1443 } 1444 }
1444 DCHECK(nan || target); 1445 DCHECK(nan || target);
1445 // Check for unordered (NaN) cases. 1446 // Check for unordered (NaN) cases.
1446 if (nan) { 1447 if (nan) {
1447 if (!IsMipsArchVariant(kMips32r6)) { 1448 bool long_branch =
1448 c(UN, D, cmp1, cmp2); 1449 nan->is_bound() ? is_near(nan) : is_trampoline_emitted();
1449 bc1t(nan); 1450 if (!IsMipsArchVariant(kMips32r6)) {
1450 } else { 1451 if (long_branch) {
1451 // Use kDoubleCompareReg for comparison result. It has to be unavailable 1452 Label skip;
1452 // to lithium register allocator. 1453 c(UN, D, cmp1, cmp2);
1453 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg)); 1454 bc1f(&skip);
1454 cmp(UN, L, kDoubleCompareReg, cmp1, cmp2); 1455 nop();
1455 bc1nez(nan, kDoubleCompareReg); 1456 Jr(nan, bd);
1457 bind(&skip);
1458 } else {
1459 c(UN, D, cmp1, cmp2);
1460 bc1t(nan);
1461 if (bd == PROTECT) {
1462 nop();
1463 }
1464 }
1465 } else {
1466 // Use kDoubleCompareReg for comparison result. It has to be unavailable
1467 // to lithium register allocator.
1468 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg));
1469 if (long_branch) {
1470 Label skip;
1471 cmp(UN, L, kDoubleCompareReg, cmp1, cmp2);
1472 bc1eqz(&skip, kDoubleCompareReg);
1473 nop();
1474 Jr(nan, bd);
1475 bind(&skip);
1476 } else {
1477 cmp(UN, L, kDoubleCompareReg, cmp1, cmp2);
1478 bc1nez(nan, kDoubleCompareReg);
1479 if (bd == PROTECT) {
1480 nop();
1481 }
1482 }
1483 }
1484 }
1485
1486 if (target) {
1487 bool long_branch =
1488 target->is_bound() ? is_near(target) : is_trampoline_emitted();
1489 if (long_branch) {
1490 Label skip;
1491 Condition neg_cond = NegateFpuCondition(cond);
1492 BranchShortF(sizeField, &skip, neg_cond, cmp1, cmp2, bd);
1493 Jr(target, bd);
1494 bind(&skip);
1495 } else {
1496 BranchShortF(sizeField, target, cond, cmp1, cmp2, bd);
1497 }
1456 } 1498 }
1457 } 1499 }
1500 }
1458 1501
1502 void MacroAssembler::BranchShortF(SecondaryField sizeField, Label* target,
1503 Condition cc, FPURegister cmp1,
1504 FPURegister cmp2, BranchDelaySlot bd) {
1459 if (!IsMipsArchVariant(kMips32r6)) { 1505 if (!IsMipsArchVariant(kMips32r6)) {
1506 BlockTrampolinePoolScope block_trampoline_pool(this);
1460 if (target) { 1507 if (target) {
1461 // Here NaN cases were either handled by this function or are assumed to 1508 // Here NaN cases were either handled by this function or are assumed to
1462 // have been handled by the caller. 1509 // have been handled by the caller.
1463 switch (cc) { 1510 switch (cc) {
1464 case lt: 1511 case lt:
1465 c(OLT, sizeField, cmp1, cmp2); 1512 c(OLT, sizeField, cmp1, cmp2);
1466 bc1t(target); 1513 bc1t(target);
1467 break; 1514 break;
1515 case ult:
1516 c(ULT, sizeField, cmp1, cmp2);
1517 bc1t(target);
1518 break;
1468 case gt: 1519 case gt:
1469 c(ULE, sizeField, cmp1, cmp2); 1520 c(ULE, sizeField, cmp1, cmp2);
1470 bc1f(target); 1521 bc1f(target);
1471 break; 1522 break;
1523 case ugt:
1524 c(OLE, sizeField, cmp1, cmp2);
1525 bc1f(target);
1526 break;
1472 case ge: 1527 case ge:
1473 c(ULT, sizeField, cmp1, cmp2); 1528 c(ULT, sizeField, cmp1, cmp2);
1474 bc1f(target); 1529 bc1f(target);
1475 break; 1530 break;
1531 case uge:
1532 c(OLT, sizeField, cmp1, cmp2);
1533 bc1f(target);
1534 break;
1476 case le: 1535 case le:
1477 c(OLE, sizeField, cmp1, cmp2); 1536 c(OLE, sizeField, cmp1, cmp2);
1478 bc1t(target); 1537 bc1t(target);
1479 break; 1538 break;
1539 case ule:
1540 c(ULE, sizeField, cmp1, cmp2);
1541 bc1t(target);
1542 break;
1480 case eq: 1543 case eq:
1481 c(EQ, sizeField, cmp1, cmp2); 1544 c(EQ, sizeField, cmp1, cmp2);
1482 bc1t(target); 1545 bc1t(target);
1483 break; 1546 break;
1484 case ueq: 1547 case ueq:
1485 c(UEQ, sizeField, cmp1, cmp2); 1548 c(UEQ, sizeField, cmp1, cmp2);
1486 bc1t(target); 1549 bc1t(target);
1487 break; 1550 break;
1488 case ne: 1551 case ne: // Unordered or not equal.
1489 c(EQ, sizeField, cmp1, cmp2); 1552 c(EQ, sizeField, cmp1, cmp2);
1490 bc1f(target); 1553 bc1f(target);
1491 break; 1554 break;
1492 case nue: 1555 case ogl:
1493 c(UEQ, sizeField, cmp1, cmp2); 1556 c(UEQ, sizeField, cmp1, cmp2);
1494 bc1f(target); 1557 bc1f(target);
1495 break; 1558 break;
1496 default: 1559 default:
1497 CHECK(0); 1560 CHECK(0);
1498 } 1561 }
1499 } 1562 }
1500 } else { 1563 } else {
1564 BlockTrampolinePoolScope block_trampoline_pool(this);
1501 if (target) { 1565 if (target) {
1502 // Here NaN cases were either handled by this function or are assumed to 1566 // Here NaN cases were either handled by this function or are assumed to
1503 // have been handled by the caller. 1567 // have been handled by the caller.
1504 // Unsigned conditions are treated as their signed counterpart. 1568 // Unsigned conditions are treated as their signed counterpart.
1505 // Use kDoubleCompareReg for comparison result, it is 1569 // Use kDoubleCompareReg for comparison result, it is
1506 // valid in fp64 (FR = 1) mode which is implied for mips32r6. 1570 // valid in fp64 (FR = 1) mode which is implied for mips32r6.
1507 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg)); 1571 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg));
1508 switch (cc) { 1572 switch (cc) {
1509 case lt: 1573 case lt:
1510 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2); 1574 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1511 bc1nez(target, kDoubleCompareReg); 1575 bc1nez(target, kDoubleCompareReg);
1512 break; 1576 break;
1577 case ult:
1578 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1579 bc1nez(target, kDoubleCompareReg);
1580 break;
1513 case gt: 1581 case gt:
1514 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2); 1582 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1515 bc1eqz(target, kDoubleCompareReg); 1583 bc1eqz(target, kDoubleCompareReg);
1516 break; 1584 break;
1585 case ugt:
1586 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1587 bc1eqz(target, kDoubleCompareReg);
1588 break;
1517 case ge: 1589 case ge:
1518 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2); 1590 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1519 bc1eqz(target, kDoubleCompareReg); 1591 bc1eqz(target, kDoubleCompareReg);
1520 break; 1592 break;
1593 case uge:
1594 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1595 bc1eqz(target, kDoubleCompareReg);
1596 break;
1521 case le: 1597 case le:
1522 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2); 1598 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1523 bc1nez(target, kDoubleCompareReg); 1599 bc1nez(target, kDoubleCompareReg);
1524 break; 1600 break;
1601 case ule:
1602 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1603 bc1nez(target, kDoubleCompareReg);
1604 break;
1525 case eq: 1605 case eq:
1526 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2); 1606 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1527 bc1nez(target, kDoubleCompareReg); 1607 bc1nez(target, kDoubleCompareReg);
1528 break; 1608 break;
1529 case ueq: 1609 case ueq:
1530 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2); 1610 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1531 bc1nez(target, kDoubleCompareReg); 1611 bc1nez(target, kDoubleCompareReg);
1532 break; 1612 break;
1533 case ne: 1613 case ne:
1534 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2); 1614 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1535 bc1eqz(target, kDoubleCompareReg); 1615 bc1eqz(target, kDoubleCompareReg);
1536 break; 1616 break;
1537 case nue: 1617 case ogl:
1538 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2); 1618 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1539 bc1eqz(target, kDoubleCompareReg); 1619 bc1eqz(target, kDoubleCompareReg);
1540 break; 1620 break;
1541 default: 1621 default:
1542 CHECK(0); 1622 CHECK(0);
1543 } 1623 }
1544 } 1624 }
1545 } 1625 }
1546
1547 if (bd == PROTECT) { 1626 if (bd == PROTECT) {
1548 nop(); 1627 nop();
1549 } 1628 }
1550 } 1629 }
1551 1630
1552 1631
1553 void MacroAssembler::FmoveLow(FPURegister dst, Register src_low) { 1632 void MacroAssembler::FmoveLow(FPURegister dst, Register src_low) {
1554 if (IsFp64Mode()) { 1633 if (IsFp64Mode()) {
1555 DCHECK(!src_low.is(at)); 1634 DCHECK(!src_low.is(at));
1556 mfhc1(at, dst); 1635 mfhc1(at, dst);
(...skipping 4488 matching lines...) Expand 10 before | Expand all | Expand 10 after
6045 } 6124 }
6046 if (mag.shift > 0) sra(result, result, mag.shift); 6125 if (mag.shift > 0) sra(result, result, mag.shift);
6047 srl(at, dividend, 31); 6126 srl(at, dividend, 31);
6048 Addu(result, result, Operand(at)); 6127 Addu(result, result, Operand(at));
6049 } 6128 }
6050 6129
6051 6130
6052 } } // namespace v8::internal 6131 } } // namespace v8::internal
6053 6132
6054 #endif // V8_TARGET_ARCH_MIPS 6133 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698