Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: src/mips/assembler-mips.cc

Issue 9692048: MIPS: Added support for Loongson architectures. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/mipsu.gypi ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 12 matching lines...) Expand all
23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 // The original source code covered by the above license above has been 31 // The original source code covered by the above license above has been
32 // modified significantly by Google Inc. 32 // modified significantly by Google Inc.
33 // Copyright 2011 the V8 project authors. All rights reserved. 33 // Copyright 2012 the V8 project authors. All rights reserved.
34 34
35 35
36 #include "v8.h" 36 #include "v8.h"
37 37
38 #if defined(V8_TARGET_ARCH_MIPS) 38 #if defined(V8_TARGET_ARCH_MIPS)
39 39
40 #include "mips/assembler-mips-inl.h" 40 #include "mips/assembler-mips-inl.h"
41 #include "serialize.h" 41 #include "serialize.h"
42 42
43 namespace v8 { 43 namespace v8 {
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 1312
1313 1313
1314 void Assembler::srav(Register rd, Register rt, Register rs) { 1314 void Assembler::srav(Register rd, Register rt, Register rs) {
1315 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRAV); 1315 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRAV);
1316 } 1316 }
1317 1317
1318 1318
1319 void Assembler::rotr(Register rd, Register rt, uint16_t sa) { 1319 void Assembler::rotr(Register rd, Register rt, uint16_t sa) {
1320 // Should be called via MacroAssembler::Ror. 1320 // Should be called via MacroAssembler::Ror.
1321 ASSERT(rd.is_valid() && rt.is_valid() && is_uint5(sa)); 1321 ASSERT(rd.is_valid() && rt.is_valid() && is_uint5(sa));
1322 ASSERT(mips32r2); 1322 ASSERT(kArchVariant == kMips32r2);
1323 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift) 1323 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift)
1324 | (rd.code() << kRdShift) | (sa << kSaShift) | SRL; 1324 | (rd.code() << kRdShift) | (sa << kSaShift) | SRL;
1325 emit(instr); 1325 emit(instr);
1326 } 1326 }
1327 1327
1328 1328
1329 void Assembler::rotrv(Register rd, Register rt, Register rs) { 1329 void Assembler::rotrv(Register rd, Register rt, Register rs) {
1330 // Should be called via MacroAssembler::Ror. 1330 // Should be called via MacroAssembler::Ror.
1331 ASSERT(rd.is_valid() && rt.is_valid() && rs.is_valid() ); 1331 ASSERT(rd.is_valid() && rt.is_valid() && rs.is_valid() );
1332 ASSERT(mips32r2); 1332 ASSERT(kArchVariant == kMips32r2);
1333 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift) 1333 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift)
1334 | (rd.code() << kRdShift) | (1 << kSaShift) | SRLV; 1334 | (rd.code() << kRdShift) | (1 << kSaShift) | SRLV;
1335 emit(instr); 1335 emit(instr);
1336 } 1336 }
1337 1337
1338 1338
1339 //------------Memory-instructions------------- 1339 //------------Memory-instructions-------------
1340 1340
1341 // Helper for base-reg + offset, when offset is larger than int16. 1341 // Helper for base-reg + offset, when offset is larger than int16.
1342 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) { 1342 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 // Bit twiddling. 1597 // Bit twiddling.
1598 void Assembler::clz(Register rd, Register rs) { 1598 void Assembler::clz(Register rd, Register rs) {
1599 // Clz instr requires same GPR number in 'rd' and 'rt' fields. 1599 // Clz instr requires same GPR number in 'rd' and 'rt' fields.
1600 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ); 1600 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ);
1601 } 1601 }
1602 1602
1603 1603
1604 void Assembler::ins_(Register rt, Register rs, uint16_t pos, uint16_t size) { 1604 void Assembler::ins_(Register rt, Register rs, uint16_t pos, uint16_t size) {
1605 // Should be called via MacroAssembler::Ins. 1605 // Should be called via MacroAssembler::Ins.
1606 // Ins instr has 'rt' field as dest, and two uint5: msb, lsb. 1606 // Ins instr has 'rt' field as dest, and two uint5: msb, lsb.
1607 ASSERT(mips32r2); 1607 ASSERT(kArchVariant == kMips32r2);
1608 GenInstrRegister(SPECIAL3, rs, rt, pos + size - 1, pos, INS); 1608 GenInstrRegister(SPECIAL3, rs, rt, pos + size - 1, pos, INS);
1609 } 1609 }
1610 1610
1611 1611
1612 void Assembler::ext_(Register rt, Register rs, uint16_t pos, uint16_t size) { 1612 void Assembler::ext_(Register rt, Register rs, uint16_t pos, uint16_t size) {
1613 // Should be called via MacroAssembler::Ext. 1613 // Should be called via MacroAssembler::Ext.
1614 // Ext instr has 'rt' field as dest, and two uint5: msb, lsb. 1614 // Ext instr has 'rt' field as dest, and two uint5: msb, lsb.
1615 ASSERT(mips32r2); 1615 ASSERT(kArchVariant == kMips32r2);
1616 GenInstrRegister(SPECIAL3, rs, rt, size - 1, pos, EXT); 1616 GenInstrRegister(SPECIAL3, rs, rt, size - 1, pos, EXT);
1617 } 1617 }
1618 1618
1619 1619
1620 //--------Coprocessor-instructions---------------- 1620 //--------Coprocessor-instructions----------------
1621 1621
1622 // Load, store, move. 1622 // Load, store, move.
1623 void Assembler::lwc1(FPURegister fd, const MemOperand& src) { 1623 void Assembler::lwc1(FPURegister fd, const MemOperand& src) {
1624 GenInstrImmediate(LWC1, src.rm(), fd, src.offset_); 1624 GenInstrImmediate(LWC1, src.rm(), fd, src.offset_);
1625 } 1625 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 GenInstrRegister(COP1, S, f0, fs, fd, CEIL_W_S); 1765 GenInstrRegister(COP1, S, f0, fs, fd, CEIL_W_S);
1766 } 1766 }
1767 1767
1768 1768
1769 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) { 1769 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) {
1770 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D); 1770 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D);
1771 } 1771 }
1772 1772
1773 1773
1774 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) { 1774 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) {
1775 ASSERT(mips32r2); 1775 ASSERT(kArchVariant == kMips32r2);
1776 GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S); 1776 GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S);
1777 } 1777 }
1778 1778
1779 1779
1780 void Assembler::cvt_l_d(FPURegister fd, FPURegister fs) { 1780 void Assembler::cvt_l_d(FPURegister fd, FPURegister fs) {
1781 ASSERT(mips32r2); 1781 ASSERT(kArchVariant == kMips32r2);
1782 GenInstrRegister(COP1, D, f0, fs, fd, CVT_L_D); 1782 GenInstrRegister(COP1, D, f0, fs, fd, CVT_L_D);
1783 } 1783 }
1784 1784
1785 1785
1786 void Assembler::trunc_l_s(FPURegister fd, FPURegister fs) { 1786 void Assembler::trunc_l_s(FPURegister fd, FPURegister fs) {
1787 ASSERT(mips32r2); 1787 ASSERT(kArchVariant == kMips32r2);
1788 GenInstrRegister(COP1, S, f0, fs, fd, TRUNC_L_S); 1788 GenInstrRegister(COP1, S, f0, fs, fd, TRUNC_L_S);
1789 } 1789 }
1790 1790
1791 1791
1792 void Assembler::trunc_l_d(FPURegister fd, FPURegister fs) { 1792 void Assembler::trunc_l_d(FPURegister fd, FPURegister fs) {
1793 ASSERT(mips32r2); 1793 ASSERT(kArchVariant == kMips32r2);
1794 GenInstrRegister(COP1, D, f0, fs, fd, TRUNC_L_D); 1794 GenInstrRegister(COP1, D, f0, fs, fd, TRUNC_L_D);
1795 } 1795 }
1796 1796
1797 1797
1798 void Assembler::round_l_s(FPURegister fd, FPURegister fs) { 1798 void Assembler::round_l_s(FPURegister fd, FPURegister fs) {
1799 GenInstrRegister(COP1, S, f0, fs, fd, ROUND_L_S); 1799 GenInstrRegister(COP1, S, f0, fs, fd, ROUND_L_S);
1800 } 1800 }
1801 1801
1802 1802
1803 void Assembler::round_l_d(FPURegister fd, FPURegister fs) { 1803 void Assembler::round_l_d(FPURegister fd, FPURegister fs) {
(...skipping 20 matching lines...) Expand all
1824 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_L_D); 1824 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_L_D);
1825 } 1825 }
1826 1826
1827 1827
1828 void Assembler::cvt_s_w(FPURegister fd, FPURegister fs) { 1828 void Assembler::cvt_s_w(FPURegister fd, FPURegister fs) {
1829 GenInstrRegister(COP1, W, f0, fs, fd, CVT_S_W); 1829 GenInstrRegister(COP1, W, f0, fs, fd, CVT_S_W);
1830 } 1830 }
1831 1831
1832 1832
1833 void Assembler::cvt_s_l(FPURegister fd, FPURegister fs) { 1833 void Assembler::cvt_s_l(FPURegister fd, FPURegister fs) {
1834 ASSERT(mips32r2); 1834 ASSERT(kArchVariant == kMips32r2);
1835 GenInstrRegister(COP1, L, f0, fs, fd, CVT_S_L); 1835 GenInstrRegister(COP1, L, f0, fs, fd, CVT_S_L);
1836 } 1836 }
1837 1837
1838 1838
1839 void Assembler::cvt_s_d(FPURegister fd, FPURegister fs) { 1839 void Assembler::cvt_s_d(FPURegister fd, FPURegister fs) {
1840 GenInstrRegister(COP1, D, f0, fs, fd, CVT_S_D); 1840 GenInstrRegister(COP1, D, f0, fs, fd, CVT_S_D);
1841 } 1841 }
1842 1842
1843 1843
1844 void Assembler::cvt_d_w(FPURegister fd, FPURegister fs) { 1844 void Assembler::cvt_d_w(FPURegister fd, FPURegister fs) {
1845 GenInstrRegister(COP1, W, f0, fs, fd, CVT_D_W); 1845 GenInstrRegister(COP1, W, f0, fs, fd, CVT_D_W);
1846 } 1846 }
1847 1847
1848 1848
1849 void Assembler::cvt_d_l(FPURegister fd, FPURegister fs) { 1849 void Assembler::cvt_d_l(FPURegister fd, FPURegister fs) {
1850 ASSERT(mips32r2); 1850 ASSERT(kArchVariant == kMips32r2);
1851 GenInstrRegister(COP1, L, f0, fs, fd, CVT_D_L); 1851 GenInstrRegister(COP1, L, f0, fs, fd, CVT_D_L);
1852 } 1852 }
1853 1853
1854 1854
1855 void Assembler::cvt_d_s(FPURegister fd, FPURegister fs) { 1855 void Assembler::cvt_d_s(FPURegister fd, FPURegister fs) {
1856 GenInstrRegister(COP1, S, f0, fs, fd, CVT_D_S); 1856 GenInstrRegister(COP1, S, f0, fs, fd, CVT_D_S);
1857 } 1857 }
1858 1858
1859 1859
1860 // Conditions. 1860 // Conditions.
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 } 2271 }
2272 2272
2273 if (patched) { 2273 if (patched) {
2274 CPU::FlushICache(pc+2, sizeof(Address)); 2274 CPU::FlushICache(pc+2, sizeof(Address));
2275 } 2275 }
2276 } 2276 }
2277 2277
2278 } } // namespace v8::internal 2278 } } // namespace v8::internal
2279 2279
2280 #endif // V8_TARGET_ARCH_MIPS 2280 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « build/mipsu.gypi ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698