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

Side by Side Diff: src/mips64/macro-assembler-mips64.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/mips64/macro-assembler-mips64.h ('k') | no next file » | 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_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 } else { 1622 } else {
1623 // Can not change source regs's value. 1623 // Can not change source regs's value.
1624 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch)); 1624 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch));
1625 mul_d(scratch, fs, ft); 1625 mul_d(scratch, fs, ft);
1626 add_d(fd, fr, scratch); 1626 add_d(fd, fr, scratch);
1627 } 1627 }
1628 } 1628 }
1629 1629
1630 1630
1631 void MacroAssembler::BranchFCommon(SecondaryField sizeField, Label* target, 1631 void MacroAssembler::BranchFCommon(SecondaryField sizeField, Label* target,
1632 Label* nan, Condition cc, FPURegister cmp1, 1632 Label* nan, Condition cond, FPURegister cmp1,
1633 FPURegister cmp2, BranchDelaySlot bd) { 1633 FPURegister cmp2, BranchDelaySlot bd) {
1634 BlockTrampolinePoolScope block_trampoline_pool(this); 1634 BlockTrampolinePoolScope block_trampoline_pool(this);
1635 if (cc == al) { 1635 if (cond == al) {
1636 Branch(bd, target); 1636 Branch(bd, target);
1637 return; 1637 return;
1638 } 1638 }
1639 1639
1640 if (kArchVariant == kMips64r6) { 1640 if (kArchVariant == kMips64r6) {
1641 sizeField = sizeField == D ? L : W; 1641 sizeField = sizeField == D ? L : W;
1642 } 1642 }
1643
1643 DCHECK(nan || target); 1644 DCHECK(nan || target);
1644 // Check for unordered (NaN) cases. 1645 // Check for unordered (NaN) cases.
1645 if (nan) { 1646 if (nan) {
1647 bool long_branch = nan->is_bound() ? is_near(nan) : is_trampoline_emitted();
1646 if (kArchVariant != kMips64r6) { 1648 if (kArchVariant != kMips64r6) {
1647 c(UN, D, cmp1, cmp2); 1649 if (long_branch) {
1648 bc1t(nan); 1650 Label skip;
1651 c(UN, D, cmp1, cmp2);
1652 bc1f(&skip);
1653 nop();
1654 Jr(nan, bd);
1655 bind(&skip);
1656 } else {
1657 c(UN, D, cmp1, cmp2);
1658 bc1t(nan);
1659 if (bd == PROTECT) {
1660 nop();
1661 }
1662 }
1649 } else { 1663 } else {
1650 // Use f31 for comparison result. It has to be unavailable to lithium 1664 // Use kDoubleCompareReg for comparison result. It has to be unavailable
1665 // to lithium
1651 // register allocator. 1666 // register allocator.
1652 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); 1667 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg));
1653 cmp(UN, L, f31, cmp1, cmp2); 1668 if (long_branch) {
1654 bc1nez(nan, f31); 1669 Label skip;
1670 cmp(UN, L, kDoubleCompareReg, cmp1, cmp2);
1671 bc1eqz(&skip, kDoubleCompareReg);
1672 nop();
1673 Jr(nan, bd);
1674 bind(&skip);
1675 } else {
1676 cmp(UN, L, kDoubleCompareReg, cmp1, cmp2);
1677 bc1nez(nan, kDoubleCompareReg);
1678 if (bd == PROTECT) {
1679 nop();
1680 }
1681 }
1655 } 1682 }
1656 } 1683 }
1657 1684
1685 if (target) {
1686 bool long_branch =
1687 target->is_bound() ? is_near(target) : is_trampoline_emitted();
1688 if (long_branch) {
1689 Label skip;
1690 Condition neg_cond = NegateFpuCondition(cond);
1691 BranchShortF(sizeField, &skip, neg_cond, cmp1, cmp2, bd);
1692 Jr(target, bd);
1693 bind(&skip);
1694 } else {
1695 BranchShortF(sizeField, target, cond, cmp1, cmp2, bd);
1696 }
1697 }
1698 }
1699
1700
1701 void MacroAssembler::BranchShortF(SecondaryField sizeField, Label* target,
1702 Condition cc, FPURegister cmp1,
1703 FPURegister cmp2, BranchDelaySlot bd) {
1658 if (kArchVariant != kMips64r6) { 1704 if (kArchVariant != kMips64r6) {
1705 BlockTrampolinePoolScope block_trampoline_pool(this);
1659 if (target) { 1706 if (target) {
1660 // Here NaN cases were either handled by this function or are assumed to 1707 // Here NaN cases were either handled by this function or are assumed to
1661 // have been handled by the caller. 1708 // have been handled by the caller.
1662 switch (cc) { 1709 switch (cc) {
1663 case lt: 1710 case lt:
1664 c(OLT, sizeField, cmp1, cmp2); 1711 c(OLT, sizeField, cmp1, cmp2);
1665 bc1t(target); 1712 bc1t(target);
1666 break; 1713 break;
1714 case ult:
1715 c(ULT, sizeField, cmp1, cmp2);
1716 bc1t(target);
1717 break;
1667 case gt: 1718 case gt:
1668 c(ULE, sizeField, cmp1, cmp2); 1719 c(ULE, sizeField, cmp1, cmp2);
1669 bc1f(target); 1720 bc1f(target);
1670 break; 1721 break;
1722 case ugt:
1723 c(OLE, sizeField, cmp1, cmp2);
1724 bc1f(target);
1725 break;
1671 case ge: 1726 case ge:
1672 c(ULT, sizeField, cmp1, cmp2); 1727 c(ULT, sizeField, cmp1, cmp2);
1673 bc1f(target); 1728 bc1f(target);
1674 break; 1729 break;
1730 case uge:
1731 c(OLT, sizeField, cmp1, cmp2);
1732 bc1f(target);
1733 break;
1675 case le: 1734 case le:
1676 c(OLE, sizeField, cmp1, cmp2); 1735 c(OLE, sizeField, cmp1, cmp2);
1677 bc1t(target); 1736 bc1t(target);
1678 break; 1737 break;
1738 case ule:
1739 c(ULE, sizeField, cmp1, cmp2);
1740 bc1t(target);
1741 break;
1679 case eq: 1742 case eq:
1680 c(EQ, sizeField, cmp1, cmp2); 1743 c(EQ, sizeField, cmp1, cmp2);
1681 bc1t(target); 1744 bc1t(target);
1682 break; 1745 break;
1683 case ueq: 1746 case ueq:
1684 c(UEQ, sizeField, cmp1, cmp2); 1747 c(UEQ, sizeField, cmp1, cmp2);
1685 bc1t(target); 1748 bc1t(target);
1686 break; 1749 break;
1687 case ne: 1750 case ne: // Unordered or not equal.
1688 c(EQ, sizeField, cmp1, cmp2); 1751 c(EQ, sizeField, cmp1, cmp2);
1689 bc1f(target); 1752 bc1f(target);
1690 break; 1753 break;
1691 case nue: 1754 case ogl:
1692 c(UEQ, sizeField, cmp1, cmp2); 1755 c(UEQ, sizeField, cmp1, cmp2);
1693 bc1f(target); 1756 bc1f(target);
1694 break; 1757 break;
1695 default: 1758 default:
1696 CHECK(0); 1759 CHECK(0);
1697 } 1760 }
1698 } 1761 }
1699 } else { 1762 } else {
1763 BlockTrampolinePoolScope block_trampoline_pool(this);
1700 if (target) { 1764 if (target) {
1701 // Here NaN cases were either handled by this function or are assumed to 1765 // Here NaN cases were either handled by this function or are assumed to
1702 // have been handled by the caller. 1766 // have been handled by the caller.
1703 // Unsigned conditions are treated as their signed counterpart. 1767 // Unsigned conditions are treated as their signed counterpart.
1704 // Use f31 for comparison result, it is valid in fp64 (FR = 1) mode. 1768 // Use kDoubleCompareReg for comparison result, it is valid in fp64 (FR =
1705 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); 1769 // 1) mode.
1770 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg));
1706 switch (cc) { 1771 switch (cc) {
1707 case lt: 1772 case lt:
1708 cmp(OLT, sizeField, f31, cmp1, cmp2); 1773 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1709 bc1nez(target, f31); 1774 bc1nez(target, kDoubleCompareReg);
1775 break;
1776 case ult:
1777 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1778 bc1nez(target, kDoubleCompareReg);
1710 break; 1779 break;
1711 case gt: 1780 case gt:
1712 cmp(ULE, sizeField, f31, cmp1, cmp2); 1781 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1713 bc1eqz(target, f31); 1782 bc1eqz(target, kDoubleCompareReg);
1783 break;
1784 case ugt:
1785 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1786 bc1eqz(target, kDoubleCompareReg);
1714 break; 1787 break;
1715 case ge: 1788 case ge:
1716 cmp(ULT, sizeField, f31, cmp1, cmp2); 1789 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1717 bc1eqz(target, f31); 1790 bc1eqz(target, kDoubleCompareReg);
1791 break;
1792 case uge:
1793 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1794 bc1eqz(target, kDoubleCompareReg);
1718 break; 1795 break;
1719 case le: 1796 case le:
1720 cmp(OLE, sizeField, f31, cmp1, cmp2); 1797 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1721 bc1nez(target, f31); 1798 bc1nez(target, kDoubleCompareReg);
1799 break;
1800 case ule:
1801 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1802 bc1nez(target, kDoubleCompareReg);
1722 break; 1803 break;
1723 case eq: 1804 case eq:
1724 cmp(EQ, sizeField, f31, cmp1, cmp2); 1805 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1725 bc1nez(target, f31); 1806 bc1nez(target, kDoubleCompareReg);
1726 break; 1807 break;
1727 case ueq: 1808 case ueq:
1728 cmp(UEQ, sizeField, f31, cmp1, cmp2); 1809 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1729 bc1nez(target, f31); 1810 bc1nez(target, kDoubleCompareReg);
1730 break; 1811 break;
1731 case ne: 1812 case ne:
1732 cmp(EQ, sizeField, f31, cmp1, cmp2); 1813 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1733 bc1eqz(target, f31); 1814 bc1eqz(target, kDoubleCompareReg);
1734 break; 1815 break;
1735 case nue: 1816 case ogl:
1736 cmp(UEQ, sizeField, f31, cmp1, cmp2); 1817 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1737 bc1eqz(target, f31); 1818 bc1eqz(target, kDoubleCompareReg);
1738 break; 1819 break;
1739 default: 1820 default:
1740 CHECK(0); 1821 CHECK(0);
1741 } 1822 }
1742 } 1823 }
1743 } 1824 }
1744 1825
1745 if (bd == PROTECT) { 1826 if (bd == PROTECT) {
1746 nop(); 1827 nop();
1747 } 1828 }
(...skipping 4365 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 } 6194 }
6114 if (mag.shift > 0) sra(result, result, mag.shift); 6195 if (mag.shift > 0) sra(result, result, mag.shift);
6115 srl(at, dividend, 31); 6196 srl(at, dividend, 31);
6116 Addu(result, result, Operand(at)); 6197 Addu(result, result, Operand(at));
6117 } 6198 }
6118 6199
6119 6200
6120 } } // namespace v8::internal 6201 } } // namespace v8::internal
6121 6202
6122 #endif // V8_TARGET_ARCH_MIPS64 6203 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698