OLD | NEW |
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/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/ppc/frames-ppc.h" | 9 #include "src/ppc/frames-ppc.h" |
10 | 10 |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 FlagsContinuation cont(kOverflow, ovf); | 1234 FlagsContinuation cont(kOverflow, ovf); |
1235 return VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32, | 1235 return VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32, |
1236 kInt16Imm_Negate, &cont); | 1236 kInt16Imm_Negate, &cont); |
1237 } | 1237 } |
1238 FlagsContinuation cont; | 1238 FlagsContinuation cont; |
1239 VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32, | 1239 VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32, |
1240 kInt16Imm_Negate, &cont); | 1240 kInt16Imm_Negate, &cont); |
1241 } | 1241 } |
1242 | 1242 |
1243 | 1243 |
| 1244 #if V8_TARGET_ARCH_PPC64 |
| 1245 void InstructionSelector::VisitInt64AddWithOverflow(Node* node) { |
| 1246 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
| 1247 FlagsContinuation cont(kOverflow, ovf); |
| 1248 return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, |
| 1249 &cont); |
| 1250 } |
| 1251 FlagsContinuation cont; |
| 1252 VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, &cont); |
| 1253 } |
| 1254 |
| 1255 |
| 1256 void InstructionSelector::VisitInt64SubWithOverflow(Node* node) { |
| 1257 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
| 1258 FlagsContinuation cont(kOverflow, ovf); |
| 1259 return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate, |
| 1260 &cont); |
| 1261 } |
| 1262 FlagsContinuation cont; |
| 1263 VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate, &cont); |
| 1264 } |
| 1265 #endif |
| 1266 |
| 1267 |
1244 static bool CompareLogical(FlagsContinuation* cont) { | 1268 static bool CompareLogical(FlagsContinuation* cont) { |
1245 switch (cont->condition()) { | 1269 switch (cont->condition()) { |
1246 case kUnsignedLessThan: | 1270 case kUnsignedLessThan: |
1247 case kUnsignedGreaterThanOrEqual: | 1271 case kUnsignedGreaterThanOrEqual: |
1248 case kUnsignedLessThanOrEqual: | 1272 case kUnsignedLessThanOrEqual: |
1249 case kUnsignedGreaterThan: | 1273 case kUnsignedGreaterThan: |
1250 return true; | 1274 return true; |
1251 default: | 1275 default: |
1252 return false; | 1276 return false; |
1253 } | 1277 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 switch (node->opcode()) { | 1440 switch (node->opcode()) { |
1417 case IrOpcode::kInt32AddWithOverflow: | 1441 case IrOpcode::kInt32AddWithOverflow: |
1418 cont->OverwriteAndNegateIfEqual(kOverflow); | 1442 cont->OverwriteAndNegateIfEqual(kOverflow); |
1419 return VisitBinop<Int32BinopMatcher>( | 1443 return VisitBinop<Int32BinopMatcher>( |
1420 selector, node, kPPC_AddWithOverflow32, kInt16Imm, cont); | 1444 selector, node, kPPC_AddWithOverflow32, kInt16Imm, cont); |
1421 case IrOpcode::kInt32SubWithOverflow: | 1445 case IrOpcode::kInt32SubWithOverflow: |
1422 cont->OverwriteAndNegateIfEqual(kOverflow); | 1446 cont->OverwriteAndNegateIfEqual(kOverflow); |
1423 return VisitBinop<Int32BinopMatcher>(selector, node, | 1447 return VisitBinop<Int32BinopMatcher>(selector, node, |
1424 kPPC_SubWithOverflow32, | 1448 kPPC_SubWithOverflow32, |
1425 kInt16Imm_Negate, cont); | 1449 kInt16Imm_Negate, cont); |
| 1450 #if V8_TARGET_ARCH_PPC64 |
| 1451 case IrOpcode::kInt64AddWithOverflow: |
| 1452 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1453 return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Add, |
| 1454 kInt16Imm, cont); |
| 1455 case IrOpcode::kInt64SubWithOverflow: |
| 1456 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1457 return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Sub, |
| 1458 kInt16Imm_Negate, cont); |
| 1459 #endif |
1426 default: | 1460 default: |
1427 break; | 1461 break; |
1428 } | 1462 } |
1429 } | 1463 } |
1430 } | 1464 } |
1431 break; | 1465 break; |
1432 case IrOpcode::kInt32Sub: | 1466 case IrOpcode::kInt32Sub: |
1433 return VisitWord32Compare(selector, value, cont); | 1467 return VisitWord32Compare(selector, value, cont); |
1434 case IrOpcode::kWord32And: | 1468 case IrOpcode::kWord32And: |
1435 // TODO(mbandy): opportunity for rlwinm? | 1469 // TODO(mbandy): opportunity for rlwinm? |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 MachineOperatorBuilder::kFloat64RoundTruncate | | 1763 MachineOperatorBuilder::kFloat64RoundTruncate | |
1730 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1764 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1731 MachineOperatorBuilder::kWord32Popcnt | | 1765 MachineOperatorBuilder::kWord32Popcnt | |
1732 MachineOperatorBuilder::kWord64Popcnt; | 1766 MachineOperatorBuilder::kWord64Popcnt; |
1733 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. | 1767 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. |
1734 } | 1768 } |
1735 | 1769 |
1736 } // namespace compiler | 1770 } // namespace compiler |
1737 } // namespace internal | 1771 } // namespace internal |
1738 } // namespace v8 | 1772 } // namespace v8 |
OLD | NEW |