@@ -3645,13 +3645,15 @@ multiclass FPMed3Pat<ValueType vt,
3645
3645
3646
3646
multiclass Int16Med3Pat<Instruction med3Inst,
3647
3647
SDPatternOperator min,
3648
- SDPatternOperator max> {
3648
+ SDPatternOperator max,
3649
+ RegisterOperand outputSrcType> {
3649
3650
// This matches 16 permutations of
3650
3651
// max(min(x, y), min(max(x, y), z))
3651
3652
def : GCNPat <
3652
3653
(max (min i16:$src0, i16:$src1),
3653
3654
(min (max i16:$src0, i16:$src1), i16:$src2)),
3654
- (med3Inst SRCMODS.NONE, VSrc_b16:$src0, SRCMODS.NONE, VSrc_b16:$src1, SRCMODS.NONE, VSrc_b16:$src2, DSTCLAMP.NONE)
3655
+ (med3Inst SRCMODS.NONE, outputSrcType:$src0, SRCMODS.NONE, outputSrcType:$src1,
3656
+ SRCMODS.NONE, outputSrcType:$src2, DSTCLAMP.NONE)
3655
3657
>;
3656
3658
3657
3659
// This matches 16 permutations of
@@ -3719,10 +3721,16 @@ def : FPMinCanonMaxPat<V_MINMAX_F16_fake16_e64, f16, fmaxnum_like, fminnum_like_
3719
3721
def : FPMinCanonMaxPat<V_MAXMIN_F16_fake16_e64, f16, fminnum_like, fmaxnum_like_oneuse>;
3720
3722
}
3721
3723
3722
- let OtherPredicates = [isGFX9Plus] in {
3723
- defm : Int16Med3Pat<V_MED3_I16_e64, smin, smax>;
3724
- defm : Int16Med3Pat<V_MED3_U16_e64, umin, umax>;
3725
- } // End Predicates = [isGFX9Plus]
3724
+ let SubtargetPredicate = isGFX9Plus in {
3725
+ let True16Predicate = NotHasTrue16BitInsts in {
3726
+ defm : Int16Med3Pat<V_MED3_I16_e64, smin, smax, VSrc_b16>;
3727
+ defm : Int16Med3Pat<V_MED3_U16_e64, umin, umax, VSrc_b16>;
3728
+ }
3729
+ let True16Predicate = UseFakeTrue16Insts in {
3730
+ defm : Int16Med3Pat<V_MED3_I16_fake16_e64, smin, smax, VSrc_b16>;
3731
+ defm : Int16Med3Pat<V_MED3_U16_fake16_e64, umin, umax, VSrc_b16>;
3732
+ }
3733
+ } // End SubtargetPredicate = [isGFX9Plus]
3726
3734
3727
3735
let OtherPredicates = [isGFX12Plus] in {
3728
3736
def : FPMinMaxPat<V_MINIMUMMAXIMUM_F32_e64, f32, DivergentBinFrag<fmaximum>, fminimum_oneuse>;
0 commit comments