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

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.cc

Issue 1544743004: [turbofan] Add Int64(Add|Sub)WithOverflow support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add truncation to the int64-sub-with-overflow-branch test Created 4 years, 12 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/compiler/mips64/instruction-codes-mips64.h ('k') | src/compiler/opcodes.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 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 Node* const node = value->InputAt(0); 1601 Node* const node = value->InputAt(0);
1602 Node* const result = NodeProperties::FindProjection(node, 0); 1602 Node* const result = NodeProperties::FindProjection(node, 0);
1603 if (result == NULL || selector->IsDefined(result)) { 1603 if (result == NULL || selector->IsDefined(result)) {
1604 switch (node->opcode()) { 1604 switch (node->opcode()) {
1605 case IrOpcode::kInt32AddWithOverflow: 1605 case IrOpcode::kInt32AddWithOverflow:
1606 cont->OverwriteAndNegateIfEqual(kOverflow); 1606 cont->OverwriteAndNegateIfEqual(kOverflow);
1607 return VisitBinop(selector, node, kMips64Dadd, cont); 1607 return VisitBinop(selector, node, kMips64Dadd, cont);
1608 case IrOpcode::kInt32SubWithOverflow: 1608 case IrOpcode::kInt32SubWithOverflow:
1609 cont->OverwriteAndNegateIfEqual(kOverflow); 1609 cont->OverwriteAndNegateIfEqual(kOverflow);
1610 return VisitBinop(selector, node, kMips64Dsub, cont); 1610 return VisitBinop(selector, node, kMips64Dsub, cont);
1611 case IrOpcode::kInt64AddWithOverflow:
1612 cont->OverwriteAndNegateIfEqual(kOverflow);
1613 return VisitBinop(selector, node, kMips64DaddOvf, cont);
1614 case IrOpcode::kInt64SubWithOverflow:
1615 cont->OverwriteAndNegateIfEqual(kOverflow);
1616 return VisitBinop(selector, node, kMips64DsubOvf, cont);
1611 default: 1617 default:
1612 break; 1618 break;
1613 } 1619 }
1614 } 1620 }
1615 } 1621 }
1616 break; 1622 break;
1617 case IrOpcode::kWord32And: 1623 case IrOpcode::kWord32And:
1618 case IrOpcode::kWord64And: 1624 case IrOpcode::kWord64And:
1619 return VisitWordCompare(selector, value, kMips64Tst, cont, true); 1625 return VisitWordCompare(selector, value, kMips64Tst, cont, true);
1620 default: 1626 default:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { 1717 void InstructionSelector::VisitInt32SubWithOverflow(Node* node) {
1712 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { 1718 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
1713 FlagsContinuation cont(kOverflow, ovf); 1719 FlagsContinuation cont(kOverflow, ovf);
1714 return VisitBinop(this, node, kMips64Dsub, &cont); 1720 return VisitBinop(this, node, kMips64Dsub, &cont);
1715 } 1721 }
1716 FlagsContinuation cont; 1722 FlagsContinuation cont;
1717 VisitBinop(this, node, kMips64Dsub, &cont); 1723 VisitBinop(this, node, kMips64Dsub, &cont);
1718 } 1724 }
1719 1725
1720 1726
1727 void InstructionSelector::VisitInt64AddWithOverflow(Node* node) {
1728 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
1729 FlagsContinuation cont(kOverflow, ovf);
1730 return VisitBinop(this, node, kMips64DaddOvf, &cont);
1731 }
1732 FlagsContinuation cont;
1733 VisitBinop(this, node, kMips64DaddOvf, &cont);
1734 }
1735
1736
1737 void InstructionSelector::VisitInt64SubWithOverflow(Node* node) {
1738 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
1739 FlagsContinuation cont(kOverflow, ovf);
1740 return VisitBinop(this, node, kMips64DsubOvf, &cont);
1741 }
1742 FlagsContinuation cont;
1743 VisitBinop(this, node, kMips64DsubOvf, &cont);
1744 }
1745
1746
1721 void InstructionSelector::VisitWord64Equal(Node* const node) { 1747 void InstructionSelector::VisitWord64Equal(Node* const node) {
1722 FlagsContinuation cont(kEqual, node); 1748 FlagsContinuation cont(kEqual, node);
1723 Int64BinopMatcher m(node); 1749 Int64BinopMatcher m(node);
1724 if (m.right().Is(0)) { 1750 if (m.right().Is(0)) {
1725 return VisitWordCompareZero(this, m.node(), m.left().node(), &cont); 1751 return VisitWordCompareZero(this, m.node(), m.left().node(), &cont);
1726 } 1752 }
1727 1753
1728 VisitWord64Compare(this, node, &cont); 1754 VisitWord64Compare(this, node, &cont);
1729 } 1755 }
1730 1756
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 MachineOperatorBuilder::kFloat32RoundUp | 1859 MachineOperatorBuilder::kFloat32RoundUp |
1834 MachineOperatorBuilder::kFloat64RoundTruncate | 1860 MachineOperatorBuilder::kFloat64RoundTruncate |
1835 MachineOperatorBuilder::kFloat32RoundTruncate | 1861 MachineOperatorBuilder::kFloat32RoundTruncate |
1836 MachineOperatorBuilder::kFloat64RoundTiesEven | 1862 MachineOperatorBuilder::kFloat64RoundTiesEven |
1837 MachineOperatorBuilder::kFloat32RoundTiesEven; 1863 MachineOperatorBuilder::kFloat32RoundTiesEven;
1838 } 1864 }
1839 1865
1840 } // namespace compiler 1866 } // namespace compiler
1841 } // namespace internal 1867 } // namespace internal
1842 } // namespace v8 1868 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-codes-mips64.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698