| 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/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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) { | 1447 void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) { |
| 1448 MipsOperandGenerator g(this); | 1448 MipsOperandGenerator g(this); |
| 1449 Node* left = node->InputAt(0); | 1449 Node* left = node->InputAt(0); |
| 1450 Node* right = node->InputAt(1); | 1450 Node* right = node->InputAt(1); |
| 1451 Emit(kMipsFloat64InsertHighWord32, g.DefineSameAsFirst(node), | 1451 Emit(kMipsFloat64InsertHighWord32, g.DefineSameAsFirst(node), |
| 1452 g.UseRegister(left), g.UseRegister(right)); | 1452 g.UseRegister(left), g.UseRegister(right)); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 void InstructionSelector::VisitAtomicLoad(Node* node) { | 1455 void InstructionSelector::VisitAtomicLoad(Node* node) { |
| 1456 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); | 1456 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
| 1457 OperandGenerator g(this); | 1457 MipsOperandGenerator g(this); |
| 1458 Node* base = node->InputAt(0); | 1458 Node* base = node->InputAt(0); |
| 1459 Node* index = node->InputAt(1); | 1459 Node* index = node->InputAt(1); |
| 1460 ArchOpcode opcode = kArchNop; | 1460 ArchOpcode opcode = kArchNop; |
| 1461 switch (load_rep.representation()) { | 1461 switch (load_rep.representation()) { |
| 1462 case MachineRepresentation::kWord8: | 1462 case MachineRepresentation::kWord8: |
| 1463 opcode = load_rep.IsSigned() ? kAtomicLoadInt8 : kAtomicLoadUint8; | 1463 opcode = load_rep.IsSigned() ? kAtomicLoadInt8 : kAtomicLoadUint8; |
| 1464 break; | 1464 break; |
| 1465 case MachineRepresentation::kWord16: | 1465 case MachineRepresentation::kWord16: |
| 1466 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; | 1466 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; |
| 1467 break; | 1467 break; |
| 1468 case MachineRepresentation::kWord32: | 1468 case MachineRepresentation::kWord32: |
| 1469 opcode = kAtomicLoadWord32; | 1469 opcode = kAtomicLoadWord32; |
| 1470 break; | 1470 break; |
| 1471 default: | 1471 default: |
| 1472 UNREACHABLE(); | 1472 UNREACHABLE(); |
| 1473 return; | 1473 return; |
| 1474 } | 1474 } |
| 1475 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1475 if (g.CanBeImmediate(index, opcode)) { |
| 1476 g.DefineAsRegister(node), g.UseRegister(base), g.UseRegister(index)); | 1476 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 1477 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); |
| 1478 } else { |
| 1479 InstructionOperand addr_reg = g.TempRegister(); |
| 1480 Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg, |
| 1481 g.UseRegister(index), g.UseRegister(base)); |
| 1482 // Emit desired load opcode, using temp addr_reg. |
| 1483 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 1484 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); |
| 1485 } |
| 1477 } | 1486 } |
| 1478 | 1487 |
| 1479 // static | 1488 // static |
| 1480 MachineOperatorBuilder::Flags | 1489 MachineOperatorBuilder::Flags |
| 1481 InstructionSelector::SupportedMachineOperatorFlags() { | 1490 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1482 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags; | 1491 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags; |
| 1483 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && | 1492 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && |
| 1484 IsFp64Mode()) { | 1493 IsFp64Mode()) { |
| 1485 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1494 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
| 1486 MachineOperatorBuilder::kFloat64RoundUp | | 1495 MachineOperatorBuilder::kFloat64RoundUp | |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1498 MachineOperatorBuilder::kFloat32Max | | 1507 MachineOperatorBuilder::kFloat32Max | |
| 1499 MachineOperatorBuilder::kFloat32RoundDown | | 1508 MachineOperatorBuilder::kFloat32RoundDown | |
| 1500 MachineOperatorBuilder::kFloat32RoundUp | | 1509 MachineOperatorBuilder::kFloat32RoundUp | |
| 1501 MachineOperatorBuilder::kFloat32RoundTruncate | | 1510 MachineOperatorBuilder::kFloat32RoundTruncate | |
| 1502 MachineOperatorBuilder::kFloat32RoundTiesEven; | 1511 MachineOperatorBuilder::kFloat32RoundTiesEven; |
| 1503 } | 1512 } |
| 1504 | 1513 |
| 1505 } // namespace compiler | 1514 } // namespace compiler |
| 1506 } // namespace internal | 1515 } // namespace internal |
| 1507 } // namespace v8 | 1516 } // namespace v8 |
| OLD | NEW |