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

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: 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:
1664 c(OLT, sizeField, cmp1, cmp2); 1710 c(OLT, sizeField, cmp1, cmp2);
paul.l... 2015/05/05 16:07:21 I don't think you mean to delete 'case lt:' here..
dusmil.imgtec 2015/05/05 18:11:29 Done.
1665 bc1t(target); 1711 bc1t(target);
1666 break; 1712 break;
1713 case ult:
1714 c(ULT, sizeField, cmp1, cmp2);
1715 bc1t(target);
1716 break;
1667 case gt: 1717 case gt:
1668 c(ULE, sizeField, cmp1, cmp2); 1718 c(ULE, sizeField, cmp1, cmp2);
1669 bc1f(target); 1719 bc1f(target);
1670 break; 1720 break;
1721 case ugt:
1722 c(OLE, sizeField, cmp1, cmp2);
1723 bc1f(target);
1724 break;
1671 case ge: 1725 case ge:
1672 c(ULT, sizeField, cmp1, cmp2); 1726 c(ULT, sizeField, cmp1, cmp2);
1673 bc1f(target); 1727 bc1f(target);
1674 break; 1728 break;
1729 case uge:
1730 c(OLT, sizeField, cmp1, cmp2);
1731 bc1f(target);
1732 break;
1675 case le: 1733 case le:
1676 c(OLE, sizeField, cmp1, cmp2); 1734 c(OLE, sizeField, cmp1, cmp2);
1677 bc1t(target); 1735 bc1t(target);
1678 break; 1736 break;
1737 case ule:
1738 c(ULE, sizeField, cmp1, cmp2);
1739 bc1t(target);
1740 break;
1679 case eq: 1741 case eq:
1680 c(EQ, sizeField, cmp1, cmp2); 1742 c(EQ, sizeField, cmp1, cmp2);
1681 bc1t(target); 1743 bc1t(target);
1682 break; 1744 break;
1683 case ueq: 1745 case ueq:
1684 c(UEQ, sizeField, cmp1, cmp2); 1746 c(UEQ, sizeField, cmp1, cmp2);
1685 bc1t(target); 1747 bc1t(target);
1686 break; 1748 break;
1687 case ne: 1749 case ne: // Unordered or not equal.
1688 c(EQ, sizeField, cmp1, cmp2); 1750 c(EQ, sizeField, cmp1, cmp2);
1689 bc1f(target); 1751 bc1f(target);
1690 break; 1752 break;
1691 case nue: 1753 case ogl:
1692 c(UEQ, sizeField, cmp1, cmp2); 1754 c(UEQ, sizeField, cmp1, cmp2);
1693 bc1f(target); 1755 bc1f(target);
1694 break; 1756 break;
1695 default: 1757 default:
1696 CHECK(0); 1758 CHECK(0);
1697 } 1759 }
1698 } 1760 }
1699 } else { 1761 } else {
1762 BlockTrampolinePoolScope block_trampoline_pool(this);
1700 if (target) { 1763 if (target) {
1701 // Here NaN cases were either handled by this function or are assumed to 1764 // Here NaN cases were either handled by this function or are assumed to
1702 // have been handled by the caller. 1765 // have been handled by the caller.
1703 // Unsigned conditions are treated as their signed counterpart. 1766 // Unsigned conditions are treated as their signed counterpart.
1704 // Use f31 for comparison result, it is valid in fp64 (FR = 1) mode. 1767 // Use kDoubleCompareReg for comparison result, it is valid in fp64 (FR =
1705 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); 1768 // 1) mode.
1769 DCHECK(!cmp1.is(kDoubleCompareReg) && !cmp2.is(kDoubleCompareReg));
1706 switch (cc) { 1770 switch (cc) {
1707 case lt: 1771 case lt:
1708 cmp(OLT, sizeField, f31, cmp1, cmp2); 1772 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1709 bc1nez(target, f31); 1773 bc1nez(target, kDoubleCompareReg);
1774 break;
1775 case ult:
1776 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1777 bc1nez(target, kDoubleCompareReg);
1710 break; 1778 break;
1711 case gt: 1779 case gt:
1712 cmp(ULE, sizeField, f31, cmp1, cmp2); 1780 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1713 bc1eqz(target, f31); 1781 bc1eqz(target, kDoubleCompareReg);
1782 break;
1783 case ugt:
1784 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1785 bc1eqz(target, kDoubleCompareReg);
1714 break; 1786 break;
1715 case ge: 1787 case ge:
1716 cmp(ULT, sizeField, f31, cmp1, cmp2); 1788 cmp(ULT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1717 bc1eqz(target, f31); 1789 bc1eqz(target, kDoubleCompareReg);
1790 break;
1791 case uge:
1792 cmp(OLT, sizeField, kDoubleCompareReg, cmp1, cmp2);
1793 bc1eqz(target, kDoubleCompareReg);
1718 break; 1794 break;
1719 case le: 1795 case le:
1720 cmp(OLE, sizeField, f31, cmp1, cmp2); 1796 cmp(OLE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1721 bc1nez(target, f31); 1797 bc1nez(target, kDoubleCompareReg);
1798 break;
1799 case ule:
1800 cmp(ULE, sizeField, kDoubleCompareReg, cmp1, cmp2);
1801 bc1nez(target, kDoubleCompareReg);
1722 break; 1802 break;
1723 case eq: 1803 case eq:
1724 cmp(EQ, sizeField, f31, cmp1, cmp2); 1804 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1725 bc1nez(target, f31); 1805 bc1nez(target, kDoubleCompareReg);
1726 break; 1806 break;
1727 case ueq: 1807 case ueq:
1728 cmp(UEQ, sizeField, f31, cmp1, cmp2); 1808 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1729 bc1nez(target, f31); 1809 bc1nez(target, kDoubleCompareReg);
1730 break; 1810 break;
1731 case ne: 1811 case ne:
1732 cmp(EQ, sizeField, f31, cmp1, cmp2); 1812 cmp(EQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1733 bc1eqz(target, f31); 1813 bc1eqz(target, kDoubleCompareReg);
1734 break; 1814 break;
1735 case nue: 1815 case ogl:
1736 cmp(UEQ, sizeField, f31, cmp1, cmp2); 1816 cmp(UEQ, sizeField, kDoubleCompareReg, cmp1, cmp2);
1737 bc1eqz(target, f31); 1817 bc1eqz(target, kDoubleCompareReg);
1738 break; 1818 break;
1739 default: 1819 default:
1740 CHECK(0); 1820 CHECK(0);
1741 } 1821 }
1742 } 1822 }
1743 } 1823 }
1744 1824
1745 if (bd == PROTECT) { 1825 if (bd == PROTECT) {
1746 nop(); 1826 nop();
1747 } 1827 }
(...skipping 4365 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 } 6193 }
6114 if (mag.shift > 0) sra(result, result, mag.shift); 6194 if (mag.shift > 0) sra(result, result, mag.shift);
6115 srl(at, dividend, 31); 6195 srl(at, dividend, 31);
6116 Addu(result, result, Operand(at)); 6196 Addu(result, result, Operand(at));
6117 } 6197 }
6118 6198
6119 6199
6120 } } // namespace v8::internal 6200 } } // namespace v8::internal
6121 6201
6122 #endif // V8_TARGET_ARCH_MIPS64 6202 #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