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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 #define DECLARE_PPC_X_INSTRUCTIONS_F_FORM(name, instr_name, instr_value) \ | 591 #define DECLARE_PPC_X_INSTRUCTIONS_F_FORM(name, instr_name, instr_value) \ |
592 inline void name(const Register src1, const Register src2, \ | 592 inline void name(const Register src1, const Register src2, \ |
593 const CRegister cr = cr7, const RCBit rc = LeaveRC) { \ | 593 const CRegister cr = cr7, const RCBit rc = LeaveRC) { \ |
594 x_form(instr_name, cr, src1, src2, rc); \ | 594 x_form(instr_name, cr, src1, src2, rc); \ |
595 } \ | 595 } \ |
596 inline void name##w(const Register src1, const Register src2, \ | 596 inline void name##w(const Register src1, const Register src2, \ |
597 const CRegister cr = cr7, const RCBit rc = LeaveRC) { \ | 597 const CRegister cr = cr7, const RCBit rc = LeaveRC) { \ |
598 x_form(instr_name, cr.code() * B2, src1.code(), src2.code(), LeaveRC); \ | 598 x_form(instr_name, cr.code() * B2, src1.code(), src2.code(), LeaveRC); \ |
599 } | 599 } |
600 | 600 |
| 601 #define DECLARE_PPC_X_INSTRUCTIONS_EH_S_FORM(name, instr_name, instr_value) \ |
| 602 inline void name(const Register dst, const MemOperand& src) { \ |
| 603 x_form(instr_name, src.ra(), dst, src.rb(), SetEH); \ |
| 604 } |
| 605 #define DECLARE_PPC_X_INSTRUCTIONS_EH_L_FORM(name, instr_name, instr_value) \ |
| 606 inline void name(const Register dst, const MemOperand& src) { \ |
| 607 DCHECK(!src.ra_.is(r0)); \ |
| 608 x_form(instr_name, src.ra(), dst, src.rb(), SetEH); \ |
| 609 } |
| 610 |
601 inline void x_form(Instr instr, int f1, int f2, int f3, int rc) { | 611 inline void x_form(Instr instr, int f1, int f2, int f3, int rc) { |
602 emit(instr | f1 * B21 | f2 * B16 | f3 * B11 | rc); | 612 emit(instr | f1 * B21 | f2 * B16 | f3 * B11 | rc); |
603 } | 613 } |
604 inline void x_form(Instr instr, Register rs, Register ra, Register rb, | 614 inline void x_form(Instr instr, Register rs, Register ra, Register rb, |
605 RCBit rc) { | 615 RCBit rc) { |
606 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | rc); | 616 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | rc); |
607 } | 617 } |
| 618 inline void x_form(Instr instr, Register ra, Register rs, Register rb, |
| 619 EHBit eh = SetEH) { |
| 620 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | eh); |
| 621 } |
608 inline void x_form(Instr instr, CRegister cr, Register s1, Register s2, | 622 inline void x_form(Instr instr, CRegister cr, Register s1, Register s2, |
609 RCBit rc) { | 623 RCBit rc) { |
610 #if V8_TARGET_ARCH_PPC64 | 624 #if V8_TARGET_ARCH_PPC64 |
611 int L = 1; | 625 int L = 1; |
612 #else | 626 #else |
613 int L = 0; | 627 int L = 0; |
614 #endif | 628 #endif |
615 emit(instr | cr.code() * B23 | L * B21 | s1.code() * B16 | | 629 emit(instr | cr.code() * B23 | L * B21 | s1.code() * B16 | |
616 s2.code() * B11 | rc); | 630 s2.code() * B11 | rc); |
617 } | 631 } |
618 | 632 |
619 PPC_X_OPCODE_A_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_A_FORM) | 633 PPC_X_OPCODE_A_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_A_FORM) |
620 PPC_X_OPCODE_B_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_B_FORM) | 634 PPC_X_OPCODE_B_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_B_FORM) |
621 PPC_X_OPCODE_C_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_C_FORM) | 635 PPC_X_OPCODE_C_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_C_FORM) |
622 PPC_X_OPCODE_D_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_D_FORM) | 636 PPC_X_OPCODE_D_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_D_FORM) |
623 PPC_X_OPCODE_E_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_E_FORM) | 637 PPC_X_OPCODE_E_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_E_FORM) |
624 PPC_X_OPCODE_F_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_F_FORM) | 638 PPC_X_OPCODE_F_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_F_FORM) |
| 639 PPC_X_OPCODE_EH_S_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_EH_S_FORM) |
| 640 PPC_X_OPCODE_EH_L_FORM_LIST(DECLARE_PPC_X_INSTRUCTIONS_EH_L_FORM) |
625 | 641 |
626 inline void notx(Register dst, Register src, RCBit rc = LeaveRC) { | 642 inline void notx(Register dst, Register src, RCBit rc = LeaveRC) { |
627 nor(dst, src, src, rc); | 643 nor(dst, src, src, rc); |
628 } | 644 } |
629 inline void lwax(Register rt, const MemOperand& src) { | 645 inline void lwax(Register rt, const MemOperand& src) { |
630 #if V8_TARGET_ARCH_PPC64 | 646 #if V8_TARGET_ARCH_PPC64 |
631 Register ra = src.ra(); | 647 Register ra = src.ra(); |
632 Register rb = src.rb(); | 648 Register rb = src.rb(); |
633 DCHECK(!ra.is(r0)); | 649 DCHECK(!ra.is(r0)); |
634 x_form(LWAX, rt, ra, rb, LeaveRC); | 650 x_form(LWAX, rt, ra, rb, LeaveRC); |
635 #else | 651 #else |
636 lwzx(rt, src); | 652 lwzx(rt, src); |
637 #endif | 653 #endif |
638 } | 654 } |
639 inline void extsw(Register rs, Register ra, RCBit rc = LeaveRC) { | 655 inline void extsw(Register rs, Register ra, RCBit rc = LeaveRC) { |
640 #if V8_TARGET_ARCH_PPC64 | 656 #if V8_TARGET_ARCH_PPC64 |
641 emit(EXT2 | EXTSW | ra.code() * B21 | rs.code() * B16 | rc); | 657 emit(EXT2 | EXTSW | ra.code() * B21 | rs.code() * B16 | rc); |
642 #else | 658 #else |
643 // nop on 32-bit | 659 // nop on 32-bit |
644 DCHECK(rs.is(ra) && rc == LeaveRC); | 660 DCHECK(rs.is(ra) && rc == LeaveRC); |
645 #endif | 661 #endif |
646 } | 662 } |
647 | 663 |
648 #undef DECLARE_PPC_X_INSTRUCTIONS_A_FORM | 664 #undef DECLARE_PPC_X_INSTRUCTIONS_A_FORM |
649 #undef DECLARE_PPC_X_INSTRUCTIONS_B_FORM | 665 #undef DECLARE_PPC_X_INSTRUCTIONS_B_FORM |
650 #undef DECLARE_PPC_X_INSTRUCTIONS_C_FORM | 666 #undef DECLARE_PPC_X_INSTRUCTIONS_C_FORM |
651 #undef DECLARE_PPC_X_INSTRUCTIONS_D_FORM | 667 #undef DECLARE_PPC_X_INSTRUCTIONS_D_FORM |
652 #undef DECLARE_PPC_X_INSTRUCTIONS_E_FORM | 668 #undef DECLARE_PPC_X_INSTRUCTIONS_E_FORM |
653 #undef DECLARE_PPC_X_INSTRUCTIONS_F_FORM | 669 #undef DECLARE_PPC_X_INSTRUCTIONS_F_FORM |
| 670 #undef DECLARE_PPC_X_INSTRUCTIONS_EH_S_FORM |
| 671 #undef DECLARE_PPC_X_INSTRUCTIONS_EH_L_FORM |
654 | 672 |
655 #define DECLARE_PPC_XX3_INSTRUCTIONS(name, instr_name, instr_value) \ | 673 #define DECLARE_PPC_XX3_INSTRUCTIONS(name, instr_name, instr_value) \ |
656 inline void name(const DoubleRegister rt, const DoubleRegister ra, \ | 674 inline void name(const DoubleRegister rt, const DoubleRegister ra, \ |
657 const DoubleRegister rb) { \ | 675 const DoubleRegister rb) { \ |
658 xx3_form(instr_name, rt, ra, rb); \ | 676 xx3_form(instr_name, rt, ra, rb); \ |
659 } | 677 } |
660 | 678 |
661 inline void xx3_form(Instr instr, DoubleRegister t, DoubleRegister a, | 679 inline void xx3_form(Instr instr, DoubleRegister t, DoubleRegister a, |
662 DoubleRegister b) { | 680 DoubleRegister b) { |
663 int AX = ((a.code() & 0x20) >> 5) & 0x1; | 681 int AX = ((a.code() & 0x20) >> 5) & 0x1; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 void lbz(Register dst, const MemOperand& src); | 989 void lbz(Register dst, const MemOperand& src); |
972 void lhz(Register dst, const MemOperand& src); | 990 void lhz(Register dst, const MemOperand& src); |
973 void lha(Register dst, const MemOperand& src); | 991 void lha(Register dst, const MemOperand& src); |
974 void lwz(Register dst, const MemOperand& src); | 992 void lwz(Register dst, const MemOperand& src); |
975 void lwzu(Register dst, const MemOperand& src); | 993 void lwzu(Register dst, const MemOperand& src); |
976 void lwa(Register dst, const MemOperand& src); | 994 void lwa(Register dst, const MemOperand& src); |
977 void stb(Register dst, const MemOperand& src); | 995 void stb(Register dst, const MemOperand& src); |
978 void sth(Register dst, const MemOperand& src); | 996 void sth(Register dst, const MemOperand& src); |
979 void stw(Register dst, const MemOperand& src); | 997 void stw(Register dst, const MemOperand& src); |
980 void stwu(Register dst, const MemOperand& src); | 998 void stwu(Register dst, const MemOperand& src); |
981 | |
982 void neg(Register rt, Register ra, OEBit o = LeaveOE, RCBit c = LeaveRC); | 999 void neg(Register rt, Register ra, OEBit o = LeaveOE, RCBit c = LeaveRC); |
983 | 1000 |
984 #if V8_TARGET_ARCH_PPC64 | 1001 #if V8_TARGET_ARCH_PPC64 |
985 void ld(Register rd, const MemOperand& src); | 1002 void ld(Register rd, const MemOperand& src); |
986 void ldu(Register rd, const MemOperand& src); | 1003 void ldu(Register rd, const MemOperand& src); |
987 void std(Register rs, const MemOperand& src); | 1004 void std(Register rs, const MemOperand& src); |
988 void stdu(Register rs, const MemOperand& src); | 1005 void stdu(Register rs, const MemOperand& src); |
989 void rldic(Register dst, Register src, int sh, int mb, RCBit r = LeaveRC); | 1006 void rldic(Register dst, Register src, int sh, int mb, RCBit r = LeaveRC); |
990 void rldicl(Register dst, Register src, int sh, int mb, RCBit r = LeaveRC); | 1007 void rldicl(Register dst, Register src, int sh, int mb, RCBit r = LeaveRC); |
991 void rldcl(Register ra, Register rs, Register rb, int mb, RCBit r = LeaveRC); | 1008 void rldcl(Register ra, Register rs, Register rb, int mb, RCBit r = LeaveRC); |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 PatchingAssembler(IsolateData isolate_data, byte* address, int instructions); | 1554 PatchingAssembler(IsolateData isolate_data, byte* address, int instructions); |
1538 ~PatchingAssembler(); | 1555 ~PatchingAssembler(); |
1539 | 1556 |
1540 void FlushICache(Isolate* isolate); | 1557 void FlushICache(Isolate* isolate); |
1541 }; | 1558 }; |
1542 | 1559 |
1543 } // namespace internal | 1560 } // namespace internal |
1544 } // namespace v8 | 1561 } // namespace v8 |
1545 | 1562 |
1546 #endif // V8_PPC_ASSEMBLER_PPC_H_ | 1563 #endif // V8_PPC_ASSEMBLER_PPC_H_ |
OLD | NEW |