OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 | 7 |
8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
9 #ifdef DEBUG | 9 #ifdef DEBUG |
10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // The 'U' prefix is used to specify unsigned comparisons. | 573 // The 'U' prefix is used to specify unsigned comparisons. |
574 // Opposite conditions must be paired as odd/even numbers | 574 // Opposite conditions must be paired as odd/even numbers |
575 // because 'NegateCondition' function flips LSB to negate condition. | 575 // because 'NegateCondition' function flips LSB to negate condition. |
576 enum Condition { | 576 enum Condition { |
577 // Any value < 0 is considered no_condition. | 577 // Any value < 0 is considered no_condition. |
578 kNoCondition = -1, | 578 kNoCondition = -1, |
579 overflow = 0, | 579 overflow = 0, |
580 no_overflow = 1, | 580 no_overflow = 1, |
581 Uless = 2, | 581 Uless = 2, |
582 Ugreater_equal = 3, | 582 Ugreater_equal = 3, |
583 equal = 4, | 583 Uless_equal = 4, |
584 not_equal = 5, | 584 Ugreater = 5, |
585 Uless_equal = 6, | 585 equal = 6, |
586 Ugreater = 7, | 586 not_equal = 7, // Unordered or Not Equal. |
587 negative = 8, | 587 negative = 8, |
588 positive = 9, | 588 positive = 9, |
589 parity_even = 10, | 589 parity_even = 10, |
590 parity_odd = 11, | 590 parity_odd = 11, |
591 less = 12, | 591 less = 12, |
592 greater_equal = 13, | 592 greater_equal = 13, |
593 less_equal = 14, | 593 less_equal = 14, |
594 greater = 15, | 594 greater = 15, |
595 ueq = 16, // Unordered or Equal. | 595 ueq = 16, // Unordered or Equal. |
596 nue = 17, // Not (Unordered or Equal). | 596 ogl = 17, // Ordered and Not Equal. |
597 cc_always = 18, | 597 cc_always = 18, |
598 | 598 |
599 // Aliases. | 599 // Aliases. |
600 carry = Uless, | 600 carry = Uless, |
601 not_carry = Ugreater_equal, | 601 not_carry = Ugreater_equal, |
602 zero = equal, | 602 zero = equal, |
603 eq = equal, | 603 eq = equal, |
604 not_zero = not_equal, | 604 not_zero = not_equal, |
605 ne = not_equal, | 605 ne = not_equal, |
606 nz = not_equal, | 606 nz = not_equal, |
607 sign = negative, | 607 sign = negative, |
608 not_sign = positive, | 608 not_sign = positive, |
609 mi = negative, | 609 mi = negative, |
610 pl = positive, | 610 pl = positive, |
611 hi = Ugreater, | 611 hi = Ugreater, |
612 ls = Uless_equal, | 612 ls = Uless_equal, |
613 ge = greater_equal, | 613 ge = greater_equal, |
614 lt = less, | 614 lt = less, |
615 gt = greater, | 615 gt = greater, |
616 le = less_equal, | 616 le = less_equal, |
617 hs = Ugreater_equal, | 617 hs = Ugreater_equal, |
618 lo = Uless, | 618 lo = Uless, |
619 al = cc_always, | 619 al = cc_always, |
| 620 ult = Uless, |
| 621 uge = Ugreater_equal, |
| 622 ule = Uless_equal, |
| 623 ugt = Ugreater, |
620 cc_default = kNoCondition | 624 cc_default = kNoCondition |
621 }; | 625 }; |
622 | 626 |
623 | 627 |
624 // Returns the equivalent of !cc. | 628 // Returns the equivalent of !cc. |
625 // Negation of the default kNoCondition (-1) results in a non-default | 629 // Negation of the default kNoCondition (-1) results in a non-default |
626 // no_condition value (-2). As long as tests for no_condition check | 630 // no_condition value (-2). As long as tests for no_condition check |
627 // for condition < 0, this will work as expected. | 631 // for condition < 0, this will work as expected. |
628 inline Condition NegateCondition(Condition cc) { | 632 inline Condition NegateCondition(Condition cc) { |
629 DCHECK(cc != cc_always); | 633 DCHECK(cc != cc_always); |
630 return static_cast<Condition>(cc ^ 1); | 634 return static_cast<Condition>(cc ^ 1); |
631 } | 635 } |
632 | 636 |
633 | 637 |
| 638 inline Condition NegateFpuCondition(Condition cc) { |
| 639 DCHECK(cc != cc_always); |
| 640 switch (cc) { |
| 641 case ult: |
| 642 return ge; |
| 643 case ugt: |
| 644 return le; |
| 645 case uge: |
| 646 return lt; |
| 647 case ule: |
| 648 return gt; |
| 649 case lt: |
| 650 return uge; |
| 651 case gt: |
| 652 return ule; |
| 653 case ge: |
| 654 return ult; |
| 655 case le: |
| 656 return ugt; |
| 657 case eq: |
| 658 return ne; |
| 659 case ne: |
| 660 return eq; |
| 661 case ueq: |
| 662 return ogl; |
| 663 case ogl: |
| 664 return ueq; |
| 665 default: |
| 666 return cc; |
| 667 } |
| 668 } |
| 669 |
| 670 |
634 // Commute a condition such that {a cond b == b cond' a}. | 671 // Commute a condition such that {a cond b == b cond' a}. |
635 inline Condition CommuteCondition(Condition cc) { | 672 inline Condition CommuteCondition(Condition cc) { |
636 switch (cc) { | 673 switch (cc) { |
637 case Uless: | 674 case Uless: |
638 return Ugreater; | 675 return Ugreater; |
639 case Ugreater: | 676 case Ugreater: |
640 return Uless; | 677 return Uless; |
641 case Ugreater_equal: | 678 case Ugreater_equal: |
642 return Uless_equal; | 679 return Uless_equal; |
643 case Uless_equal: | 680 case Uless_equal: |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // TODO(plind): below should be based on kPointerSize | 979 // TODO(plind): below should be based on kPointerSize |
943 // TODO(plind): find all usages and remove the needless instructions for n64. | 980 // TODO(plind): find all usages and remove the needless instructions for n64. |
944 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; | 981 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; |
945 | 982 |
946 const int kInvalidStackOffset = -1; | 983 const int kInvalidStackOffset = -1; |
947 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 984 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
948 | 985 |
949 } } // namespace v8::internal | 986 } } // namespace v8::internal |
950 | 987 |
951 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 988 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |