mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
R600/SI: Use pseudo instruction for fabs/clamp/fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208478 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -539,6 +539,50 @@ MachineBasicBlock * SITargetLowering::EmitInstrWithCustomInserter(
|
||||
MIB.addOperand(MI->getOperand(i));
|
||||
|
||||
MI->eraseFromParent();
|
||||
break;
|
||||
}
|
||||
case AMDGPU::FABS_SI: {
|
||||
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
|
||||
const SIInstrInfo *TII =
|
||||
static_cast<const SIInstrInfo*>(getTargetMachine().getInstrInfo());
|
||||
unsigned Reg = MRI.createVirtualRegister(&AMDGPU::VReg_32RegClass);
|
||||
BuildMI(*BB, I, MI->getDebugLoc(), TII->get(AMDGPU::V_MOV_B32_e32),
|
||||
Reg)
|
||||
.addImm(0x7fffffff);
|
||||
BuildMI(*BB, I, MI->getDebugLoc(), TII->get(AMDGPU::V_AND_B32_e32),
|
||||
MI->getOperand(0).getReg())
|
||||
.addReg(MI->getOperand(1).getReg())
|
||||
.addReg(Reg);
|
||||
MI->eraseFromParent();
|
||||
break;
|
||||
}
|
||||
case AMDGPU::FNEG_SI: {
|
||||
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
|
||||
const SIInstrInfo *TII =
|
||||
static_cast<const SIInstrInfo*>(getTargetMachine().getInstrInfo());
|
||||
unsigned Reg = MRI.createVirtualRegister(&AMDGPU::VReg_32RegClass);
|
||||
BuildMI(*BB, I, MI->getDebugLoc(), TII->get(AMDGPU::V_MOV_B32_e32),
|
||||
Reg)
|
||||
.addImm(0x80000000);
|
||||
BuildMI(*BB, I, MI->getDebugLoc(), TII->get(AMDGPU::V_XOR_B32_e32),
|
||||
MI->getOperand(0).getReg())
|
||||
.addReg(MI->getOperand(1).getReg())
|
||||
.addReg(Reg);
|
||||
MI->eraseFromParent();
|
||||
break;
|
||||
}
|
||||
case AMDGPU::FCLAMP_SI: {
|
||||
const SIInstrInfo *TII =
|
||||
static_cast<const SIInstrInfo*>(getTargetMachine().getInstrInfo());
|
||||
BuildMI(*BB, I, MI->getDebugLoc(), TII->get(AMDGPU::V_ADD_F32_e64),
|
||||
MI->getOperand(0).getReg())
|
||||
.addOperand(MI->getOperand(1))
|
||||
.addImm(0) // SRC1
|
||||
.addImm(0) // ABS
|
||||
.addImm(1) // CLAMP
|
||||
.addImm(0) // OMOD
|
||||
.addImm(0); // NEG
|
||||
MI->eraseFromParent();
|
||||
}
|
||||
}
|
||||
return BB;
|
||||
|
||||
Reference in New Issue
Block a user