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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 // Shared routine for multiple word compare operations. | 1389 // Shared routine for multiple word compare operations. |
1390 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1390 void VisitWordCompare(InstructionSelector* selector, Node* node, |
1391 InstructionCode opcode, FlagsContinuation* cont, | 1391 InstructionCode opcode, FlagsContinuation* cont, |
1392 bool commutative) { | 1392 bool commutative) { |
1393 MipsOperandGenerator g(selector); | 1393 MipsOperandGenerator g(selector); |
1394 Node* left = node->InputAt(0); | 1394 Node* left = node->InputAt(0); |
1395 Node* right = node->InputAt(1); | 1395 Node* right = node->InputAt(1); |
1396 | 1396 |
1397 // Match immediates on left or right side of comparison. | 1397 // Match immediates on left or right side of comparison. |
1398 if (g.CanBeImmediate(right, opcode)) { | 1398 if (g.CanBeImmediate(right, opcode)) { |
1399 switch (cont->condition()) { | 1399 if (opcode == kMipsTst) { |
1400 case kEqual: | 1400 VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right), |
1401 case kNotEqual: | 1401 cont); |
1402 if (cont->IsSet()) { | 1402 } else { |
| 1403 switch (cont->condition()) { |
| 1404 case kEqual: |
| 1405 case kNotEqual: |
| 1406 if (cont->IsSet()) { |
| 1407 VisitCompare(selector, opcode, g.UseRegister(left), |
| 1408 g.UseImmediate(right), cont); |
| 1409 } else { |
| 1410 VisitCompare(selector, opcode, g.UseRegister(left), |
| 1411 g.UseRegister(right), cont); |
| 1412 } |
| 1413 break; |
| 1414 case kSignedLessThan: |
| 1415 case kSignedGreaterThanOrEqual: |
| 1416 case kUnsignedLessThan: |
| 1417 case kUnsignedGreaterThanOrEqual: |
1403 VisitCompare(selector, opcode, g.UseRegister(left), | 1418 VisitCompare(selector, opcode, g.UseRegister(left), |
1404 g.UseImmediate(right), cont); | 1419 g.UseImmediate(right), cont); |
1405 } else { | 1420 break; |
| 1421 default: |
1406 VisitCompare(selector, opcode, g.UseRegister(left), | 1422 VisitCompare(selector, opcode, g.UseRegister(left), |
1407 g.UseRegister(right), cont); | 1423 g.UseRegister(right), cont); |
1408 } | 1424 } |
1409 break; | |
1410 case kSignedLessThan: | |
1411 case kSignedGreaterThanOrEqual: | |
1412 case kUnsignedLessThan: | |
1413 case kUnsignedGreaterThanOrEqual: | |
1414 VisitCompare(selector, opcode, g.UseRegister(left), | |
1415 g.UseImmediate(right), cont); | |
1416 break; | |
1417 default: | |
1418 VisitCompare(selector, opcode, g.UseRegister(left), | |
1419 g.UseRegister(right), cont); | |
1420 } | 1425 } |
1421 } else if (g.CanBeImmediate(left, opcode)) { | 1426 } else if (g.CanBeImmediate(left, opcode)) { |
1422 if (!commutative) cont->Commute(); | 1427 if (!commutative) cont->Commute(); |
1423 switch (cont->condition()) { | 1428 if (opcode == kMipsTst) { |
1424 case kEqual: | 1429 VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left), |
1425 case kNotEqual: | 1430 cont); |
1426 if (cont->IsSet()) { | 1431 } else { |
| 1432 switch (cont->condition()) { |
| 1433 case kEqual: |
| 1434 case kNotEqual: |
| 1435 if (cont->IsSet()) { |
| 1436 VisitCompare(selector, opcode, g.UseRegister(right), |
| 1437 g.UseImmediate(left), cont); |
| 1438 } else { |
| 1439 VisitCompare(selector, opcode, g.UseRegister(right), |
| 1440 g.UseRegister(left), cont); |
| 1441 } |
| 1442 break; |
| 1443 case kSignedLessThan: |
| 1444 case kSignedGreaterThanOrEqual: |
| 1445 case kUnsignedLessThan: |
| 1446 case kUnsignedGreaterThanOrEqual: |
1427 VisitCompare(selector, opcode, g.UseRegister(right), | 1447 VisitCompare(selector, opcode, g.UseRegister(right), |
1428 g.UseImmediate(left), cont); | 1448 g.UseImmediate(left), cont); |
1429 } else { | 1449 break; |
| 1450 default: |
1430 VisitCompare(selector, opcode, g.UseRegister(right), | 1451 VisitCompare(selector, opcode, g.UseRegister(right), |
1431 g.UseRegister(left), cont); | 1452 g.UseRegister(left), cont); |
1432 } | 1453 } |
1433 break; | |
1434 case kSignedLessThan: | |
1435 case kSignedGreaterThanOrEqual: | |
1436 case kUnsignedLessThan: | |
1437 case kUnsignedGreaterThanOrEqual: | |
1438 VisitCompare(selector, opcode, g.UseRegister(right), | |
1439 g.UseImmediate(left), cont); | |
1440 break; | |
1441 default: | |
1442 VisitCompare(selector, opcode, g.UseRegister(right), | |
1443 g.UseRegister(left), cont); | |
1444 } | 1454 } |
1445 } else { | 1455 } else { |
1446 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), | 1456 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), |
1447 cont); | 1457 cont); |
1448 } | 1458 } |
1449 } | 1459 } |
1450 | 1460 |
1451 | 1461 |
1452 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1462 void VisitWordCompare(InstructionSelector* selector, Node* node, |
1453 FlagsContinuation* cont) { | 1463 FlagsContinuation* cont) { |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || | 1858 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || |
1849 IsMipsArchVariant(kMips32r2)); | 1859 IsMipsArchVariant(kMips32r2)); |
1850 return MachineOperatorBuilder::AlignmentRequirements:: | 1860 return MachineOperatorBuilder::AlignmentRequirements:: |
1851 NoUnalignedAccessSupport(); | 1861 NoUnalignedAccessSupport(); |
1852 } | 1862 } |
1853 } | 1863 } |
1854 | 1864 |
1855 } // namespace compiler | 1865 } // namespace compiler |
1856 } // namespace internal | 1866 } // namespace internal |
1857 } // namespace v8 | 1867 } // namespace v8 |
OLD | NEW |