OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 // possible to align the pc offset to a multiple | 719 // possible to align the pc offset to a multiple |
720 // of m. m must be a power of 2 (>= 4). | 720 // of m. m must be a power of 2 (>= 4). |
721 void Align(int m); | 721 void Align(int m); |
722 // Insert the smallest number of zero bytes possible to align the pc offset | 722 // Insert the smallest number of zero bytes possible to align the pc offset |
723 // to a mulitple of m. m must be a power of 2 (>= 2). | 723 // to a mulitple of m. m must be a power of 2 (>= 2). |
724 void DataAlign(int m); | 724 void DataAlign(int m); |
725 // Aligns code to something that's optimal for a jump target for the platform. | 725 // Aligns code to something that's optimal for a jump target for the platform. |
726 void CodeTargetAlign(); | 726 void CodeTargetAlign(); |
727 | 727 |
728 // Branch instructions | 728 // Branch instructions |
729 void bclr(BOfield bo, LKBit lk); | 729 void bclr(BOfield bo, int condition_bit, LKBit lk); |
730 void blr(); | 730 void blr(); |
731 void bc(int branch_offset, BOfield bo, int condition_bit, LKBit lk = LeaveLK); | 731 void bc(int branch_offset, BOfield bo, int condition_bit, LKBit lk = LeaveLK); |
732 void b(int branch_offset, LKBit lk); | 732 void b(int branch_offset, LKBit lk); |
733 | 733 |
734 void bcctr(BOfield bo, LKBit lk); | 734 void bcctr(BOfield bo, int condition_bit, LKBit lk); |
735 void bctr(); | 735 void bctr(); |
736 void bctrl(); | 736 void bctrl(); |
737 | 737 |
738 // Convenience branch instructions using labels | 738 // Convenience branch instructions using labels |
739 void b(Label* L, LKBit lk = LeaveLK) { b(branch_offset(L), lk); } | 739 void b(Label* L, LKBit lk = LeaveLK) { b(branch_offset(L), lk); } |
740 | 740 |
741 inline CRegister cmpi_optimization(CRegister cr) { | 741 inline CRegister cmpi_optimization(CRegister cr) { |
742 // Check whether the branch is preceeded by an optimizable cmpi against 0. | 742 // Check whether the branch is preceeded by an optimizable cmpi against 0. |
743 // The cmpi can be deleted if it is also preceeded by an instruction that | 743 // The cmpi can be deleted if it is also preceeded by an instruction that |
744 // sets the register used by the compare and supports a dot form. | 744 // sets the register used by the compare and supports a dot form. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 bc(b_offset, BT, encode_crbit(cr, CR_SO), lk); | 812 bc(b_offset, BT, encode_crbit(cr, CR_SO), lk); |
813 break; | 813 break; |
814 case nooverflow: | 814 case nooverflow: |
815 bc(b_offset, BF, encode_crbit(cr, CR_SO), lk); | 815 bc(b_offset, BF, encode_crbit(cr, CR_SO), lk); |
816 break; | 816 break; |
817 default: | 817 default: |
818 UNIMPLEMENTED(); | 818 UNIMPLEMENTED(); |
819 } | 819 } |
820 } | 820 } |
821 | 821 |
| 822 void bclr(Condition cond, CRegister cr = cr7, LKBit lk = LeaveLK) { |
| 823 DCHECK(cond != al); |
| 824 DCHECK(cr.code() >= 0 && cr.code() <= 7); |
| 825 |
| 826 cr = cmpi_optimization(cr); |
| 827 |
| 828 switch (cond) { |
| 829 case eq: |
| 830 bclr(BT, encode_crbit(cr, CR_EQ), lk); |
| 831 break; |
| 832 case ne: |
| 833 bclr(BF, encode_crbit(cr, CR_EQ), lk); |
| 834 break; |
| 835 case gt: |
| 836 bclr(BT, encode_crbit(cr, CR_GT), lk); |
| 837 break; |
| 838 case le: |
| 839 bclr(BF, encode_crbit(cr, CR_GT), lk); |
| 840 break; |
| 841 case lt: |
| 842 bclr(BT, encode_crbit(cr, CR_LT), lk); |
| 843 break; |
| 844 case ge: |
| 845 bclr(BF, encode_crbit(cr, CR_LT), lk); |
| 846 break; |
| 847 case unordered: |
| 848 bclr(BT, encode_crbit(cr, CR_FU), lk); |
| 849 break; |
| 850 case ordered: |
| 851 bclr(BF, encode_crbit(cr, CR_FU), lk); |
| 852 break; |
| 853 case overflow: |
| 854 bclr(BT, encode_crbit(cr, CR_SO), lk); |
| 855 break; |
| 856 case nooverflow: |
| 857 bclr(BF, encode_crbit(cr, CR_SO), lk); |
| 858 break; |
| 859 default: |
| 860 UNIMPLEMENTED(); |
| 861 } |
| 862 } |
| 863 |
822 void isel(Register rt, Register ra, Register rb, int cb); | 864 void isel(Register rt, Register ra, Register rb, int cb); |
823 void isel(Condition cond, Register rt, Register ra, Register rb, | 865 void isel(Condition cond, Register rt, Register ra, Register rb, |
824 CRegister cr = cr7) { | 866 CRegister cr = cr7) { |
825 DCHECK(cond != al); | 867 DCHECK(cond != al); |
826 DCHECK(cr.code() >= 0 && cr.code() <= 7); | 868 DCHECK(cr.code() >= 0 && cr.code() <= 7); |
827 | 869 |
828 cr = cmpi_optimization(cr); | 870 cr = cmpi_optimization(cr); |
829 | 871 |
830 switch (cond) { | 872 switch (cond) { |
831 case eq: | 873 case eq: |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 | 1609 |
1568 | 1610 |
1569 class EnsureSpace BASE_EMBEDDED { | 1611 class EnsureSpace BASE_EMBEDDED { |
1570 public: | 1612 public: |
1571 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } | 1613 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } |
1572 }; | 1614 }; |
1573 } | 1615 } |
1574 } // namespace v8::internal | 1616 } // namespace v8::internal |
1575 | 1617 |
1576 #endif // V8_PPC_ASSEMBLER_PPC_H_ | 1618 #endif // V8_PPC_ASSEMBLER_PPC_H_ |
OLD | NEW |