diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2015-07-13 15:47:57 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2015-07-13 15:47:57 +0000 |
commit | db5a11f698cead8bd97b0942cadd29b001bcdf65 (patch) | |
tree | f911d36fff459fbaa57c6568b244e02a03ed442f /llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp | |
parent | 0a43abc9f841246ba2974fe189628d7c45484cb6 (diff) | |
download | llvm-db5a11f698cead8bd97b0942cadd29b001bcdf65.zip llvm-db5a11f698cead8bd97b0942cadd29b001bcdf65.tar.gz llvm-db5a11f698cead8bd97b0942cadd29b001bcdf65.tar.bz2 |
AMDGPU/SI: Select mad patterns to v_mac_f32
The two-address instruction pass will convert these back to v_mad_f32
if necessary.
Differential Revision: http://reviews.llvm.org/D11060
llvm-svn: 242038
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp index cb9d7f7..e7511e6 100644 --- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp +++ b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp @@ -94,8 +94,15 @@ static bool canShrink(MachineInstr &MI, const SIInstrInfo *TII, // is vcc. We should handle this the same way we handle vopc, by addding // a register allocation hint pre-regalloc and then do the shrining // post-regalloc. - if (Src2) - return false; + if (Src2) { + if (MI.getOpcode() != AMDGPU::V_MAC_F32_e64) + return false; + + const MachineOperand *Src2Mod = + TII->getNamedOperand(MI, AMDGPU::OpName::src2_modifiers); + if (!isVGPR(Src2, TRI, MRI) || (Src2Mod && Src2Mod->getImm() != 0)) + return false; + } const MachineOperand *Src1 = TII->getNamedOperand(MI, AMDGPU::OpName::src1); const MachineOperand *Src1Mod = @@ -259,6 +266,11 @@ bool SIShrinkInstructions::runOnMachineFunction(MachineFunction &MF) { if (Src1) Inst32.addOperand(*Src1); + const MachineOperand *Src2 = + TII->getNamedOperand(MI, AMDGPU::OpName::src2); + if (Src2) + Inst32.addOperand(*Src2); + ++NumInstructionsShrunk; MI.eraseFromParent(); |