| 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/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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 case IrOpcode::kInt32LessThanOrEqual: | 1104 case IrOpcode::kInt32LessThanOrEqual: |
| 1105 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); | 1105 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); |
| 1106 return VisitWord32Compare(selector, value, cont); | 1106 return VisitWord32Compare(selector, value, cont); |
| 1107 case IrOpcode::kUint32LessThan: | 1107 case IrOpcode::kUint32LessThan: |
| 1108 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1108 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); |
| 1109 return VisitWord32Compare(selector, value, cont); | 1109 return VisitWord32Compare(selector, value, cont); |
| 1110 case IrOpcode::kUint32LessThanOrEqual: | 1110 case IrOpcode::kUint32LessThanOrEqual: |
| 1111 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); | 1111 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); |
| 1112 return VisitWord32Compare(selector, value, cont); | 1112 return VisitWord32Compare(selector, value, cont); |
| 1113 #if V8_TARGET_ARCH_PPC64 | 1113 #if V8_TARGET_ARCH_PPC64 |
| 1114 case IrOpcode::kWord64Equal: { | 1114 case IrOpcode::kWord64Equal: |
| 1115 // Combine with comparisons against 0 by simply inverting the | |
| 1116 // continuation. | |
| 1117 Int64BinopMatcher m(value); | |
| 1118 if (m.right().Is(0)) { | |
| 1119 user = value; | |
| 1120 value = m.left().node(); | |
| 1121 cont->Negate(); | |
| 1122 continue; | |
| 1123 } | |
| 1124 cont->OverwriteAndNegateIfEqual(kEqual); | 1115 cont->OverwriteAndNegateIfEqual(kEqual); |
| 1125 return VisitWord64Compare(selector, value, cont); | 1116 return VisitWord64Compare(selector, value, cont); |
| 1126 } | |
| 1127 case IrOpcode::kInt64LessThan: | 1117 case IrOpcode::kInt64LessThan: |
| 1128 cont->OverwriteAndNegateIfEqual(kSignedLessThan); | 1118 cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
| 1129 return VisitWord64Compare(selector, value, cont); | 1119 return VisitWord64Compare(selector, value, cont); |
| 1130 case IrOpcode::kInt64LessThanOrEqual: | 1120 case IrOpcode::kInt64LessThanOrEqual: |
| 1131 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); | 1121 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); |
| 1132 return VisitWord64Compare(selector, value, cont); | 1122 return VisitWord64Compare(selector, value, cont); |
| 1133 case IrOpcode::kUint64LessThan: | 1123 case IrOpcode::kUint64LessThan: |
| 1134 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1124 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); |
| 1135 return VisitWord64Compare(selector, value, cont); | 1125 return VisitWord64Compare(selector, value, cont); |
| 1136 #endif | 1126 #endif |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 // Emit the call instruction. | 1419 // Emit the call instruction. |
| 1430 InstructionOperand* first_output = | 1420 InstructionOperand* first_output = |
| 1431 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 1421 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; |
| 1432 Instruction* call_instr = | 1422 Instruction* call_instr = |
| 1433 Emit(opcode, buffer.outputs.size(), first_output, | 1423 Emit(opcode, buffer.outputs.size(), first_output, |
| 1434 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 1424 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
| 1435 call_instr->MarkAsCall(); | 1425 call_instr->MarkAsCall(); |
| 1436 } | 1426 } |
| 1437 | 1427 |
| 1438 | 1428 |
| 1429 void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { |
| 1430 PPCOperandGenerator g(this); |
| 1431 Emit(kPPC_Float64ExtractLowWord32, g.DefineAsRegister(node), |
| 1432 g.UseRegister(node->InputAt(0))); |
| 1433 } |
| 1434 |
| 1435 |
| 1436 void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) { |
| 1437 PPCOperandGenerator g(this); |
| 1438 Emit(kPPC_Float64ExtractHighWord32, g.DefineAsRegister(node), |
| 1439 g.UseRegister(node->InputAt(0))); |
| 1440 } |
| 1441 |
| 1442 |
| 1443 void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) { |
| 1444 PPCOperandGenerator g(this); |
| 1445 Node* left = node->InputAt(0); |
| 1446 Node* right = node->InputAt(1); |
| 1447 if (left->opcode() == IrOpcode::kFloat64InsertHighWord32 && |
| 1448 CanCover(node, left)) { |
| 1449 left = left->InputAt(1); |
| 1450 Emit(kPPC_Float64Construct, g.DefineAsRegister(node), g.UseRegister(left), |
| 1451 g.UseRegister(right)); |
| 1452 return; |
| 1453 } |
| 1454 Emit(kPPC_Float64InsertLowWord32, g.DefineSameAsFirst(node), |
| 1455 g.UseRegister(left), g.UseRegister(right)); |
| 1456 } |
| 1457 |
| 1458 |
| 1459 void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) { |
| 1460 PPCOperandGenerator g(this); |
| 1461 Node* left = node->InputAt(0); |
| 1462 Node* right = node->InputAt(1); |
| 1463 if (left->opcode() == IrOpcode::kFloat64InsertLowWord32 && |
| 1464 CanCover(node, left)) { |
| 1465 left = left->InputAt(1); |
| 1466 Emit(kPPC_Float64Construct, g.DefineAsRegister(node), g.UseRegister(right), |
| 1467 g.UseRegister(left)); |
| 1468 return; |
| 1469 } |
| 1470 Emit(kPPC_Float64InsertHighWord32, g.DefineSameAsFirst(node), |
| 1471 g.UseRegister(left), g.UseRegister(right)); |
| 1472 } |
| 1473 |
| 1474 |
| 1439 // static | 1475 // static |
| 1440 MachineOperatorBuilder::Flags | 1476 MachineOperatorBuilder::Flags |
| 1441 InstructionSelector::SupportedMachineOperatorFlags() { | 1477 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1442 return MachineOperatorBuilder::kFloat64Floor | | 1478 return MachineOperatorBuilder::kFloat64Floor | |
| 1443 MachineOperatorBuilder::kFloat64Ceil | | 1479 MachineOperatorBuilder::kFloat64Ceil | |
| 1444 MachineOperatorBuilder::kFloat64RoundTruncate | | 1480 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1445 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1481 MachineOperatorBuilder::kFloat64RoundTiesAway; |
| 1446 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. | 1482 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. |
| 1447 } | 1483 } |
| 1448 | 1484 |
| 1449 } // namespace compiler | 1485 } // namespace compiler |
| 1450 } // namespace internal | 1486 } // namespace internal |
| 1451 } // namespace v8 | 1487 } // namespace v8 |
| OLD | NEW |