File tree Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -4033,15 +4033,29 @@ MachineInstr *SIInstrInfo::convertToThreeAddress(MachineInstr &MI,
40334033 if (Src0Literal && !ST.hasVOP3Literal ())
40344034 return nullptr ;
40354035
4036- unsigned NewOpc = IsFMA ? IsF16 ? ST.hasTrue16BitInsts ()
4037- ? AMDGPU::V_FMA_F16_gfx9_fake16_e64
4038- : AMDGPU::V_FMA_F16_gfx9_e64
4039- : IsF64 ? AMDGPU::V_FMA_F64_e64
4040- : IsLegacy ? AMDGPU::V_FMA_LEGACY_F32_e64
4041- : AMDGPU::V_FMA_F32_e64
4042- : IsF16 ? AMDGPU::V_MAD_F16_e64
4043- : IsLegacy ? AMDGPU::V_MAD_LEGACY_F32_e64
4044- : AMDGPU::V_MAD_F32_e64;
4036+ auto getNewFMAInst = [&]() {
4037+ if (IsFMA) {
4038+ if (IsF16)
4039+ return ST.hasTrue16BitInsts () ? AMDGPU::V_FMA_F16_gfx9_fake16_e64
4040+ : AMDGPU::V_FMA_F16_gfx9_e64;
4041+ else if (IsF64)
4042+ return AMDGPU::V_FMA_F64_e64;
4043+ else if (IsLegacy)
4044+ return AMDGPU::V_FMA_LEGACY_F32_e64;
4045+ else
4046+ return AMDGPU::V_FMA_F32_e64;
4047+ } else {
4048+ if (IsF16)
4049+ return AMDGPU::V_MAD_F16_e64;
4050+ else if (IsLegacy)
4051+ return AMDGPU::V_FMA_LEGACY_F32_e64;
4052+ else
4053+ return AMDGPU::V_MAD_F32_e64;
4054+ }
4055+ };
4056+
4057+ unsigned NewOpc = getNewFMAInst ();
4058+
40454059 if (pseudoToMCOpcode (NewOpc) == -1 )
40464060 return nullptr ;
40474061
You can’t perform that action at this time.
0 commit comments