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_MACRO_ASSEMBLER_MIPS_H_ | 5 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/mips/assembler-mips.h" | 10 #include "src/mips/assembler-mips.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 inline void Move(FPURegister dst, FPURegister src) { | 229 inline void Move(FPURegister dst, FPURegister src) { |
230 if (!dst.is(src)) { | 230 if (!dst.is(src)) { |
231 mov_d(dst, src); | 231 mov_d(dst, src); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 inline void Move(Register dst_low, Register dst_high, FPURegister src) { | 235 inline void Move(Register dst_low, Register dst_high, FPURegister src) { |
236 mfc1(dst_low, src); | 236 mfc1(dst_low, src); |
237 mfc1(dst_high, FPURegister::from_code(src.code() + 1)); | 237 Mfhc1(dst_high, src); |
238 } | 238 } |
239 | 239 |
240 inline void FmoveHigh(Register dst_high, FPURegister src) { | 240 inline void FmoveHigh(Register dst_high, FPURegister src) { |
241 mfc1(dst_high, FPURegister::from_code(src.code() + 1)); | 241 Mfhc1(dst_high, src); |
242 } | 242 } |
243 | 243 |
244 inline void FmoveLow(Register dst_low, FPURegister src) { | 244 inline void FmoveLow(Register dst_low, FPURegister src) { |
245 mfc1(dst_low, src); | 245 mfc1(dst_low, src); |
246 } | 246 } |
247 | 247 |
248 inline void Move(FPURegister dst, Register src_low, Register src_high) { | 248 inline void Move(FPURegister dst, Register src_low, Register src_high) { |
249 mtc1(src_low, dst); | 249 mtc1(src_low, dst); |
250 mtc1(src_high, FPURegister::from_code(dst.code() + 1)); | 250 Mthc1(src_high, dst); |
251 } | 251 } |
252 | 252 |
253 // Conditional move. | 253 // Conditional move. |
254 void Move(FPURegister dst, double imm); | 254 void Move(FPURegister dst, double imm); |
255 void Movz(Register rd, Register rs, Register rt); | 255 void Movz(Register rd, Register rs, Register rt); |
256 void Movn(Register rd, Register rs, Register rt); | 256 void Movn(Register rd, Register rs, Register rt); |
257 void Movt(Register rd, Register rs, uint16_t cc = 0); | 257 void Movt(Register rd, Register rs, uint16_t cc = 0); |
258 void Movf(Register rd, Register rs, uint16_t cc = 0); | 258 void Movf(Register rd, Register rs, uint16_t cc = 0); |
259 | 259 |
260 void Clz(Register rd, Register rs); | 260 void Clz(Register rd, Register rs); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 575 |
576 #define DEFINE_INSTRUCTION2(instr) \ | 576 #define DEFINE_INSTRUCTION2(instr) \ |
577 void instr(Register rs, const Operand& rt); \ | 577 void instr(Register rs, const Operand& rt); \ |
578 void instr(Register rs, Register rt) { \ | 578 void instr(Register rs, Register rt) { \ |
579 instr(rs, Operand(rt)); \ | 579 instr(rs, Operand(rt)); \ |
580 } \ | 580 } \ |
581 void instr(Register rs, int32_t j) { \ | 581 void instr(Register rs, int32_t j) { \ |
582 instr(rs, Operand(j)); \ | 582 instr(rs, Operand(j)); \ |
583 } | 583 } |
584 | 584 |
| 585 #define DEFINE_INSTRUCTION3(instr) \ |
| 586 void instr(Register rd_hi, Register rd_lo, Register rs, const Operand& rt); \ |
| 587 void instr(Register rd_hi, Register rd_lo, Register rs, Register rt) { \ |
| 588 instr(rd_hi, rd_lo, rs, Operand(rt)); \ |
| 589 } \ |
| 590 void instr(Register rd_hi, Register rd_lo, Register rs, int32_t j) { \ |
| 591 instr(rd_hi, rd_lo, rs, Operand(j)); \ |
| 592 } |
| 593 |
585 DEFINE_INSTRUCTION(Addu); | 594 DEFINE_INSTRUCTION(Addu); |
586 DEFINE_INSTRUCTION(Subu); | 595 DEFINE_INSTRUCTION(Subu); |
587 DEFINE_INSTRUCTION(Mul); | 596 DEFINE_INSTRUCTION(Mul); |
| 597 DEFINE_INSTRUCTION(Mod); |
| 598 DEFINE_INSTRUCTION(Mulh); |
588 DEFINE_INSTRUCTION2(Mult); | 599 DEFINE_INSTRUCTION2(Mult); |
589 DEFINE_INSTRUCTION2(Multu); | 600 DEFINE_INSTRUCTION2(Multu); |
590 DEFINE_INSTRUCTION2(Div); | 601 DEFINE_INSTRUCTION2(Div); |
591 DEFINE_INSTRUCTION2(Divu); | 602 DEFINE_INSTRUCTION2(Divu); |
592 | 603 |
| 604 DEFINE_INSTRUCTION3(Div); |
| 605 DEFINE_INSTRUCTION3(Mul); |
| 606 |
593 DEFINE_INSTRUCTION(And); | 607 DEFINE_INSTRUCTION(And); |
594 DEFINE_INSTRUCTION(Or); | 608 DEFINE_INSTRUCTION(Or); |
595 DEFINE_INSTRUCTION(Xor); | 609 DEFINE_INSTRUCTION(Xor); |
596 DEFINE_INSTRUCTION(Nor); | 610 DEFINE_INSTRUCTION(Nor); |
597 DEFINE_INSTRUCTION2(Neg); | 611 DEFINE_INSTRUCTION2(Neg); |
598 | 612 |
599 DEFINE_INSTRUCTION(Slt); | 613 DEFINE_INSTRUCTION(Slt); |
600 DEFINE_INSTRUCTION(Sltu); | 614 DEFINE_INSTRUCTION(Sltu); |
601 | 615 |
602 // MIPS32 R2 instruction macro. | 616 // MIPS32 R2 instruction macro. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 void Cvt_d_uw(FPURegister fd, Register rs, FPURegister scratch); | 749 void Cvt_d_uw(FPURegister fd, Register rs, FPURegister scratch); |
736 | 750 |
737 // Convert double to unsigned word. | 751 // Convert double to unsigned word. |
738 void Trunc_uw_d(FPURegister fd, FPURegister fs, FPURegister scratch); | 752 void Trunc_uw_d(FPURegister fd, FPURegister fs, FPURegister scratch); |
739 void Trunc_uw_d(FPURegister fd, Register rs, FPURegister scratch); | 753 void Trunc_uw_d(FPURegister fd, Register rs, FPURegister scratch); |
740 | 754 |
741 void Trunc_w_d(FPURegister fd, FPURegister fs); | 755 void Trunc_w_d(FPURegister fd, FPURegister fs); |
742 void Round_w_d(FPURegister fd, FPURegister fs); | 756 void Round_w_d(FPURegister fd, FPURegister fs); |
743 void Floor_w_d(FPURegister fd, FPURegister fs); | 757 void Floor_w_d(FPURegister fd, FPURegister fs); |
744 void Ceil_w_d(FPURegister fd, FPURegister fs); | 758 void Ceil_w_d(FPURegister fd, FPURegister fs); |
| 759 |
| 760 // FP32 mode: Move the general purpose register into |
| 761 // the high part of the double-register pair. |
| 762 // FP64 mode: Move the general-purpose register into |
| 763 // the higher 32 bits of the 64-bit coprocessor register, |
| 764 // while leaving the low bits unchanged. |
| 765 void Mthc1(Register rt, FPURegister fs); |
| 766 |
| 767 // FP32 mode: move the high part of the double-register pair into |
| 768 // general purpose register. |
| 769 // FP64 mode: Move the higher 32 bits of the 64-bit coprocessor register into |
| 770 // general-purpose register. |
| 771 void Mfhc1(Register rt, FPURegister fs); |
| 772 |
745 // Wrapper function for the different cmp/branch types. | 773 // Wrapper function for the different cmp/branch types. |
746 void BranchF(Label* target, | 774 void BranchF(Label* target, |
747 Label* nan, | 775 Label* nan, |
748 Condition cc, | 776 Condition cc, |
749 FPURegister cmp1, | 777 FPURegister cmp1, |
750 FPURegister cmp2, | 778 FPURegister cmp2, |
751 BranchDelaySlot bd = PROTECT); | 779 BranchDelaySlot bd = PROTECT); |
752 | 780 |
753 // Alternate (inline) version for better readability with USE_DELAY_SLOT. | 781 // Alternate (inline) version for better readability with USE_DELAY_SLOT. |
754 inline void BranchF(BranchDelaySlot bd, | 782 inline void BranchF(BranchDelaySlot bd, |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1722 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1695 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1723 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1696 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1724 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1697 #else | 1725 #else |
1698 #define ACCESS_MASM(masm) masm-> | 1726 #define ACCESS_MASM(masm) masm-> |
1699 #endif | 1727 #endif |
1700 | 1728 |
1701 } } // namespace v8::internal | 1729 } } // namespace v8::internal |
1702 | 1730 |
1703 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1731 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |