Chromium Code Reviews| Index: src/mips/assembler-mips.cc |
| diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc |
| index 87abbe1b4d1ea6ba01a2d7f697d5042baa7bb73c..7714573f67bc9e7762ee0747f2de921366b05206 100644 |
| --- a/src/mips/assembler-mips.cc |
| +++ b/src/mips/assembler-mips.cc |
| @@ -297,6 +297,10 @@ void Assembler::GetCode(CodeDesc* desc) { |
| void Assembler::Align(int m) { |
| DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m)); |
| + if (IsPrevInstrCompactBranch()) { |
| + nop(); |
| + ClearCompactBranchState(); |
| + } |
| while ((pc_offset() & (m - 1)) != 0) { |
| nop(); |
| } |
| @@ -453,19 +457,38 @@ bool Assembler::IsBranch(Instr instr) { |
| uint32_t rt_field = GetRtField(instr); |
| uint32_t rs_field = GetRsField(instr); |
| // Checks if the instruction is a branch. |
| - return opcode == BEQ || |
| - opcode == BNE || |
| - opcode == BLEZ || |
| - opcode == BGTZ || |
| - opcode == BEQL || |
| - opcode == BNEL || |
| - opcode == BLEZL || |
| - opcode == BGTZL || |
| + bool isBranch = |
| + opcode == BEQ || opcode == BNE || opcode == BLEZ || opcode == BGTZ || |
| + opcode == BEQL || opcode == BNEL || opcode == BLEZL || opcode == BGTZL || |
| (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || |
| rt_field == BLTZAL || rt_field == BGEZAL)) || |
| (opcode == COP1 && rs_field == BC1) || // Coprocessor branch. |
| (opcode == COP1 && rs_field == BC1EQZ) || |
| (opcode == COP1 && rs_field == BC1NEZ); |
| + if (!isBranch && IsMipsArchVariant(kMips32r6)) { |
| + // All the 3 variants of POP10 (BOVC, BEQC, BEQZALC) and |
| + // POP30 (BNVC, BNEC, BNEZALC) are branch ops. |
| + isBranch |= opcode == POP10 || opcode == POP30 || opcode == BC || |
| + opcode == BALC || |
| + (opcode == POP66 && rs_field != 0) || // BEQZC |
| + (opcode == POP76 && rs_field != 0); // BNEZC |
| + } |
| + return isBranch; |
| +} |
| + |
| + |
| +bool Assembler::IsBc(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + // Checks if the instruction is a BC or BALC. |
| + return opcode == BC || opcode == BALC; |
| +} |
| + |
| + |
| +bool Assembler::IsBzc(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + // Checks if the instruction is BEQZC or BNEZC. |
| + return (opcode == POP66 && GetRsField(instr) != 0) || |
| + (opcode == POP76 && GetRsField(instr) != 0); |
| } |
| @@ -485,6 +508,34 @@ bool Assembler::IsBne(Instr instr) { |
| } |
| +bool Assembler::IsBeqzc(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + return opcode == POP66 && GetRsField(instr) != 0; |
| +} |
| + |
| + |
| +bool Assembler::IsBnezc(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + return opcode == POP76 && GetRsField(instr) != 0; |
| +} |
| + |
| + |
| +bool Assembler::IsBeqc(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + uint32_t rs = GetRsField(instr); |
| + uint32_t rt = GetRtField(instr); |
| + return opcode == POP10 && rs != 0 && rs < rt; // && rt != 0 |
| +} |
| + |
| + |
| +bool Assembler::IsBnec(Instr instr) { |
| + uint32_t opcode = GetOpcodeField(instr); |
| + uint32_t rs = GetRsField(instr); |
| + uint32_t rt = GetRtField(instr); |
| + return opcode == POP30 && rs != 0 && rs < rt; // && rt != 0 |
| +} |
| + |
| + |
| bool Assembler::IsJump(Instr instr) { |
| uint32_t opcode = GetOpcodeField(instr); |
| uint32_t rt_field = GetRtField(instr); |
| @@ -570,7 +621,7 @@ int32_t Assembler::GetBranchOffset(Instr instr) { |
| bool Assembler::IsLw(Instr instr) { |
| - return ((instr & kOpcodeMask) == LW); |
| + return (static_cast<uint32_t>(instr & kOpcodeMask) == LW); |
| } |
| @@ -592,7 +643,7 @@ Instr Assembler::SetLwOffset(Instr instr, int16_t offset) { |
| bool Assembler::IsSw(Instr instr) { |
| - return ((instr & kOpcodeMask) == SW); |
| + return (static_cast<uint32_t>(instr & kOpcodeMask) == SW); |
| } |
| @@ -618,6 +669,36 @@ bool Assembler::IsAndImmediate(Instr instr) { |
| } |
| +static int32_t OffsetSizeInBits(Instr instr) { |
| + if (IsMipsArchVariant(kMips32r6)) { |
| + if (Assembler::IsBc(instr)) { |
| + return 26; |
|
ivica.bogosavljevic
2015/10/15 11:49:08
Use contstants instead of number
balazs.kilvady
2015/10/30 21:11:14
Done.
|
| + } else if (Assembler::IsBzc(instr)) { |
| + return 21; |
| + } |
| + } |
| + return 16; |
| +} |
| + |
| + |
| +static inline int32_t AddBranchOffset(int pos, Instr instr) { |
| + int32_t bits = OffsetSizeInBits(instr); |
| + const int32_t mask = (1 << bits) - 1; |
| + bits = 32 - bits; |
| + |
| + // Do NOT change this to <<2. We rely on arithmetic shifts here, assuming |
| + // the compiler uses arithmetic shifts for signed integers. |
| + int32_t imm = ((instr & mask) << bits) >> (bits - 2); |
| + |
| + if (imm == kEndOfChain) { |
| + // EndOfChain sentinel is returned directly, not relative to pc or pos. |
| + return kEndOfChain; |
| + } else { |
| + return pos + Assembler::kBranchPCOffset + imm; |
| + } |
| +} |
| + |
| + |
| int Assembler::target_at(int pos, bool is_internal) { |
| Instr instr = instr_at(pos); |
| if (is_internal) { |
| @@ -641,18 +722,9 @@ int Assembler::target_at(int pos, bool is_internal) { |
| } |
| // Check we have a branch or jump instruction. |
| DCHECK(IsBranch(instr) || IsLui(instr)); |
| - // Do NOT change this to <<2. We rely on arithmetic shifts here, assuming |
| - // the compiler uses arithmetic shifts for signed integers. |
| if (IsBranch(instr)) { |
| - int32_t imm18 = ((instr & static_cast<int32_t>(kImm16Mask)) << 16) >> 14; |
| - |
| - if (imm18 == kEndOfChain) { |
| - // EndOfChain sentinel is returned directly, not relative to pc or pos. |
| - return kEndOfChain; |
| - } else { |
| - return pos + kBranchPCOffset + imm18; |
| - } |
| - } else if (IsLui(instr)) { |
| + return AddBranchOffset(pos, instr); |
| + } else { |
| Instr instr_lui = instr_at(pos + 0 * Assembler::kInstrSize); |
| Instr instr_ori = instr_at(pos + 1 * Assembler::kInstrSize); |
| DCHECK(IsOri(instr_ori)); |
|
ivica.bogosavljevic
2015/10/15 11:49:08
Since isLui is not part of else if, then we should
balazs.kilvady
2015/10/30 21:11:14
That check is covered at line 724
|
| @@ -668,10 +740,23 @@ int Assembler::target_at(int pos, bool is_internal) { |
| DCHECK(pos > delta); |
| return pos - delta; |
| } |
| - } else { |
| - UNREACHABLE(); |
| - return 0; |
| } |
| + return 0; |
| +} |
| + |
| + |
| +static inline Instr SetBranchOffset(int32_t pos, int32_t target_pos, |
| + Instr instr) { |
| + int32_t bits = OffsetSizeInBits(instr); |
| + int32_t imm = target_pos - (pos + Assembler::kBranchPCOffset); |
| + DCHECK((imm & 3) == 0); |
| + imm >>= 2; |
| + |
| + const int32_t mask = (1 << bits) - 1; |
| + instr &= ~mask; |
| + DCHECK(is_intn(imm, bits)); |
| + |
| + return instr | (imm & mask); |
| } |
| @@ -694,15 +779,9 @@ void Assembler::target_at_put(int32_t pos, int32_t target_pos, |
| DCHECK(IsBranch(instr) || IsLui(instr)); |
| if (IsBranch(instr)) { |
| - int32_t imm18 = target_pos - (pos + kBranchPCOffset); |
| - DCHECK((imm18 & 3) == 0); |
| - |
| - instr &= ~kImm16Mask; |
| - int32_t imm16 = imm18 >> 2; |
| - DCHECK(is_int16(imm16)); |
| - |
| - instr_at_put(pos, instr | (imm16 & kImm16Mask)); |
| - } else if (IsLui(instr)) { |
| + instr = SetBranchOffset(pos, target_pos, instr); |
| + instr_at_put(pos, instr); |
| + } else { |
| Instr instr_lui = instr_at(pos + 0 * Assembler::kInstrSize); |
| Instr instr_ori = instr_at(pos + 1 * Assembler::kInstrSize); |
| DCHECK(IsOri(instr_ori)); |
|
ivica.bogosavljevic
2015/10/15 11:49:08
Since isLui is not part of else if, then we should
balazs.kilvady
2015/10/30 21:11:14
Check covered at line 780
|
| @@ -716,8 +795,6 @@ void Assembler::target_at_put(int32_t pos, int32_t target_pos, |
| instr_lui | ((imm & kHiMask) >> kLuiShift)); |
| instr_at_put(pos + 1 * Assembler::kInstrSize, |
| instr_ori | (imm & kImm16Mask)); |
| - } else { |
| - UNREACHABLE(); |
| } |
| } |
| @@ -766,20 +843,22 @@ void Assembler::bind_to(Label* L, int pos) { |
| Instr instr = instr_at(fixup_pos); |
| if (is_internal) { |
| target_at_put(fixup_pos, pos, is_internal); |
| - } else if (!is_internal && IsBranch(instr)) { |
| - if (dist > kMaxBranchOffset) { |
| - if (trampoline_pos == kInvalidSlotPos) { |
| - trampoline_pos = get_trampoline_entry(fixup_pos); |
| - CHECK(trampoline_pos != kInvalidSlotPos); |
| + } else { |
| + if (IsBranch(instr)) { |
| + if (dist > kMaxBranchOffset) { |
| + if (trampoline_pos == kInvalidSlotPos) { |
| + trampoline_pos = get_trampoline_entry(fixup_pos); |
| + CHECK(trampoline_pos != kInvalidSlotPos); |
| + } |
| + CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset); |
| + target_at_put(fixup_pos, trampoline_pos, false); |
| + fixup_pos = trampoline_pos; |
| + dist = pos - fixup_pos; |
| } |
| - CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset); |
| - target_at_put(fixup_pos, trampoline_pos, false); |
| - fixup_pos = trampoline_pos; |
| - dist = pos - fixup_pos; |
| + target_at_put(fixup_pos, pos, false); |
| + } else { |
| + target_at_put(fixup_pos, pos, false); |
| } |
| - target_at_put(fixup_pos, pos, false); |
| - } else { |
| - target_at_put(fixup_pos, pos, false); |
| } |
| } |
| L->bind_to(pos); |
| @@ -999,71 +1078,19 @@ uint32_t Assembler::jump_address(Label* L) { |
| } |
| -int32_t Assembler::branch_offset(Label* L, bool jump_elimination_allowed) { |
| - int32_t target_pos; |
| - |
| - if (L->is_bound()) { |
| - target_pos = L->pos(); |
| - } else { |
| - if (L->is_linked()) { |
| - target_pos = L->pos(); |
| - L->link_to(pc_offset()); |
| - } else { |
| - L->link_to(pc_offset()); |
| - if (!trampoline_emitted_) { |
| - unbound_labels_count_++; |
| - next_buffer_check_ -= kTrampolineSlotsSize; |
| - } |
| - return kEndOfChain; |
| - } |
| - } |
| - |
| - int32_t offset = target_pos - (pc_offset() + kBranchPCOffset); |
| - DCHECK((offset & 3) == 0); |
| - DCHECK(is_int16(offset >> 2)); |
| - |
| - return offset; |
| -} |
| - |
| - |
| -int32_t Assembler::branch_offset_compact(Label* L, |
| - bool jump_elimination_allowed) { |
| - int32_t target_pos; |
| - if (L->is_bound()) { |
| - target_pos = L->pos(); |
| - } else { |
| - if (L->is_linked()) { |
| - target_pos = L->pos(); |
| - L->link_to(pc_offset()); |
| - } else { |
| - L->link_to(pc_offset()); |
| - if (!trampoline_emitted_) { |
| - unbound_labels_count_++; |
| - next_buffer_check_ -= kTrampolineSlotsSize; |
| - } |
| - return kEndOfChain; |
| - } |
| - } |
| - |
| - int32_t offset = target_pos - pc_offset(); |
| - DCHECK((offset & 3) == 0); |
| - DCHECK(is_int16(offset >> 2)); |
| - |
| - return offset; |
| -} |
| - |
| - |
| -int32_t Assembler::branch_offset21(Label* L, bool jump_elimination_allowed) { |
| +int32_t Assembler::branch_offset_helper(Label* L, bool jump_elimination_allowed, |
|
ivica.bogosavljevic
2015/10/15 11:49:08
Bravo for removing all these functions!
|
| + int bits) { |
| int32_t target_pos; |
| + int32_t pad = IsPrevInstrCompactBranch() ? kInstrSize : 0; |
| if (L->is_bound()) { |
| target_pos = L->pos(); |
| } else { |
| if (L->is_linked()) { |
| target_pos = L->pos(); |
| - L->link_to(pc_offset()); |
| + L->link_to(pc_offset() + pad); |
| } else { |
| - L->link_to(pc_offset()); |
| + L->link_to(pc_offset() + pad); |
| if (!trampoline_emitted_) { |
| unbound_labels_count_++; |
| next_buffer_check_ -= kTrampolineSlotsSize; |
| @@ -1072,37 +1099,9 @@ int32_t Assembler::branch_offset21(Label* L, bool jump_elimination_allowed) { |
| } |
| } |
| - int32_t offset = target_pos - (pc_offset() + kBranchPCOffset); |
| + int32_t offset = target_pos - (pc_offset() + kBranchPCOffset + pad); |
| + DCHECK(is_intn(offset, bits + 2)); |
| DCHECK((offset & 3) == 0); |
| - DCHECK(((offset >> 2) & 0xFFE00000) == 0); // Offset is 21bit width. |
| - |
| - return offset; |
| -} |
| - |
| - |
| -int32_t Assembler::branch_offset21_compact(Label* L, |
| - bool jump_elimination_allowed) { |
| - int32_t target_pos; |
| - |
| - if (L->is_bound()) { |
| - target_pos = L->pos(); |
| - } else { |
| - if (L->is_linked()) { |
| - target_pos = L->pos(); |
| - L->link_to(pc_offset()); |
| - } else { |
| - L->link_to(pc_offset()); |
| - if (!trampoline_emitted_) { |
| - unbound_labels_count_++; |
| - next_buffer_check_ -= kTrampolineSlotsSize; |
| - } |
| - return kEndOfChain; |
| - } |
| - } |
| - |
| - int32_t offset = target_pos - pc_offset(); |
| - DCHECK((offset & 3) == 0); |
| - DCHECK(((offset >> 2) & 0xFFe00000) == 0); // Offset is 21bit width. |
| return offset; |
| } |
| @@ -1142,7 +1141,6 @@ void Assembler::b(int16_t offset) { |
| void Assembler::bal(int16_t offset) { |
| - positions_recorder()->WriteRecordedPositions(); |
| bgezal(zero_reg, offset); |
| } |
| @@ -1150,13 +1148,14 @@ void Assembler::bal(int16_t offset) { |
| void Assembler::bc(int32_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| GenInstrImmediate(BC, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::balc(int32_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - positions_recorder()->WriteRecordedPositions(); |
| GenInstrImmediate(BALC, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1178,6 +1177,7 @@ void Assembler::bgezc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BLEZL, rt, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1187,6 +1187,7 @@ void Assembler::bgeuc(Register rs, Register rt, int16_t offset) { |
| DCHECK(!(rt.is(zero_reg))); |
| DCHECK(rs.code() != rt.code()); |
| GenInstrImmediate(BLEZ, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1196,13 +1197,13 @@ void Assembler::bgec(Register rs, Register rt, int16_t offset) { |
| DCHECK(!(rt.is(zero_reg))); |
| DCHECK(rs.code() != rt.code()); |
| GenInstrImmediate(BLEZL, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::bgezal(Register rs, int16_t offset) { |
| DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); |
| BlockTrampolinePoolScope block_trampoline_pool(this); |
| - positions_recorder()->WriteRecordedPositions(); |
| GenInstrImmediate(REGIMM, rs, BGEZAL, offset); |
| BlockTrampolinePoolFor(1); // For associated delay slot. |
| } |
| @@ -1219,6 +1220,7 @@ void Assembler::bgtzc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BGTZL, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1233,13 +1235,15 @@ void Assembler::blezc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BLEZL, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::bltzc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - DCHECK(!(rt.is(zero_reg))); |
| + DCHECK(!rt.is(zero_reg)); |
| GenInstrImmediate(BGTZL, rt, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1249,15 +1253,17 @@ void Assembler::bltuc(Register rs, Register rt, int16_t offset) { |
| DCHECK(!(rt.is(zero_reg))); |
| DCHECK(rs.code() != rt.code()); |
| GenInstrImmediate(BGTZ, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::bltc(Register rs, Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - DCHECK(!(rs.is(zero_reg))); |
| - DCHECK(!(rt.is(zero_reg))); |
| + DCHECK(!rs.is(zero_reg)); |
| + DCHECK(!rt.is(zero_reg)); |
| DCHECK(rs.code() != rt.code()); |
| GenInstrImmediate(BGTZL, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1271,7 +1277,6 @@ void Assembler::bltz(Register rs, int16_t offset) { |
| void Assembler::bltzal(Register rs, int16_t offset) { |
| DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); |
| BlockTrampolinePoolScope block_trampoline_pool(this); |
| - positions_recorder()->WriteRecordedPositions(); |
| GenInstrImmediate(REGIMM, rs, BLTZAL, offset); |
| BlockTrampolinePoolFor(1); // For associated delay slot. |
| } |
| @@ -1289,6 +1294,7 @@ void Assembler::bovc(Register rs, Register rt, int16_t offset) { |
| DCHECK(!(rs.is(zero_reg))); |
| DCHECK(rs.code() >= rt.code()); |
| GenInstrImmediate(ADDI, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1297,6 +1303,7 @@ void Assembler::bnvc(Register rs, Register rt, int16_t offset) { |
| DCHECK(!(rs.is(zero_reg))); |
| DCHECK(rs.code() >= rt.code()); |
| GenInstrImmediate(DADDI, rs, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1304,6 +1311,7 @@ void Assembler::blezalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BLEZ, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1311,6 +1319,7 @@ void Assembler::bgezalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BLEZ, rt, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1325,6 +1334,7 @@ void Assembler::bltzalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BGTZ, rt, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1332,6 +1342,7 @@ void Assembler::bgtzalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(BGTZ, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1339,6 +1350,7 @@ void Assembler::beqzalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(ADDI, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1346,13 +1358,19 @@ void Assembler::bnezalc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rt.is(zero_reg))); |
| GenInstrImmediate(DADDI, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::beqc(Register rs, Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - DCHECK(rs.code() < rt.code()); |
| - GenInstrImmediate(ADDI, rs, rt, offset); |
| + DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0); |
| + if (rs.code() < rt.code()) { |
| + GenInstrImmediate(ADDI, rs, rt, offset); |
| + } else { |
| + GenInstrImmediate(ADDI, rt, rs, offset); |
| + } |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1361,21 +1379,28 @@ void Assembler::beqzc(Register rs, int32_t offset) { |
| DCHECK(!(rs.is(zero_reg))); |
| Instr instr = POP66 | (rs.code() << kRsShift) | (offset & kImm21Mask); |
| emit(instr); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::bnec(Register rs, Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - DCHECK(rs.code() < rt.code()); |
| - GenInstrImmediate(DADDI, rs, rt, offset); |
| + DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0); |
| + if (rs.code() < rt.code()) { |
| + GenInstrImmediate(DADDI, rs, rt, offset); |
| + } else { |
| + GenInstrImmediate(DADDI, rt, rs, offset); |
| + } |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::bnezc(Register rs, int32_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rs.is(zero_reg))); |
| - Instr instr = POP76 | (rs.code() << kRsShift) | offset; |
| + Instr instr = POP76 | (rs.code() << kRsShift) | (offset & kImm21Mask); |
| emit(instr); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -1432,13 +1457,14 @@ void Assembler::jic(Register rt, int16_t offset) { |
| Instr instr = POP66 | (JIC << kRsShift) | (rt.code() << kRtShift) | |
| (offset & kImm16Mask); |
| emit(instr); |
| + EmittedCompactBranchInstruction(); |
| } |
| void Assembler::jialc(Register rt, int16_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| - positions_recorder()->WriteRecordedPositions(); |
| GenInstrImmediate(POP76, zero_reg, rt, offset); |
| + EmittedCompactBranchInstruction(); |
| } |
| @@ -2671,7 +2697,6 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) { |
| } |
| -// Debugging. |
| int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, byte* pc, |
| intptr_t pc_delta) { |
| Instr instr = instr_at(pc); |