mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-20 18:48:13 +00:00
[mips] Use ADDu instead of OR to copy general purpose registers. Also, delete
the InstAlias pattern which maps "move" to OR to resolve ambiguity in MatchTable. llvm-svn: 186855
This commit is contained in:
parent
208108a8e0
commit
9f2c66ce7c
@ -333,9 +333,6 @@ def : MipsPat<(i64 (ExtractLOHI ACRegs128:$ac, imm:$lohi_idx)),
|
||||
def : InstAlias<"move $dst, $src",
|
||||
(DADDu CPU64RegsOpnd:$dst, CPU64RegsOpnd:$src, ZERO_64), 1>,
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"move $dst, $src",
|
||||
(OR64 CPU64RegsOpnd:$dst, CPU64RegsOpnd:$src, ZERO_64), 1>,
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"and $rs, $rt, $imm",
|
||||
(DANDi CPU64RegsOpnd:$rs, CPU64RegsOpnd:$rt, uimm16_64:$imm),
|
||||
1>,
|
||||
|
@ -1099,9 +1099,6 @@ def MTC2_3OP : MFC3OP<(outs CPURegsOpnd:$rd, uimm16:$sel),
|
||||
def : InstAlias<"move $dst, $src",
|
||||
(ADDu CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,
|
||||
Requires<[NotMips64]>;
|
||||
def : InstAlias<"move $dst, $src",
|
||||
(OR CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,
|
||||
Requires<[NotMips64]>;
|
||||
def : InstAlias<"bal $offset", (BGEZAL RA, brtarget:$offset), 1>;
|
||||
def : InstAlias<"addu $rs, $rt, $imm",
|
||||
(ADDiu CPURegsOpnd:$rs, CPURegsOpnd:$rt, simm16:$imm), 0>;
|
||||
|
@ -96,7 +96,7 @@ void MipsSEInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
||||
|
||||
if (Mips::CPURegsRegClass.contains(DestReg)) { // Copy to CPU Reg.
|
||||
if (Mips::CPURegsRegClass.contains(SrcReg))
|
||||
Opc = Mips::OR, ZeroReg = Mips::ZERO;
|
||||
Opc = Mips::ADDu, ZeroReg = Mips::ZERO;
|
||||
else if (Mips::CCRRegClass.contains(SrcReg))
|
||||
Opc = Mips::CFC1;
|
||||
else if (Mips::FGR32RegClass.contains(SrcReg))
|
||||
@ -143,7 +143,7 @@ void MipsSEInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
||||
Opc = Mips::FMOV_D64;
|
||||
else if (Mips::CPU64RegsRegClass.contains(DestReg)) { // Copy to CPU64 Reg.
|
||||
if (Mips::CPU64RegsRegClass.contains(SrcReg))
|
||||
Opc = Mips::OR64, ZeroReg = Mips::ZERO_64;
|
||||
Opc = Mips::DADDu, ZeroReg = Mips::ZERO_64;
|
||||
else if (Mips::HIRegs64RegClass.contains(SrcReg))
|
||||
Opc = Mips::MFHI64, SrcReg = 0;
|
||||
else if (Mips::LORegs64RegClass.contains(SrcReg))
|
||||
@ -511,7 +511,6 @@ void MipsSEInstrInfo::expandEhReturn(MachineBasicBlock &MBB,
|
||||
// indirect jump to TargetReg
|
||||
const MipsSubtarget &STI = TM.getSubtarget<MipsSubtarget>();
|
||||
unsigned ADDU = STI.isABI_N64() ? Mips::DADDu : Mips::ADDu;
|
||||
unsigned OR = STI.isABI_N64() ? Mips::OR64 : Mips::OR;
|
||||
unsigned JR = STI.isABI_N64() ? Mips::JR64 : Mips::JR;
|
||||
unsigned SP = STI.isABI_N64() ? Mips::SP_64 : Mips::SP;
|
||||
unsigned RA = STI.isABI_N64() ? Mips::RA_64 : Mips::RA;
|
||||
@ -520,13 +519,13 @@ void MipsSEInstrInfo::expandEhReturn(MachineBasicBlock &MBB,
|
||||
unsigned OffsetReg = I->getOperand(0).getReg();
|
||||
unsigned TargetReg = I->getOperand(1).getReg();
|
||||
|
||||
// or $ra, $v0, $zero
|
||||
// addu $ra, $v0, $zero
|
||||
// addu $sp, $sp, $v1
|
||||
// jr $ra
|
||||
if (TM.getRelocationModel() == Reloc::PIC_)
|
||||
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), T9)
|
||||
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(ADDU), T9)
|
||||
.addReg(TargetReg).addReg(ZERO);
|
||||
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), RA)
|
||||
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(ADDU), RA)
|
||||
.addReg(TargetReg).addReg(ZERO);
|
||||
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(ADDU), SP)
|
||||
.addReg(SP).addReg(OffsetReg);
|
||||
|
@ -13,6 +13,7 @@
|
||||
# CHECK: ins $19, $9, 6, 7 # encoding: [0x84,0x61,0x33,0x7d]
|
||||
# CHECK: nor $9, $6, $7 # encoding: [0x27,0x48,0xc7,0x00]
|
||||
# CHECK: or $3, $3, $5 # encoding: [0x25,0x18,0x65,0x00]
|
||||
# CHECK: or $3, $2, $zero # encoding: [0x25,0x18,0x40,0x00]
|
||||
# CHECK: ori $4, $5, 17767 # encoding: [0x67,0x45,0xa4,0x34]
|
||||
# CHECK: ori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x34]
|
||||
# CHECK: ori $11, $11, 128 # encoding: [0x80,0x00,0x6b,0x35]
|
||||
@ -44,6 +45,7 @@
|
||||
ins $19, $9, 6,7
|
||||
nor $9, $6, $7
|
||||
or $3, $3, $5
|
||||
or $3, $2, $zero
|
||||
or $4, $5, 17767
|
||||
ori $9, $6, 17767
|
||||
ori $11, 128
|
||||
|
Loading…
Reference in New Issue
Block a user