Index: src/mips/assembler-mips.cc |
diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc |
index 865e64c87d26fabb81a7511d774d1fb9b8440c60..f5b235d1f6f1f045fe19ea5ef7709cbfa22bbce8 100644 |
--- a/src/mips/assembler-mips.cc |
+++ b/src/mips/assembler-mips.cc |
@@ -1784,44 +1784,13 @@ |
addu(at, at, src.rm()); // Add base register. |
} |
-// Helper for base-reg + upper part of offset, when offset is larger than int16. |
-// Loads higher part of the offset to AT register. |
-// Returns lower part of the offset to be used as offset |
-// in Load/Store instructions |
-int32_t Assembler::LoadRegPlusUpperOffsetPartToAt(const MemOperand& src) { |
- DCHECK(!src.rm().is(at)); |
- int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask; |
- // If the highest bit of the lower part of the offset is 1, this would make |
- // the offset in the load/store instruction negative. We need to compensate |
- // for this by adding 1 to the upper part of the offset. |
- if (src.offset_ & kNegOffset) { |
- hi += 1; |
- } |
- lui(at, hi); |
- addu(at, at, src.rm()); |
- return (src.offset_ & kImm16Mask); |
-} |
- |
-// Helper for loading base-reg + upper offset's part to AT reg when we are using |
-// two 32-bit loads/stores instead of one 64-bit |
-int32_t Assembler::LoadUpperOffsetForTwoMemoryAccesses(const MemOperand& src) { |
- DCHECK(!src.rm().is(at)); |
- if (is_int16((src.offset_ & kImm16Mask) + kIntSize)) { |
- // Only if lower part of offset + kIntSize fits in 16bits |
- return LoadRegPlusUpperOffsetPartToAt(src); |
- } |
- // In case offset's lower part + kIntSize doesn't fit in 16bits, |
- // load reg + hole offset to AT |
- LoadRegPlusOffsetToAt(src); |
- return 0; |
-} |
void Assembler::lb(Register rd, const MemOperand& rs) { |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(LB, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(LB, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(LB, at, rd, 0); // Equiv to lb(rd, MemOperand(at, 0)); |
} |
} |
@@ -1830,8 +1799,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(LBU, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(LBU, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(LBU, at, rd, 0); // Equiv to lbu(rd, MemOperand(at, 0)); |
} |
} |
@@ -1840,8 +1809,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(LH, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(LH, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(LH, at, rd, 0); // Equiv to lh(rd, MemOperand(at, 0)); |
} |
} |
@@ -1850,8 +1819,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(LHU, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(LHU, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(LHU, at, rd, 0); // Equiv to lhu(rd, MemOperand(at, 0)); |
} |
} |
@@ -1860,8 +1829,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(LW, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(LW, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(LW, at, rd, 0); // Equiv to lw(rd, MemOperand(at, 0)); |
} |
} |
@@ -1886,8 +1855,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(SB, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to store. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(SB, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(SB, at, rd, 0); // Equiv to sb(rd, MemOperand(at, 0)); |
} |
} |
@@ -1896,8 +1865,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(SH, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to store. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(SH, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(SH, at, rd, 0); // Equiv to sh(rd, MemOperand(at, 0)); |
} |
} |
@@ -1906,8 +1875,8 @@ |
if (is_int16(rs.offset_)) { |
GenInstrImmediate(SW, rs.rm(), rd, rs.offset_); |
} else { // Offset > 16 bits, use multiple instructions to store. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
- GenInstrImmediate(SW, at, rd, off16); |
+ LoadRegPlusOffsetToAt(rs); |
+ GenInstrImmediate(SW, at, rd, 0); // Equiv to sw(rd, MemOperand(at, 0)); |
} |
} |
@@ -2203,8 +2172,8 @@ |
if (is_int16(src.offset_)) { |
GenInstrImmediate(LWC1, src.rm(), fd, src.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(src); |
- GenInstrImmediate(LWC1, at, fd, off16); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(LWC1, at, fd, 0); |
} |
} |
@@ -2221,11 +2190,11 @@ |
GenInstrImmediate(LWC1, src.rm(), nextfpreg, |
src.offset_ + Register::kExponentOffset); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadUpperOffsetForTwoMemoryAccesses(src); |
- GenInstrImmediate(LWC1, at, fd, off16 + Register::kMantissaOffset); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(LWC1, at, fd, Register::kMantissaOffset); |
FPURegister nextfpreg; |
nextfpreg.setcode(fd.code() + 1); |
- GenInstrImmediate(LWC1, at, nextfpreg, off16 + Register::kExponentOffset); |
+ GenInstrImmediate(LWC1, at, nextfpreg, Register::kExponentOffset); |
} |
} else { |
DCHECK(IsFp64Mode() || IsFpxxMode()); |
@@ -2238,9 +2207,9 @@ |
src.offset_ + Register::kExponentOffset); |
mthc1(at, fd); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadUpperOffsetForTwoMemoryAccesses(src); |
- GenInstrImmediate(LWC1, at, fd, off16 + Register::kMantissaOffset); |
- GenInstrImmediate(LW, at, at, off16 + Register::kExponentOffset); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(LWC1, at, fd, Register::kMantissaOffset); |
+ GenInstrImmediate(LW, at, at, Register::kExponentOffset); |
mthc1(at, fd); |
} |
} |
@@ -2251,8 +2220,8 @@ |
if (is_int16(src.offset_)) { |
GenInstrImmediate(SWC1, src.rm(), fd, src.offset_); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadRegPlusUpperOffsetPartToAt(src); |
- GenInstrImmediate(SWC1, at, fd, off16); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(SWC1, at, fd, 0); |
} |
} |
@@ -2271,11 +2240,11 @@ |
GenInstrImmediate(SWC1, src.rm(), nextfpreg, |
src.offset_ + Register::kExponentOffset); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadUpperOffsetForTwoMemoryAccesses(src); |
- GenInstrImmediate(SWC1, at, fd, off16 + Register::kMantissaOffset); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(SWC1, at, fd, Register::kMantissaOffset); |
FPURegister nextfpreg; |
nextfpreg.setcode(fd.code() + 1); |
- GenInstrImmediate(SWC1, at, nextfpreg, off16 + Register::kExponentOffset); |
+ GenInstrImmediate(SWC1, at, nextfpreg, Register::kExponentOffset); |
} |
} else { |
DCHECK(IsFp64Mode() || IsFpxxMode()); |
@@ -2288,10 +2257,10 @@ |
GenInstrImmediate(SW, src.rm(), at, |
src.offset_ + Register::kExponentOffset); |
} else { // Offset > 16 bits, use multiple instructions to load. |
- int32_t off16 = LoadUpperOffsetForTwoMemoryAccesses(src); |
- GenInstrImmediate(SWC1, at, fd, off16 + Register::kMantissaOffset); |
+ LoadRegPlusOffsetToAt(src); |
+ GenInstrImmediate(SWC1, at, fd, Register::kMantissaOffset); |
mfhc1(t8, fd); |
- GenInstrImmediate(SW, at, t8, off16 + Register::kExponentOffset); |
+ GenInstrImmediate(SW, at, t8, Register::kExponentOffset); |
} |
} |
} |