mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
R600/SI: Commute instructions to enable more folding opportunities
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225410 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -709,6 +709,7 @@ bool SIInstrInfo::expandPostRAPseudo(MachineBasicBlock::iterator MI) const {
|
||||
|
||||
MachineInstr *SIInstrInfo::commuteInstruction(MachineInstr *MI,
|
||||
bool NewMI) const {
|
||||
|
||||
if (MI->getNumOperands() < 3)
|
||||
return nullptr;
|
||||
|
||||
@@ -730,8 +731,9 @@ MachineInstr *SIInstrInfo::commuteInstruction(MachineInstr *MI,
|
||||
// Make sure it's legal to commute operands for VOP2.
|
||||
if (isVOP2(MI->getOpcode()) &&
|
||||
(!isOperandLegal(MI, Src0Idx, &Src1) ||
|
||||
!isOperandLegal(MI, Src1Idx, &Src0)))
|
||||
!isOperandLegal(MI, Src1Idx, &Src0))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!Src1.isReg()) {
|
||||
// Allow commuting instructions with Imm or FPImm operands.
|
||||
@@ -1471,6 +1473,7 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr *MI, unsigned OpIdx,
|
||||
//
|
||||
// s_sendmsg 0, s0 ; Operand defined as m0reg
|
||||
// ; RI.getCommonSubClass(s0,m0reg) = m0reg ; NOT LEGAL
|
||||
|
||||
return RI.getCommonSubClass(RC, RI.getRegClass(OpInfo.RegClass)) == RC;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user