diff --git a/llvm/lib/Target/AMDGPU/SIInstructions.td b/llvm/lib/Target/AMDGPU/SIInstructions.td --- a/llvm/lib/Target/AMDGPU/SIInstructions.td +++ b/llvm/lib/Target/AMDGPU/SIInstructions.td @@ -984,20 +984,18 @@ // NoMods pattern used for mac. If there are any source modifiers then it's // better to select mad instead of mac. -class FMADPat - : GCNPat <(vt (node (vt (VOP3NoMods vt:$src0)), - (vt (VOP3NoMods vt:$src1)), - (vt (VOP3NoMods vt:$src2)))), +class FMADPat + : GCNPat <(vt (any_fmad (vt (VOP3NoMods vt:$src0)), + (vt (VOP3NoMods vt:$src1)), + (vt (VOP3NoMods vt:$src2)))), (inst SRCMODS.NONE, $src0, SRCMODS.NONE, $src1, SRCMODS.NONE, $src2, DSTCLAMP.NONE, DSTOMOD.NONE) >; // Prefer mac form when there are no modifiers. let AddedComplexity = 9 in { -let OtherPredicates = [HasMadMacF32Insts] in { -def : FMADPat ; -def : FMADPat ; -} // OtherPredicates = [HasMadMacF32Insts] +let OtherPredicates = [HasMadMacF32Insts] in +def : FMADPat ; // Don't allow source modifiers. If there are any source modifiers then it's // better to select mad instead of mac. @@ -1022,24 +1020,10 @@ SRCMODS.NONE, $src2, DSTCLAMP.NONE, DSTOMOD.NONE) >; -let SubtargetPredicate = Has16BitInsts in { -def : FMADPat ; -def : FMADPat ; -} // SubtargetPredicate = Has16BitInsts +let SubtargetPredicate = Has16BitInsts in +def : FMADPat ; } // AddedComplexity = 9 -class FMADModsPat - : GCNPat< - (Ty (mad_opr (Ty (VOP3Mods Ty:$src0, i32:$src0_mod)), - (Ty (VOP3Mods Ty:$src1, i32:$src1_mod)), - (Ty (VOP3Mods Ty:$src2, i32:$src2_mod)))), - (inst $src0_mod, $src0, $src1_mod, $src1, - $src2_mod, $src2, DSTCLAMP.NONE, DSTOMOD.NONE) ->; - -let OtherPredicates = [HasMadMacF32Insts] in -def : FMADModsPat; - let OtherPredicates = [HasMadMacF32Insts, NoFP32Denormals] in def : GCNPat < (f32 (fadd (AMDGPUfmul_legacy (VOP3Mods f32:$src0, i32:$src0_mod), @@ -1049,9 +1033,6 @@ $src2_mod, $src2, DSTCLAMP.NONE, DSTOMOD.NONE) >; -let SubtargetPredicate = Has16BitInsts in -def : FMADModsPat; - class VOPSelectModsPat : GCNPat < (vt (select i1:$src0, (VOP3Mods vt:$src1, i32:$src1_mods), (VOP3Mods vt:$src2, i32:$src2_mods))), diff --git a/llvm/lib/Target/AMDGPU/VOP3Instructions.td b/llvm/lib/Target/AMDGPU/VOP3Instructions.td --- a/llvm/lib/Target/AMDGPU/VOP3Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP3Instructions.td @@ -123,7 +123,7 @@ let mayRaiseFPException = 0 in { let SubtargetPredicate = HasMadMacF32Insts in { defm V_MAD_LEGACY_F32 : VOP3Inst <"v_mad_legacy_f32", VOP3_Profile>; -defm V_MAD_F32 : VOP3Inst <"v_mad_f32", VOP3_Profile, fmad>; +defm V_MAD_F32 : VOP3Inst <"v_mad_f32", VOP3_Profile, any_fmad>; } // End SubtargetPredicate = HasMadMacInsts let SubtargetPredicate = HasFmaLegacy32 in @@ -318,7 +318,7 @@ defm V_MAD_U16 : VOP3Inst <"v_mad_u16", VOP3_Profile>; defm V_MAD_I16 : VOP3Inst <"v_mad_i16", VOP3_Profile>; let FPDPRounding = 1 in { - defm V_MAD_F16 : VOP3Inst <"v_mad_f16", VOP3_Profile, fmad>; + defm V_MAD_F16 : VOP3Inst <"v_mad_f16", VOP3_Profile, any_fmad>; let Uses = [MODE, M0, EXEC] in { let OtherPredicates = [isNotGFX90APlus] in // For some reason the intrinsic operands are in a different order