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

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

Issue 1544743004: [turbofan] Add Int64(Add|Sub)WithOverflow support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/compiler/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 if (result == NULL || IsDefined(result)) { 1836 if (result == NULL || IsDefined(result)) {
1837 switch (node->opcode()) { 1837 switch (node->opcode()) {
1838 case IrOpcode::kInt32AddWithOverflow: 1838 case IrOpcode::kInt32AddWithOverflow:
1839 cont.OverwriteAndNegateIfEqual(kOverflow); 1839 cont.OverwriteAndNegateIfEqual(kOverflow);
1840 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Add32, 1840 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Add32,
1841 kArithmeticImm, &cont); 1841 kArithmeticImm, &cont);
1842 case IrOpcode::kInt32SubWithOverflow: 1842 case IrOpcode::kInt32SubWithOverflow:
1843 cont.OverwriteAndNegateIfEqual(kOverflow); 1843 cont.OverwriteAndNegateIfEqual(kOverflow);
1844 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, 1844 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32,
1845 kArithmeticImm, &cont); 1845 kArithmeticImm, &cont);
1846 case IrOpcode::kInt64AddWithOverflow:
1847 cont.OverwriteAndNegateIfEqual(kOverflow);
1848 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Add,
1849 kArithmeticImm, &cont);
1850 case IrOpcode::kInt64SubWithOverflow:
1851 cont.OverwriteAndNegateIfEqual(kOverflow);
1852 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub,
1853 kArithmeticImm, &cont);
1846 default: 1854 default:
1847 break; 1855 break;
1848 } 1856 }
1849 } 1857 }
1850 } 1858 }
1851 break; 1859 break;
1852 case IrOpcode::kInt32Add: 1860 case IrOpcode::kInt32Add:
1853 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true, 1861 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true,
1854 kArithmeticImm); 1862 kArithmeticImm);
1855 case IrOpcode::kInt32Sub: 1863 case IrOpcode::kInt32Sub:
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { 2031 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2024 FlagsContinuation cont(kOverflow, ovf); 2032 FlagsContinuation cont(kOverflow, ovf);
2025 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, 2033 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32,
2026 kArithmeticImm, &cont); 2034 kArithmeticImm, &cont);
2027 } 2035 }
2028 FlagsContinuation cont; 2036 FlagsContinuation cont;
2029 VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, kArithmeticImm, &cont); 2037 VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, kArithmeticImm, &cont);
2030 } 2038 }
2031 2039
2032 2040
2041 void InstructionSelector::VisitInt64AddWithOverflow(Node* node) {
2042 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2043 FlagsContinuation cont(kOverflow, ovf);
2044 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Add, kArithmeticImm,
2045 &cont);
2046 }
2047 FlagsContinuation cont;
2048 VisitBinop<Int64BinopMatcher>(this, node, kArm64Add, kArithmeticImm, &cont);
2049 }
2050
2051
2052 void InstructionSelector::VisitInt64SubWithOverflow(Node* node) {
2053 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2054 FlagsContinuation cont(kOverflow, ovf);
2055 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub, kArithmeticImm,
2056 &cont);
2057 }
2058 FlagsContinuation cont;
2059 VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub, kArithmeticImm, &cont);
2060 }
2061
2062
2033 void InstructionSelector::VisitInt64LessThan(Node* node) { 2063 void InstructionSelector::VisitInt64LessThan(Node* node) {
2034 FlagsContinuation cont(kSignedLessThan, node); 2064 FlagsContinuation cont(kSignedLessThan, node);
2035 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm); 2065 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm);
2036 } 2066 }
2037 2067
2038 2068
2039 void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) { 2069 void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) {
2040 FlagsContinuation cont(kSignedLessThanOrEqual, node); 2070 FlagsContinuation cont(kSignedLessThanOrEqual, node);
2041 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm); 2071 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm);
2042 } 2072 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 MachineOperatorBuilder::kFloat32RoundTiesEven | 2186 MachineOperatorBuilder::kFloat32RoundTiesEven |
2157 MachineOperatorBuilder::kFloat64RoundTiesEven | 2187 MachineOperatorBuilder::kFloat64RoundTiesEven |
2158 MachineOperatorBuilder::kWord32ShiftIsSafe | 2188 MachineOperatorBuilder::kWord32ShiftIsSafe |
2159 MachineOperatorBuilder::kInt32DivIsSafe | 2189 MachineOperatorBuilder::kInt32DivIsSafe |
2160 MachineOperatorBuilder::kUint32DivIsSafe; 2190 MachineOperatorBuilder::kUint32DivIsSafe;
2161 } 2191 }
2162 2192
2163 } // namespace compiler 2193 } // namespace compiler
2164 } // namespace internal 2194 } // namespace internal
2165 } // namespace v8 2195 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698