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

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

Issue 1483973002: MIPS: [turbofan] Enable Word32 safe shifts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | no next file » | 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 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 // Shifts. 1709 // Shifts.
1710 void Assembler::sll(Register rd, 1710 void Assembler::sll(Register rd,
1711 Register rt, 1711 Register rt,
1712 uint16_t sa, 1712 uint16_t sa,
1713 bool coming_from_nop) { 1713 bool coming_from_nop) {
1714 // Don't allow nop instructions in the form sll zero_reg, zero_reg to be 1714 // Don't allow nop instructions in the form sll zero_reg, zero_reg to be
1715 // generated using the sll instruction. They must be generated using 1715 // generated using the sll instruction. They must be generated using
1716 // nop(int/NopMarkerTypes) or MarkCode(int/NopMarkerTypes) pseudo 1716 // nop(int/NopMarkerTypes) or MarkCode(int/NopMarkerTypes) pseudo
1717 // instructions. 1717 // instructions.
1718 DCHECK(coming_from_nop || !(rd.is(zero_reg) && rt.is(zero_reg))); 1718 DCHECK(coming_from_nop || !(rd.is(zero_reg) && rt.is(zero_reg)));
1719 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SLL); 1719 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, SLL);
1720 } 1720 }
1721 1721
1722 1722
1723 void Assembler::sllv(Register rd, Register rt, Register rs) { 1723 void Assembler::sllv(Register rd, Register rt, Register rs) {
1724 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SLLV); 1724 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SLLV);
1725 } 1725 }
1726 1726
1727 1727
1728 void Assembler::srl(Register rd, Register rt, uint16_t sa) { 1728 void Assembler::srl(Register rd, Register rt, uint16_t sa) {
1729 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SRL); 1729 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, SRL);
1730 } 1730 }
1731 1731
1732 1732
1733 void Assembler::srlv(Register rd, Register rt, Register rs) { 1733 void Assembler::srlv(Register rd, Register rt, Register rs) {
1734 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRLV); 1734 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRLV);
1735 } 1735 }
1736 1736
1737 1737
1738 void Assembler::sra(Register rd, Register rt, uint16_t sa) { 1738 void Assembler::sra(Register rd, Register rt, uint16_t sa) {
1739 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, SRA); 1739 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, SRA);
1740 } 1740 }
1741 1741
1742 1742
1743 void Assembler::srav(Register rd, Register rt, Register rs) { 1743 void Assembler::srav(Register rd, Register rt, Register rs) {
1744 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRAV); 1744 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SRAV);
1745 } 1745 }
1746 1746
1747 1747
1748 void Assembler::rotr(Register rd, Register rt, uint16_t sa) { 1748 void Assembler::rotr(Register rd, Register rt, uint16_t sa) {
1749 // Should be called via MacroAssembler::Ror. 1749 // Should be called via MacroAssembler::Ror.
1750 DCHECK(rd.is_valid() && rt.is_valid() && is_uint5(sa)); 1750 DCHECK(rd.is_valid() && rt.is_valid() && is_uint5(sa));
1751 DCHECK(kArchVariant == kMips64r2 || kArchVariant == kMips64r6); 1751 DCHECK(kArchVariant == kMips64r2 || kArchVariant == kMips64r6);
1752 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift) 1752 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift)
1753 | (rd.code() << kRdShift) | (sa << kSaShift) | SRL; 1753 | (rd.code() << kRdShift) | (sa << kSaShift) | SRL;
1754 emit(instr); 1754 emit(instr);
1755 } 1755 }
1756 1756
1757 1757
1758 void Assembler::rotrv(Register rd, Register rt, Register rs) { 1758 void Assembler::rotrv(Register rd, Register rt, Register rs) {
1759 // Should be called via MacroAssembler::Ror. 1759 // Should be called via MacroAssembler::Ror.
1760 DCHECK(rd.is_valid() && rt.is_valid() && rs.is_valid() ); 1760 DCHECK(rd.is_valid() && rt.is_valid() && rs.is_valid() );
1761 DCHECK(kArchVariant == kMips64r2 || kArchVariant == kMips64r6); 1761 DCHECK(kArchVariant == kMips64r2 || kArchVariant == kMips64r6);
1762 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift) 1762 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift)
1763 | (rd.code() << kRdShift) | (1 << kSaShift) | SRLV; 1763 | (rd.code() << kRdShift) | (1 << kSaShift) | SRLV;
1764 emit(instr); 1764 emit(instr);
1765 } 1765 }
1766 1766
1767 1767
1768 void Assembler::dsll(Register rd, Register rt, uint16_t sa) { 1768 void Assembler::dsll(Register rd, Register rt, uint16_t sa) {
1769 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSLL); 1769 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSLL);
1770 } 1770 }
1771 1771
1772 1772
1773 void Assembler::dsllv(Register rd, Register rt, Register rs) { 1773 void Assembler::dsllv(Register rd, Register rt, Register rs) {
1774 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSLLV); 1774 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSLLV);
1775 } 1775 }
1776 1776
1777 1777
1778 void Assembler::dsrl(Register rd, Register rt, uint16_t sa) { 1778 void Assembler::dsrl(Register rd, Register rt, uint16_t sa) {
1779 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSRL); 1779 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSRL);
1780 } 1780 }
1781 1781
1782 1782
1783 void Assembler::dsrlv(Register rd, Register rt, Register rs) { 1783 void Assembler::dsrlv(Register rd, Register rt, Register rs) {
1784 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSRLV); 1784 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSRLV);
1785 } 1785 }
1786 1786
1787 1787
1788 void Assembler::drotr(Register rd, Register rt, uint16_t sa) { 1788 void Assembler::drotr(Register rd, Register rt, uint16_t sa) {
1789 DCHECK(rd.is_valid() && rt.is_valid() && is_uint5(sa)); 1789 DCHECK(rd.is_valid() && rt.is_valid() && is_uint5(sa));
1790 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift) 1790 Instr instr = SPECIAL | (1 << kRsShift) | (rt.code() << kRtShift)
1791 | (rd.code() << kRdShift) | (sa << kSaShift) | DSRL; 1791 | (rd.code() << kRdShift) | (sa << kSaShift) | DSRL;
1792 emit(instr); 1792 emit(instr);
1793 } 1793 }
1794 1794
1795 1795
1796 void Assembler::drotrv(Register rd, Register rt, Register rs) { 1796 void Assembler::drotrv(Register rd, Register rt, Register rs) {
1797 DCHECK(rd.is_valid() && rt.is_valid() && rs.is_valid() ); 1797 DCHECK(rd.is_valid() && rt.is_valid() && rs.is_valid() );
1798 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift) 1798 Instr instr = SPECIAL | (rs.code() << kRsShift) | (rt.code() << kRtShift)
1799 | (rd.code() << kRdShift) | (1 << kSaShift) | DSRLV; 1799 | (rd.code() << kRdShift) | (1 << kSaShift) | DSRLV;
1800 emit(instr); 1800 emit(instr);
1801 } 1801 }
1802 1802
1803 1803
1804 void Assembler::dsra(Register rd, Register rt, uint16_t sa) { 1804 void Assembler::dsra(Register rd, Register rt, uint16_t sa) {
1805 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSRA); 1805 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSRA);
1806 } 1806 }
1807 1807
1808 1808
1809 void Assembler::dsrav(Register rd, Register rt, Register rs) { 1809 void Assembler::dsrav(Register rd, Register rt, Register rs) {
1810 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSRAV); 1810 GenInstrRegister(SPECIAL, rs, rt, rd, 0, DSRAV);
1811 } 1811 }
1812 1812
1813 1813
1814 void Assembler::dsll32(Register rd, Register rt, uint16_t sa) { 1814 void Assembler::dsll32(Register rd, Register rt, uint16_t sa) {
1815 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSLL32); 1815 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSLL32);
1816 } 1816 }
1817 1817
1818 1818
1819 void Assembler::dsrl32(Register rd, Register rt, uint16_t sa) { 1819 void Assembler::dsrl32(Register rd, Register rt, uint16_t sa) {
1820 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSRL32); 1820 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSRL32);
1821 } 1821 }
1822 1822
1823 1823
1824 void Assembler::dsra32(Register rd, Register rt, uint16_t sa) { 1824 void Assembler::dsra32(Register rd, Register rt, uint16_t sa) {
1825 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa, DSRA32); 1825 GenInstrRegister(SPECIAL, zero_reg, rt, rd, sa & 0x1F, DSRA32);
1826 } 1826 }
1827 1827
1828 1828
1829 // ------------Memory-instructions------------- 1829 // ------------Memory-instructions-------------
1830 1830
1831 // Helper for base-reg + offset, when offset is larger than int16. 1831 // Helper for base-reg + offset, when offset is larger than int16.
1832 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) { 1832 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) {
1833 DCHECK(!src.rm().is(at)); 1833 DCHECK(!src.rm().is(at));
1834 DCHECK(is_int32(src.offset_)); 1834 DCHECK(is_int32(src.offset_));
1835 daddiu(at, zero_reg, (src.offset_ >> kLuiShift) & kImm16Mask); 1835 daddiu(at, zero_reg, (src.offset_ >> kLuiShift) & kImm16Mask);
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3276 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3277 Assembler::FlushICacheWithoutIsolate(pc, 4 * Assembler::kInstrSize); 3277 Assembler::FlushICacheWithoutIsolate(pc, 4 * Assembler::kInstrSize);
3278 } 3278 }
3279 } 3279 }
3280 3280
3281 3281
3282 } // namespace internal 3282 } // namespace internal
3283 } // namespace v8 3283 } // namespace v8
3284 3284
3285 #endif // V8_TARGET_ARCH_MIPS64 3285 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698