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

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: 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/arm64/code-generator-arm64.cc ('k') | src/compiler/instruction-selector.cc » ('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/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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 if (result == NULL || IsDefined(result)) { 1840 if (result == NULL || IsDefined(result)) {
1841 switch (node->opcode()) { 1841 switch (node->opcode()) {
1842 case IrOpcode::kInt32AddWithOverflow: 1842 case IrOpcode::kInt32AddWithOverflow:
1843 cont.OverwriteAndNegateIfEqual(kOverflow); 1843 cont.OverwriteAndNegateIfEqual(kOverflow);
1844 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Add32, 1844 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Add32,
1845 kArithmeticImm, &cont); 1845 kArithmeticImm, &cont);
1846 case IrOpcode::kInt32SubWithOverflow: 1846 case IrOpcode::kInt32SubWithOverflow:
1847 cont.OverwriteAndNegateIfEqual(kOverflow); 1847 cont.OverwriteAndNegateIfEqual(kOverflow);
1848 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, 1848 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32,
1849 kArithmeticImm, &cont); 1849 kArithmeticImm, &cont);
1850 case IrOpcode::kInt64AddWithOverflow:
1851 cont.OverwriteAndNegateIfEqual(kOverflow);
1852 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Add,
1853 kArithmeticImm, &cont);
1854 case IrOpcode::kInt64SubWithOverflow:
1855 cont.OverwriteAndNegateIfEqual(kOverflow);
1856 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub,
1857 kArithmeticImm, &cont);
1850 default: 1858 default:
1851 break; 1859 break;
1852 } 1860 }
1853 } 1861 }
1854 } 1862 }
1855 break; 1863 break;
1856 case IrOpcode::kInt32Add: 1864 case IrOpcode::kInt32Add:
1857 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true, 1865 return VisitWordCompare(this, value, kArm64Cmn32, &cont, true,
1858 kArithmeticImm); 1866 kArithmeticImm);
1859 case IrOpcode::kInt32Sub: 1867 case IrOpcode::kInt32Sub:
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { 2035 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2028 FlagsContinuation cont(kOverflow, ovf); 2036 FlagsContinuation cont(kOverflow, ovf);
2029 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, 2037 return VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32,
2030 kArithmeticImm, &cont); 2038 kArithmeticImm, &cont);
2031 } 2039 }
2032 FlagsContinuation cont; 2040 FlagsContinuation cont;
2033 VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, kArithmeticImm, &cont); 2041 VisitBinop<Int32BinopMatcher>(this, node, kArm64Sub32, kArithmeticImm, &cont);
2034 } 2042 }
2035 2043
2036 2044
2045 void InstructionSelector::VisitInt64AddWithOverflow(Node* node) {
2046 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2047 FlagsContinuation cont(kOverflow, ovf);
2048 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Add, kArithmeticImm,
2049 &cont);
2050 }
2051 FlagsContinuation cont;
2052 VisitBinop<Int64BinopMatcher>(this, node, kArm64Add, kArithmeticImm, &cont);
2053 }
2054
2055
2056 void InstructionSelector::VisitInt64SubWithOverflow(Node* node) {
2057 if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
2058 FlagsContinuation cont(kOverflow, ovf);
2059 return VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub, kArithmeticImm,
2060 &cont);
2061 }
2062 FlagsContinuation cont;
2063 VisitBinop<Int64BinopMatcher>(this, node, kArm64Sub, kArithmeticImm, &cont);
2064 }
2065
2066
2037 void InstructionSelector::VisitInt64LessThan(Node* node) { 2067 void InstructionSelector::VisitInt64LessThan(Node* node) {
2038 FlagsContinuation cont(kSignedLessThan, node); 2068 FlagsContinuation cont(kSignedLessThan, node);
2039 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm); 2069 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm);
2040 } 2070 }
2041 2071
2042 2072
2043 void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) { 2073 void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) {
2044 FlagsContinuation cont(kSignedLessThanOrEqual, node); 2074 FlagsContinuation cont(kSignedLessThanOrEqual, node);
2045 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm); 2075 VisitWordCompare(this, node, kArm64Cmp, &cont, false, kArithmeticImm);
2046 } 2076 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 MachineOperatorBuilder::kFloat32RoundTiesEven | 2190 MachineOperatorBuilder::kFloat32RoundTiesEven |
2161 MachineOperatorBuilder::kFloat64RoundTiesEven | 2191 MachineOperatorBuilder::kFloat64RoundTiesEven |
2162 MachineOperatorBuilder::kWord32ShiftIsSafe | 2192 MachineOperatorBuilder::kWord32ShiftIsSafe |
2163 MachineOperatorBuilder::kInt32DivIsSafe | 2193 MachineOperatorBuilder::kInt32DivIsSafe |
2164 MachineOperatorBuilder::kUint32DivIsSafe; 2194 MachineOperatorBuilder::kUint32DivIsSafe;
2165 } 2195 }
2166 2196
2167 } // namespace compiler 2197 } // namespace compiler
2168 } // namespace internal 2198 } // namespace internal
2169 } // namespace v8 2199 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/code-generator-arm64.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698