mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
[mips][mips64r6] c.cond.fmt, mov[fntz], and mov[fntz].[ds] are not available on MIPS32r6/MIPS64r6
Summary: c.cond.fmt has been replaced by cmp.cond.fmt. Where c.cond.fmt wrote to dedicated condition registers, cmp.cond.fmt writes 1 or 0 to normal FGR's (like the GPR comparisons). mov[fntz] have been replaced by seleqz and selnez. These instructions conditionally zero a register based on a bool in a GPR. The results can then be or'd together to act as a select without, for example, requiring a third register read port. mov[fntz].[ds] have been replaced with sel.[ds] MIPS64r6 currently generates unnecessary sign-extensions for most selects. This is because the result of a SETCC is currently an i32. Bits 32-63 are undefined in i32 and the behaviour of seleqz/selnez would otherwise depend on undefined bits. Later, we will fix this by making the result of SETCC an i64 on MIPS64 targets. Depends on D3958 Reviewers: jkolek, vmedic, zoran.jovanovic Reviewed By: vmedic, zoran.jovanovic Differential Revision: http://reviews.llvm.org/D4003 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -67,6 +67,8 @@ public:
|
||||
return STI.getFeatureBits() & Mips::FeatureMips32r6;
|
||||
}
|
||||
|
||||
bool isGP64() const { return STI.getFeatureBits() & Mips::FeatureGP64Bit; }
|
||||
|
||||
/// getInstruction - See MCDisassembler.
|
||||
DecodeStatus getInstruction(MCInst &instr,
|
||||
uint64_t &size,
|
||||
@@ -149,6 +151,10 @@ static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst,
|
||||
unsigned Insn,
|
||||
uint64_t Address,
|
||||
@@ -727,6 +733,7 @@ MipsDisassembler::getInstruction(MCInst &instr,
|
||||
return MCDisassembler::Fail;
|
||||
|
||||
if (IsMicroMips) {
|
||||
DEBUG(dbgs() << "Trying MicroMips32 table (32-bit opcodes):\n");
|
||||
// Calling the auto-generated decoder function.
|
||||
Result = decodeInstruction(DecoderTableMicroMips32, instr, Insn, Address,
|
||||
this, STI);
|
||||
@@ -737,7 +744,18 @@ MipsDisassembler::getInstruction(MCInst &instr,
|
||||
return MCDisassembler::Fail;
|
||||
}
|
||||
|
||||
if (isMips32r6() && isGP64()) {
|
||||
DEBUG(dbgs() << "Trying Mips32r6_64r6 (GPR64) table (32-bit opcodes):\n");
|
||||
Result = decodeInstruction(DecoderTableMips32r6_64r6_GP6432, instr, Insn,
|
||||
Address, this, STI);
|
||||
if (Result != MCDisassembler::Fail) {
|
||||
Size = 4;
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMips32r6()) {
|
||||
DEBUG(dbgs() << "Trying Mips32r6_64r6 table (32-bit opcodes):\n");
|
||||
Result = decodeInstruction(DecoderTableMips32r6_64r632, instr, Insn,
|
||||
Address, this, STI);
|
||||
if (Result != MCDisassembler::Fail) {
|
||||
@@ -746,6 +764,7 @@ MipsDisassembler::getInstruction(MCInst &instr,
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "Trying Mips table (32-bit opcodes):\n");
|
||||
// Calling the auto-generated decoder function.
|
||||
Result = decodeInstruction(DecoderTableMips32, instr, Insn, Address,
|
||||
this, STI);
|
||||
@@ -897,6 +916,17 @@ static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst,
|
||||
return MCDisassembler::Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder) {
|
||||
if (RegNo > 31)
|
||||
return MCDisassembler::Fail;
|
||||
|
||||
unsigned Reg = getReg(Decoder, Mips::FGRCCRegClassID, RegNo);
|
||||
Inst.addOperand(MCOperand::CreateReg(Reg));
|
||||
return MCDisassembler::Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeMem(MCInst &Inst,
|
||||
unsigned Insn,
|
||||
uint64_t Address,
|
||||
|
Reference in New Issue
Block a user