Skip to content

Commit 8d9e2f4

Browse files
jayfoadjoaosaffran
authored andcommitted
[AMDGPU] Simplify OtherPredicates handling in MadFmaMixPats. NFC. (llvm#127044)
This removes some of the complexity added by ad6cd7e by setting OtherPredicates outside MadFmaMixPats rather than inside it.
1 parent 4a76f88 commit 8d9e2f4

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

llvm/lib/Target/AMDGPU/VOP3PInstructions.td

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,10 @@ defm V_PK_MAXIMUM3_F16 : VOP3PInst<"v_pk_maximum3_f16", VOP3P_Profile<VOP_V2F16_
154154
multiclass MadFmaMixPats<SDPatternOperator fma_like,
155155
Instruction mix_inst,
156156
Instruction mixlo_inst,
157-
Instruction mixhi_inst,
158-
bit HasFP32Denormals> {
157+
Instruction mixhi_inst> {
159158
// At least one of the operands needs to be an fpextend of an f16
160159
// for this to be worthwhile, so we need three patterns here.
161160
// TODO: Could we use a predicate to inspect src1/2/3 instead?
162-
let OtherPredicates = !if(HasFP32Denormals, [TruePredicate], [NoFP32Denormals]) in {
163161
def : GCNPat <
164162
(f32 (fma_like (f32 (VOP3PMadMixModsExt f16:$src0, i32:$src0_mods)),
165163
(f32 (VOP3PMadMixMods f16:$src1, i32:$src1_mods)),
@@ -228,13 +226,12 @@ multiclass MadFmaMixPats<SDPatternOperator fma_like,
228226
DSTCLAMP.NONE,
229227
(i32 (IMPLICIT_DEF)))
230228
>;
231-
} // End OtherPredicates
232229

233230
// FIXME: Special case handling for maxhi (especially for clamp)
234231
// because dealing with the write to high half of the register is
235232
// difficult.
236233
foreach p = [NotHasTrue16BitInsts, UseFakeTrue16Insts] in
237-
let OtherPredicates = !if(HasFP32Denormals, [TruePredicate], [NoFP32Denormals]), True16Predicate = p in {
234+
let True16Predicate = p in {
238235

239236
def : GCNPat <
240237
(build_vector f16:$elt0, (f16 (fpround (fma_like (f32 (VOP3PMadMixMods f16:$src0, i32:$src0_modifiers)),
@@ -260,9 +257,9 @@ multiclass MadFmaMixPats<SDPatternOperator fma_like,
260257
VGPR_32:$elt0))
261258
>;
262259

263-
} // end OtherPredicates
260+
} // end True16Predicate
264261

265-
let OtherPredicates = !if(HasFP32Denormals, [TruePredicate], [NoFP32Denormals]), True16Predicate = UseRealTrue16Insts in {
262+
let True16Predicate = UseRealTrue16Insts in {
266263
def : GCNPat <
267264
(build_vector (f16 (fpround (fma_like (f32 (VOP3PMadMixMods f16:$src0, i32:$src0_modifiers)),
268265
(f32 (VOP3PMadMixMods f16:$src1, i32:$src1_modifiers)),
@@ -297,7 +294,7 @@ multiclass MadFmaMixPats<SDPatternOperator fma_like,
297294
DSTCLAMP.ENABLE,
298295
(REG_SEQUENCE VGPR_32, $elt0, lo16, (f16 (IMPLICIT_DEF)), hi16)))
299296
>;
300-
} // end OtherPredicates
297+
} // end True16Predicate
301298
}
302299

303300
class MinimumMaximumByMinimum3Maximum3VOP3P<SDPatternOperator node,
@@ -330,9 +327,9 @@ defm V_MAD_MIXHI_F16 : VOP3_VOP3PInst<"v_mad_mixhi_f16", VOP3P_Mix_Profile<VOP_F
330327
}
331328
} // End FPDPRounding = 1
332329
}
333-
} // OtherPredicates = [NoFP32Denormals]
334330

335-
defm : MadFmaMixPats<fmad, V_MAD_MIX_F32, V_MAD_MIXLO_F16, V_MAD_MIXHI_F16, 0 /*HasFP32Denormals*/>;
331+
defm : MadFmaMixPats<fmad, V_MAD_MIX_F32, V_MAD_MIXLO_F16, V_MAD_MIXHI_F16>;
332+
} // OtherPredicates = [NoFP32Denormals]
336333
} // End SubtargetPredicate = HasMadMixInsts
337334

338335

@@ -353,7 +350,7 @@ defm V_FMA_MIXHI_F16 : VOP3_VOP3PInst<"v_fma_mixhi_f16", VOP3P_Mix_Profile<VOP_F
353350
} // End FPDPRounding = 1
354351
}
355352

356-
defm : MadFmaMixPats<fma, V_FMA_MIX_F32, V_FMA_MIXLO_F16, V_FMA_MIXHI_F16, 1 /*HasPF32Denormals*/>;
353+
defm : MadFmaMixPats<fma, V_FMA_MIX_F32, V_FMA_MIXLO_F16, V_FMA_MIXHI_F16>;
357354
}
358355

359356
// Defines patterns that extract signed 4bit from each Idx[0].

0 commit comments

Comments
 (0)