Skip to content

Commit e71da01

Browse files
authored
[AMDGPU][True16] add true16 pattern for cvt_pk_fp32_f8 (#180096)
1 parent 7712249 commit e71da01

2 files changed

Lines changed: 299 additions & 136 deletions

File tree

llvm/lib/Target/AMDGPU/VOP1Instructions.td

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,12 +821,25 @@ class Cvt_PK_F32_F8_Pat_OpSel<SDPatternOperator node, int index,
821821
(inst_e32 $src))
822822
>;
823823

824+
class Cvt_PK_F32_F8_Pat_t16<SDPatternOperator node, int index,
825+
VOP3_Pseudo inst_e64> : GCNPat<
826+
(v2f32 (node i32:$src, index)),
827+
(inst_e64 0, (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS $src, VGPR_32)),
828+
!if(index, hi16, lo16)), 0)
829+
>;
830+
824831
let SubtargetPredicate = isGFX11Plus, OtherPredicates = [HasFP8ConversionInsts] in {
825832
foreach Index = [0, -1] in {
826-
def : Cvt_PK_F32_F8_Pat_OpSel<int_amdgcn_cvt_pk_f32_fp8, Index,
827-
V_CVT_PK_F32_FP8_fake16_e32, V_CVT_PK_F32_FP8_fake16_e64>;
828-
def : Cvt_PK_F32_F8_Pat_OpSel<int_amdgcn_cvt_pk_f32_bf8, Index,
829-
V_CVT_PK_F32_BF8_fake16_e32, V_CVT_PK_F32_BF8_fake16_e64>;
833+
let True16Predicate = UseFakeTrue16Insts in {
834+
def : Cvt_PK_F32_F8_Pat_OpSel<int_amdgcn_cvt_pk_f32_fp8, Index,
835+
V_CVT_PK_F32_FP8_fake16_e32, V_CVT_PK_F32_FP8_fake16_e64>;
836+
def : Cvt_PK_F32_F8_Pat_OpSel<int_amdgcn_cvt_pk_f32_bf8, Index,
837+
V_CVT_PK_F32_BF8_fake16_e32, V_CVT_PK_F32_BF8_fake16_e64>;
838+
}
839+
let True16Predicate = UseRealTrue16Insts in {
840+
def : Cvt_PK_F32_F8_Pat_t16<int_amdgcn_cvt_pk_f32_fp8, Index, V_CVT_PK_F32_FP8_t16_e64>;
841+
def : Cvt_PK_F32_F8_Pat_t16<int_amdgcn_cvt_pk_f32_bf8, Index, V_CVT_PK_F32_BF8_t16_e64>;
842+
}
830843
}
831844
}
832845

0 commit comments

Comments
 (0)