Index: llvm/lib/Target/AMDGPU/AMDGPU.td =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPU.td +++ llvm/lib/Target/AMDGPU/AMDGPU.td @@ -1269,12 +1269,12 @@ def HasMadMacF32Insts : Predicate<"Subtarget->hasMadMacF32Insts()">, AssemblerPredicate<(all_of FeatureMadMacF32Insts)>; +def HasFmaLegacy32 : Predicate<"Subtarget->hasGFX10_3Insts()">, + AssemblerPredicate<(any_of FeatureGFX10_3Insts)>; + def HasAtomicFaddInsts : Predicate<"Subtarget->hasAtomicFaddInsts()">, AssemblerPredicate<(all_of FeatureAtomicFaddInsts)>; -def HasNoMadMacF32Insts : Predicate<"!Subtarget->hasMadMacF32Insts()">, - AssemblerPredicate<(all_of (not FeatureMadMacF32Insts))>; - def HasDsSrc2Insts : Predicate<"!Subtarget->hasDsSrc2Insts()">, AssemblerPredicate<(all_of FeatureDsSrc2Insts)>; Index: llvm/lib/Target/AMDGPU/SIInstructions.td =================================================================== --- llvm/lib/Target/AMDGPU/SIInstructions.td +++ llvm/lib/Target/AMDGPU/SIInstructions.td @@ -897,7 +897,7 @@ // Don't allow source modifiers. If there are any source modifiers then it's // better to select fma instead of fmac. -let SubtargetPredicate = HasNoMadMacF32Insts in +let SubtargetPredicate = HasFmaLegacy32 in def : GCNPat < (f32 (int_amdgcn_fma_legacy (VOP3NoMods f32:$src0), (VOP3NoMods f32:$src1), Index: llvm/lib/Target/AMDGPU/VOP2Instructions.td =================================================================== --- llvm/lib/Target/AMDGPU/VOP2Instructions.td +++ llvm/lib/Target/AMDGPU/VOP2Instructions.td @@ -679,7 +679,7 @@ } // End SubtargetPredicate = HasDLInsts -let SubtargetPredicate = HasNoMadMacF32Insts in { +let SubtargetPredicate = HasFmaLegacy32 in { let Constraints = "$vdst = $src2", DisableEncoding = "$src2", @@ -687,7 +687,7 @@ isCommutable = 1 in defm V_FMAC_LEGACY_F32 : VOP2Inst <"v_fmac_legacy_f32", VOP_MAC_LEGACY_F32>; -} // End SubtargetPredicate = HasNoMadMacF32Insts +} // End SubtargetPredicate = HasFmaLegacy32 let Constraints = "$vdst = $src2", DisableEncoding="$src2", Index: llvm/lib/Target/AMDGPU/VOP3Instructions.td =================================================================== --- llvm/lib/Target/AMDGPU/VOP3Instructions.td +++ llvm/lib/Target/AMDGPU/VOP3Instructions.td @@ -297,7 +297,7 @@ def V_MAD_F32 : VOP3Inst <"v_mad_f32", VOP3_Profile, fmad>; } // End SubtargetPredicate = HasMadMacInsts -let SubtargetPredicate = HasNoMadMacF32Insts in +let SubtargetPredicate = HasFmaLegacy32 in def V_FMA_LEGACY_F32 : VOP3Inst <"v_fma_legacy_f32", VOP3_Profile, int_amdgcn_fma_legacy>;