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

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

Issue 2535703002: MIPS: Optimize load/store with large offset on MIPSr6 (Closed)
Patch Set: fix errors Created 4 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 | « no previous file | src/mips64/assembler-mips64.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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 rd.code() << kRdShift | sa << kSaShift | LSA; 1772 rd.code() << kRdShift | sa << kSaShift | LSA;
1773 emit(instr); 1773 emit(instr);
1774 } 1774 }
1775 1775
1776 1776
1777 // ------------Memory-instructions------------- 1777 // ------------Memory-instructions-------------
1778 1778
1779 // Helper for base-reg + offset, when offset is larger than int16. 1779 // Helper for base-reg + offset, when offset is larger than int16.
1780 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) { 1780 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) {
1781 DCHECK(!src.rm().is(at)); 1781 DCHECK(!src.rm().is(at));
1782 lui(at, (src.offset_ >> kLuiShift) & kImm16Mask); 1782 if (IsMipsArchVariant(kMips32r6)) {
1783 ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset. 1783 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask;
1784 addu(at, at, src.rm()); // Add base register. 1784 if (src.offset_ & kNegOffset) {
1785 hi += 1;
1786 }
1787 aui(at, src.rm(), hi);
1788 addiu(at, at, src.offset_ & kImm16Mask);
1789 } else {
1790 lui(at, (src.offset_ >> kLuiShift) & kImm16Mask);
1791 ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset.
1792 addu(at, at, src.rm()); // Add base register.
1793 }
1785 } 1794 }
1786 1795
1787 // Helper for base-reg + upper part of offset, when offset is larger than int16. 1796 // Helper for base-reg + upper part of offset, when offset is larger than int16.
1788 // Loads higher part of the offset to AT register. 1797 // Loads higher part of the offset to AT register.
1789 // Returns lower part of the offset to be used as offset 1798 // Returns lower part of the offset to be used as offset
1790 // in Load/Store instructions 1799 // in Load/Store instructions
1791 int32_t Assembler::LoadRegPlusUpperOffsetPartToAt(const MemOperand& src) { 1800 int32_t Assembler::LoadRegPlusUpperOffsetPartToAt(const MemOperand& src) {
1792 DCHECK(!src.rm().is(at)); 1801 DCHECK(!src.rm().is(at));
1793 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask; 1802 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask;
1794 // If the highest bit of the lower part of the offset is 1, this would make 1803 // If the highest bit of the lower part of the offset is 1, this would make
1795 // the offset in the load/store instruction negative. We need to compensate 1804 // the offset in the load/store instruction negative. We need to compensate
1796 // for this by adding 1 to the upper part of the offset. 1805 // for this by adding 1 to the upper part of the offset.
1797 if (src.offset_ & kNegOffset) { 1806 if (src.offset_ & kNegOffset) {
1798 hi += 1; 1807 hi += 1;
1799 } 1808 }
1800 lui(at, hi); 1809
1801 addu(at, at, src.rm()); 1810 if (IsMipsArchVariant(kMips32r6)) {
1811 aui(at, src.rm(), hi);
1812 } else {
1813 lui(at, hi);
1814 addu(at, at, src.rm());
1815 }
1802 return (src.offset_ & kImm16Mask); 1816 return (src.offset_ & kImm16Mask);
1803 } 1817 }
1804 1818
1805 // Helper for loading base-reg + upper offset's part to AT reg when we are using 1819 // Helper for loading base-reg + upper offset's part to AT reg when we are using
1806 // two 32-bit loads/stores instead of one 64-bit 1820 // two 32-bit loads/stores instead of one 64-bit
1807 int32_t Assembler::LoadUpperOffsetForTwoMemoryAccesses(const MemOperand& src) { 1821 int32_t Assembler::LoadUpperOffsetForTwoMemoryAccesses(const MemOperand& src) {
1808 DCHECK(!src.rm().is(at)); 1822 DCHECK(!src.rm().is(at));
1809 if (is_int16((src.offset_ & kImm16Mask) + kIntSize)) { 1823 if (is_int16((src.offset_ & kImm16Mask) + kIntSize)) {
1810 // Only if lower part of offset + kIntSize fits in 16bits 1824 // Only if lower part of offset + kIntSize fits in 16bits
1811 return LoadRegPlusUpperOffsetPartToAt(src); 1825 return LoadRegPlusUpperOffsetPartToAt(src);
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 3273
3260 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3274 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3261 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3275 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3262 } 3276 }
3263 } 3277 }
3264 3278
3265 } // namespace internal 3279 } // namespace internal
3266 } // namespace v8 3280 } // namespace v8
3267 3281
3268 #endif // V8_TARGET_ARCH_MIPS 3282 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698