Skip to content

Commit a92fed3

Browse files
committed
added missing v_med3_i/u16 fake16 pattern
1 parent 1f2d934 commit a92fed3

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

llvm/lib/Target/AMDGPU/SIInstructions.td

+14-6
Original file line numberDiff line numberDiff line change
@@ -3645,13 +3645,15 @@ multiclass FPMed3Pat<ValueType vt,
36453645

36463646
multiclass Int16Med3Pat<Instruction med3Inst,
36473647
SDPatternOperator min,
3648-
SDPatternOperator max> {
3648+
SDPatternOperator max,
3649+
RegisterOperand outputSrcType> {
36493650
// This matches 16 permutations of
36503651
// max(min(x, y), min(max(x, y), z))
36513652
def : GCNPat <
36523653
(max (min i16:$src0, i16:$src1),
36533654
(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)
36553657
>;
36563658

36573659
// This matches 16 permutations of
@@ -3719,10 +3721,16 @@ def : FPMinCanonMaxPat<V_MINMAX_F16_fake16_e64, f16, fmaxnum_like, fminnum_like_
37193721
def : FPMinCanonMaxPat<V_MAXMIN_F16_fake16_e64, f16, fminnum_like, fmaxnum_like_oneuse>;
37203722
}
37213723

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]
37263734

37273735
let OtherPredicates = [isGFX12Plus] in {
37283736
def : FPMinMaxPat<V_MINIMUMMAXIMUM_F32_e64, f32, DivergentBinFrag<fmaximum>, fminimum_oneuse>;

0 commit comments

Comments
 (0)