mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
R600/SI: Update instruction conversions for VI
There are 3 changes: - Convert 32-bit S_LSHL/LSHR/ASHR to their V_*REV variants for VI - Lower RSQ_CLAMP for VI - Don't generate MIN/MAX_LEGACY on VI git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1356,6 +1356,14 @@ unsigned SIInstrInfo::split64BitImm(SmallVectorImpl<MachineInstr *> &Worklist,
|
||||
return Dst;
|
||||
}
|
||||
|
||||
// Change the order of operands from (0, 1, 2) to (0, 2, 1)
|
||||
void SIInstrInfo::swapOperands(MachineBasicBlock::iterator Inst) const {
|
||||
assert(Inst->getNumExplicitOperands() == 3);
|
||||
MachineOperand Op1 = Inst->getOperand(1);
|
||||
Inst->RemoveOperand(1);
|
||||
Inst->addOperand(Op1);
|
||||
}
|
||||
|
||||
bool SIInstrInfo::isOperandLegal(const MachineInstr *MI, unsigned OpIdx,
|
||||
const MachineOperand *MO) const {
|
||||
const MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo();
|
||||
@@ -1931,6 +1939,25 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) const {
|
||||
continue;
|
||||
}
|
||||
|
||||
case AMDGPU::S_LSHL_B32:
|
||||
if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) {
|
||||
NewOpcode = AMDGPU::V_LSHLREV_B32_e64;
|
||||
swapOperands(Inst);
|
||||
}
|
||||
break;
|
||||
case AMDGPU::S_ASHR_I32:
|
||||
if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) {
|
||||
NewOpcode = AMDGPU::V_ASHRREV_I32_e64;
|
||||
swapOperands(Inst);
|
||||
}
|
||||
break;
|
||||
case AMDGPU::S_LSHR_B32:
|
||||
if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) {
|
||||
NewOpcode = AMDGPU::V_LSHRREV_B32_e64;
|
||||
swapOperands(Inst);
|
||||
}
|
||||
break;
|
||||
|
||||
case AMDGPU::S_BFE_U64:
|
||||
case AMDGPU::S_BFM_B64:
|
||||
llvm_unreachable("Moving this op to VALU not implemented");
|
||||
|
||||
Reference in New Issue
Block a user