Chromium Code Reviews| Index: src/mips/assembler-mips.cc |
| diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc |
| index 50732026b09667d870dd00effd0880efeedbadb4..437d5045209d8c21a87f618ade5f46852befc216 100644 |
| --- a/src/mips/assembler-mips.cc |
| +++ b/src/mips/assembler-mips.cc |
| @@ -282,7 +282,6 @@ const Instr kLwSwInstrTypeMask = 0xffe00000; |
| const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; |
| const Instr kLwSwOffsetMask = kImm16Mask; |
| - |
| Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
|
paul.l...
2015/06/10 03:49:25
nit: don't delete the line here, there should be 2
ilija.pavlovic
2015/06/12 09:51:32
Done.
|
| : AssemblerBase(isolate, buffer, buffer_size), |
| recorded_ast_id_(TypeFeedbackId::None()), |
| @@ -959,6 +958,21 @@ void Assembler::GenInstrImmediate(Opcode opcode, |
| } |
| +void Assembler::GenInstrImmediate(Opcode opcode, Register rs, int32_t j) { |
| + DCHECK(rs.is_valid() && (is_uint21(j))); |
| + Instr instr = |
| + opcode | (rs.code() << kRsShift) | static_cast<uint32_t>(j & kImm21Mask); |
| + emit(instr); |
| +} |
| + |
| + |
| +void Assembler::GenInstrImmediate(Opcode opcode, int32_t offset26) { |
| + DCHECK((kMinInt26 <= offset26) && (offset26 <= kMaxInt26)); |
|
paul.l...
2015/06/10 03:49:25
You should be able to use is_int26() here - define
ilija.pavlovic
2015/06/12 09:51:32
Done.
|
| + Instr instr = opcode | static_cast<uint32_t>(offset26 & kImm26Mask); |
|
paul.l...
2015/06/10 03:49:25
I don't think you need the cast here -- all the ty
ilija.pavlovic
2015/06/12 09:51:32
Done.
|
| + emit(instr); |
| +} |
| + |
| + |
| void Assembler::GenInstrJump(Opcode opcode, |
| uint32_t address) { |
| BlockTrampolinePoolScope block_trampoline_pool(this); |
| @@ -1156,6 +1170,18 @@ void Assembler::bal(int16_t offset) { |
| } |
| +void Assembler::bc(int32_t offset) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + GenInstrImmediate(BC, offset); |
| +} |
| + |
| + |
| +void Assembler::balc(int32_t offset) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
|
paul.l...
2015/06/10 03:49:25
I suspect we will need positions_recorder()->Write
ilija.pavlovic
2015/06/12 09:51:32
Added "positions_recorder()->WriteRecordedPosition
|
| + GenInstrImmediate(BALC, offset); |
| +} |
| + |
| + |
| void Assembler::beq(Register rs, Register rt, int16_t offset) { |
| BlockTrampolinePoolScope block_trampoline_pool(this); |
| GenInstrImmediate(BEQ, rs, rt, offset); |
| @@ -1355,7 +1381,8 @@ void Assembler::beqc(Register rs, Register rt, int16_t offset) { |
| void Assembler::beqzc(Register rs, int32_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rs.is(zero_reg))); |
| - Instr instr = BEQZC | (rs.code() << kRsShift) | offset; |
| + Instr instr = POP66 | (rs.code() << kRsShift) | |
| + static_cast<uint32_t>(offset & kImm21Mask); |
|
paul.l...
2015/06/10 03:49:25
Again, I think the cast is not needed. The code wi
ilija.pavlovic
2015/06/12 09:51:32
The static cast removed here and in instances belo
|
| emit(instr); |
| } |
| @@ -1370,7 +1397,7 @@ void Assembler::bnec(Register rs, Register rt, int16_t offset) { |
| void Assembler::bnezc(Register rs, int32_t offset) { |
| DCHECK(IsMipsArchVariant(kMips32r6)); |
| DCHECK(!(rs.is(zero_reg))); |
| - Instr instr = BNEZC | (rs.code() << kRsShift) | offset; |
| + Instr instr = POP76 | (rs.code() << kRsShift) | offset; |
| emit(instr); |
| } |
| @@ -1448,6 +1475,21 @@ void Assembler::jal_or_jalr(int32_t target, Register rs) { |
| } |
| +void Assembler::jic(Register rt, int16_t offset) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + Instr instr = POP66 | (JIC << kRsShift) | (rt.code() << kRtShift) | |
| + static_cast<uint16_t>(offset); |
| + emit(instr); |
| +} |
| + |
| + |
| +void Assembler::jialc(Register rt, int16_t offset) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + positions_recorder()->WriteRecordedPositions(); |
| + GenInstrImmediate(POP76, zero_reg, rt, offset); |
| +} |
| + |
| + |
| // -------Data-processing-instructions--------- |
| // Arithmetic. |
| @@ -1762,6 +1804,46 @@ void Assembler::aui(Register rs, Register rt, int32_t j) { |
| } |
| +// ---------PC-Relative instructions----------- |
| + |
| +void Assembler::addiupc(Register rs, int32_t imm19) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + DCHECK(rs.is_valid()); |
| + DCHECK((kMinInt19 <= imm19) && (imm19 <= kMaxInt19)); |
|
paul.l...
2015/06/10 03:49:25
I think is_int19() will do, here and below.
ilija.pavlovic
2015/06/12 09:51:32
Done.
|
| + int32_t imm21 = |
| + ADDIUPC << kImm19Bits | static_cast<uint32_t>(imm19 & kImm19Mask); |
| + GenInstrImmediate(PCREL, rs, imm21); |
| +} |
| + |
| + |
| +void Assembler::lwpc(Register rs, int32_t offset19) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + DCHECK(rs.is_valid()); |
| + DCHECK((kMinInt19 <= offset19) && (offset19 <= kMaxInt19)); |
| + int32_t imm21 = |
| + LWPC << kImm19Bits | static_cast<uint32_t>(offset19 & kImm19Mask); |
| + GenInstrImmediate(PCREL, rs, imm21); |
| +} |
| + |
| + |
| +void Assembler::auipc(Register rs, int16_t imm16) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + DCHECK(rs.is_valid() && is_int16(imm16)); |
| + int32_t imm21 = |
| + AUIPC << kImm16Bits | static_cast<uint32_t>(imm16 & kImm16Mask); |
| + GenInstrImmediate(PCREL, rs, imm21); |
| +} |
| + |
| + |
| +void Assembler::aluipc(Register rs, int16_t imm16) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + DCHECK(rs.is_valid() && is_int16(imm16)); |
| + int32_t imm21 = |
| + ALUIPC << kImm16Bits | static_cast<uint32_t>(imm16 & kImm16Mask); |
| + GenInstrImmediate(PCREL, rs, imm21); |
| +} |
| + |
| + |
| // -------------Misc-instructions-------------- |
| // Break / Trap instructions. |
| @@ -1937,8 +2019,8 @@ void Assembler::ext_(Register rt, Register rs, uint16_t pos, uint16_t size) { |
| void Assembler::bitswap(Register rd, Register rt) { |
| - DCHECK(kArchVariant == kMips32r6); |
| - GenInstrRegister(SPECIAL3, zero_reg, rt, rd, 0, BITSWAP); |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + GenInstrRegister(SPECIAL3, zero_reg, rt, rd, 0, BSHFL); |
| } |
| @@ -1951,6 +2033,14 @@ void Assembler::pref(int32_t hint, const MemOperand& rs) { |
| } |
| +void Assembler::align(Register rd, Register rs, Register rt, uint8_t bp) { |
| + DCHECK(IsMipsArchVariant(kMips32r6)); |
| + DCHECK(is_uint3(bp)); |
| + uint16_t sa = (ALIGN << kBp2Bits) | bp; |
| + GenInstrRegister(SPECIAL3, rs, rt, rd, sa, BSHFL); |
| +} |
| + |
| + |
| // --------Coprocessor-instructions---------------- |
| // Load, store, move. |