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 #include "src/globals.h" | 7 #include "src/globals.h" |
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. | 548 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. |
549 // COP1 Encoding of Function Field When rs=PS. | 549 // COP1 Encoding of Function Field When rs=PS. |
550 // COP1X Encoding of Function Field. | 550 // COP1X Encoding of Function Field. |
551 MADD_D = ((4 << 3) + 1), | 551 MADD_D = ((4 << 3) + 1), |
552 | 552 |
553 NULLSF = 0 | 553 NULLSF = 0 |
554 }; | 554 }; |
555 | 555 |
556 | 556 |
557 // ----- Emulated conditions. | 557 // ----- Emulated conditions. |
558 // On MIPS we use this enum to abstract from conditionnal branch instructions. | 558 // On MIPS we use this enum to abstract from conditional branch instructions. |
559 // The 'U' prefix is used to specify unsigned comparisons. | 559 // The 'U' prefix is used to specify unsigned comparisons. |
560 // Oppposite conditions must be paired as odd/even numbers | 560 // Opposite conditions must be paired as odd/even numbers |
561 // because 'NegateCondition' function flips LSB to negate condition. | 561 // because 'NegateCondition' function flips LSB to negate condition. |
562 enum Condition { | 562 enum Condition { |
563 // Any value < 0 is considered no_condition. | 563 // Any value < 0 is considered no_condition. |
564 kNoCondition = -1, | 564 kNoCondition = -1, |
565 overflow = 0, | 565 overflow = 0, |
566 no_overflow = 1, | 566 no_overflow = 1, |
567 Uless = 2, | 567 Uless = 2, |
568 Ugreater_equal = 3, | 568 Ugreater_equal = 3, |
569 equal = 4, | 569 Uless_equal = 4, |
570 not_equal = 5, | 570 Ugreater = 5, |
571 Uless_equal = 6, | 571 equal = 6, |
572 Ugreater = 7, | 572 not_equal = 7, // Unordered or Not Equal. |
573 negative = 8, | 573 negative = 8, |
574 positive = 9, | 574 positive = 9, |
575 parity_even = 10, | 575 parity_even = 10, |
576 parity_odd = 11, | 576 parity_odd = 11, |
577 less = 12, | 577 less = 12, |
578 greater_equal = 13, | 578 greater_equal = 13, |
579 less_equal = 14, | 579 less_equal = 14, |
580 greater = 15, | 580 greater = 15, |
581 ueq = 16, // Unordered or Equal. | 581 ueq = 16, // Unordered or Equal. |
582 nue = 17, // Not (Unordered or Equal). | 582 ogl = 17, // Ordered and Not Equal. |
583 cc_always = 18, | 583 cc_always = 18, |
584 | 584 |
585 // Aliases. | 585 // Aliases. |
586 carry = Uless, | 586 carry = Uless, |
587 not_carry = Ugreater_equal, | 587 not_carry = Ugreater_equal, |
588 zero = equal, | 588 zero = equal, |
589 eq = equal, | 589 eq = equal, |
590 not_zero = not_equal, | 590 not_zero = not_equal, |
591 ne = not_equal, | 591 ne = not_equal, |
592 nz = not_equal, | 592 nz = not_equal, |
593 sign = negative, | 593 sign = negative, |
594 not_sign = positive, | 594 not_sign = positive, |
595 mi = negative, | 595 mi = negative, |
596 pl = positive, | 596 pl = positive, |
597 hi = Ugreater, | 597 hi = Ugreater, |
598 ls = Uless_equal, | 598 ls = Uless_equal, |
599 ge = greater_equal, | 599 ge = greater_equal, |
600 lt = less, | 600 lt = less, |
601 gt = greater, | 601 gt = greater, |
602 le = less_equal, | 602 le = less_equal, |
603 hs = Ugreater_equal, | 603 hs = Ugreater_equal, |
604 lo = Uless, | 604 lo = Uless, |
605 al = cc_always, | 605 al = cc_always, |
| 606 ult = Uless, |
| 607 uge = Ugreater_equal, |
| 608 ule = Uless_equal, |
| 609 ugt = Ugreater, |
606 cc_default = kNoCondition | 610 cc_default = kNoCondition |
607 }; | 611 }; |
608 | 612 |
609 | 613 |
610 // Returns the equivalent of !cc. | 614 // Returns the equivalent of !cc. |
611 // Negation of the default kNoCondition (-1) results in a non-default | 615 // Negation of the default kNoCondition (-1) results in a non-default |
612 // no_condition value (-2). As long as tests for no_condition check | 616 // no_condition value (-2). As long as tests for no_condition check |
613 // for condition < 0, this will work as expected. | 617 // for condition < 0, this will work as expected. |
614 inline Condition NegateCondition(Condition cc) { | 618 inline Condition NegateCondition(Condition cc) { |
615 DCHECK(cc != cc_always); | 619 DCHECK(cc != cc_always); |
616 return static_cast<Condition>(cc ^ 1); | 620 return static_cast<Condition>(cc ^ 1); |
617 } | 621 } |
618 | 622 |
619 | 623 |
| 624 inline Condition NegateFpuCondition(Condition cc) { |
| 625 DCHECK(cc != cc_always); |
| 626 switch (cc) { |
| 627 case ult: |
| 628 return ge; |
| 629 case ugt: |
| 630 return le; |
| 631 case uge: |
| 632 return lt; |
| 633 case ule: |
| 634 return gt; |
| 635 case lt: |
| 636 return uge; |
| 637 case gt: |
| 638 return ule; |
| 639 case ge: |
| 640 return ult; |
| 641 case le: |
| 642 return ugt; |
| 643 case eq: |
| 644 return ne; |
| 645 case ne: |
| 646 return eq; |
| 647 case ueq: |
| 648 return ogl; |
| 649 case ogl: |
| 650 return ueq; |
| 651 default: |
| 652 return cc; |
| 653 } |
| 654 } |
| 655 |
| 656 |
620 // Commute a condition such that {a cond b == b cond' a}. | 657 // Commute a condition such that {a cond b == b cond' a}. |
621 inline Condition CommuteCondition(Condition cc) { | 658 inline Condition CommuteCondition(Condition cc) { |
622 switch (cc) { | 659 switch (cc) { |
623 case Uless: | 660 case Uless: |
624 return Ugreater; | 661 return Ugreater; |
625 case Ugreater: | 662 case Ugreater: |
626 return Uless; | 663 return Uless; |
627 case Ugreater_equal: | 664 case Ugreater_equal: |
628 return Uless_equal; | 665 return Uless_equal; |
629 case Uless_equal: | 666 case Uless_equal: |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 // JS argument slots size. | 966 // JS argument slots size. |
930 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 967 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
931 // Assembly builtins argument slots size. | 968 // Assembly builtins argument slots size. |
932 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 969 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
933 | 970 |
934 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 971 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
935 | 972 |
936 } } // namespace v8::internal | 973 } } // namespace v8::internal |
937 | 974 |
938 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 975 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |