brintos

brintos / llvm-project-archived public Read only

0
0
Text · 25.0 KiB · 03304ae Raw
501 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 42; RUN: llc -mtriple=amdgcn -mcpu=gfx1250 < %s | FileCheck -check-prefix=GFX1250 %s3 4define bfloat @mixlo_simple(float %src0, float %src1, float %src2) #0 {5; GFX1250-LABEL: mixlo_simple:6; GFX1250:       ; %bb.0:7; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x08; GFX1250-NEXT:    s_wait_kmcnt 0x09; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v210; GFX1250-NEXT:    s_set_pc_i64 s[30:31]11  %result = call float @llvm.fmuladd.f32(float %src0, float %src1, float %src2)12  %cvt.result = fptrunc float %result to bfloat13  ret bfloat %cvt.result14}15 16define bfloat @mixlo_simpl_no_flush(float %src0, float %src1, float %src2) {17; GFX1250-LABEL: mixlo_simpl_no_flush:18; GFX1250:       ; %bb.0:19; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x020; GFX1250-NEXT:    s_wait_kmcnt 0x021; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v222; GFX1250-NEXT:    s_set_pc_i64 s[30:31]23  %result = call float @llvm.fmuladd.f32(float %src0, float %src1, float %src2)24  %cvt.result = fptrunc float %result to bfloat25  ret bfloat %cvt.result26}27 28define bfloat @v_mad_mixlo_bf16_bf16lo_bf16lo_bf16lo(bfloat %src0, bfloat %src1, bfloat %src2) #0 {29; GFX1250-LABEL: v_mad_mixlo_bf16_bf16lo_bf16lo_bf16lo:30; GFX1250:       ; %bb.0:31; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x032; GFX1250-NEXT:    s_wait_kmcnt 0x033; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v2 op_sel_hi:[1,1,1]34; GFX1250-NEXT:    s_set_pc_i64 s[30:31]35  %src0.ext = fpext bfloat %src0 to float36  %src1.ext = fpext bfloat %src1 to float37  %src2.ext = fpext bfloat %src2 to float38  %result = tail call float @llvm.fmuladd.f32(float %src0.ext, float %src1.ext, float %src2.ext)39  %cvt.result = fptrunc float %result to bfloat40  ret bfloat %cvt.result41}42 43define bfloat @v_mad_mixlo_bf16_bf16lo_bf16lo_bf16lo_no_flush(bfloat %src0, bfloat %src1, bfloat %src2) {44; GFX1250-LABEL: v_mad_mixlo_bf16_bf16lo_bf16lo_bf16lo_no_flush:45; GFX1250:       ; %bb.0:46; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x047; GFX1250-NEXT:    s_wait_kmcnt 0x048; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v2 op_sel_hi:[1,1,1]49; GFX1250-NEXT:    s_set_pc_i64 s[30:31]50  %src0.ext = fpext bfloat %src0 to float51  %src1.ext = fpext bfloat %src1 to float52  %src2.ext = fpext bfloat %src2 to float53  %result = tail call float @llvm.fmuladd.f32(float %src0.ext, float %src1.ext, float %src2.ext)54  %cvt.result = fptrunc float %result to bfloat55  ret bfloat %cvt.result56}57 58define bfloat @v_mad_mixlo_bf16_bf16lo_bf16lo_f32(bfloat %src0, bfloat %src1, float %src2) #0 {59; GFX1250-LABEL: v_mad_mixlo_bf16_bf16lo_bf16lo_f32:60; GFX1250:       ; %bb.0:61; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x062; GFX1250-NEXT:    s_wait_kmcnt 0x063; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v2 op_sel_hi:[1,1,0]64; GFX1250-NEXT:    s_set_pc_i64 s[30:31]65  %src0.ext = fpext bfloat %src0 to float66  %src1.ext = fpext bfloat %src1 to float67  %result = tail call float @llvm.fmuladd.f32(float %src0.ext, float %src1.ext, float %src2)68  %cvt.result = fptrunc float %result to bfloat69  ret bfloat %cvt.result70}71 72define bfloat @v_mad_mixlo_bf16_bf16lo_bf16lo_f32_clamp_post_cvt(bfloat %src0, bfloat %src1, float %src2) #0 {73; GFX1250-LABEL: v_mad_mixlo_bf16_bf16lo_bf16lo_f32_clamp_post_cvt:74; GFX1250:       ; %bb.0:75; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x076; GFX1250-NEXT:    s_wait_kmcnt 0x077; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v2 op_sel_hi:[1,1,0] clamp78; GFX1250-NEXT:    s_set_pc_i64 s[30:31]79  %src0.ext = fpext bfloat %src0 to float80  %src1.ext = fpext bfloat %src1 to float81  %result = tail call float @llvm.fmuladd.f32(float %src0.ext, float %src1.ext, float %src2)82  %cvt.result = fptrunc float %result to bfloat83  %max = call bfloat @llvm.maxnum.bf16(bfloat %cvt.result, bfloat 0.0)84  %clamp = call bfloat @llvm.minnum.bf16(bfloat %max, bfloat 1.0)85  ret bfloat %clamp86}87 88define bfloat @v_mad_mixlo_bf16_bf16lo_bf16lo_f32_clamp_pre_cvt(bfloat %src0, bfloat %src1, float %src2) #0 {89; GFX1250-LABEL: v_mad_mixlo_bf16_bf16lo_bf16lo_f32_clamp_pre_cvt:90; GFX1250:       ; %bb.0:91; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x092; GFX1250-NEXT:    s_wait_kmcnt 0x093; GFX1250-NEXT:    v_fma_mix_f32_bf16 v0, v0, v1, v2 op_sel_hi:[1,1,0] clamp94; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1)95; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, s096; GFX1250-NEXT:    s_set_pc_i64 s[30:31]97  %src0.ext = fpext bfloat %src0 to float98  %src1.ext = fpext bfloat %src1 to float99  %result = tail call float @llvm.fmuladd.f32(float %src0.ext, float %src1.ext, float %src2)100  %max = call float @llvm.maxnum.f32(float %result, float 0.0)101  %clamp = call float @llvm.minnum.f32(float %max, float 1.0)102  %cvt.result = fptrunc float %clamp to bfloat103  ret bfloat %cvt.result104}105 106define <2 x bfloat> @v_mad_mix_v2f32(<2 x bfloat> %src0, <2 x bfloat> %src1, <2 x bfloat> %src2) #0 {107; GFX1250-LABEL: v_mad_mix_v2f32:108; GFX1250:       ; %bb.0:109; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0110; GFX1250-NEXT:    s_wait_kmcnt 0x0111; GFX1250-NEXT:    v_and_b32_e32 v5, 0xffff0000, v0112; GFX1250-NEXT:    v_dual_lshlrev_b32 v4, 16, v0 :: v_dual_lshlrev_b32 v6, 16, v1113; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1114; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2115; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v2116; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)117; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[4:5], v[6:7], v[0:1]118; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1119; GFX1250-NEXT:    s_set_pc_i64 s[30:31]120  %src0.ext = fpext <2 x bfloat> %src0 to <2 x float>121  %src1.ext = fpext <2 x bfloat> %src1 to <2 x float>122  %src2.ext = fpext <2 x bfloat> %src2 to <2 x float>123  %result = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %src0.ext, <2 x float> %src1.ext, <2 x float> %src2.ext)124  %cvt.result = fptrunc <2 x float> %result to <2 x bfloat>125  ret <2 x bfloat> %cvt.result126}127 128define <3 x bfloat> @v_mad_mix_v3f32(<3 x bfloat> %src0, <3 x bfloat> %src1, <3 x bfloat> %src2) #0 {129; GFX1250-LABEL: v_mad_mix_v3f32:130; GFX1250:       ; %bb.0:131; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0132; GFX1250-NEXT:    s_wait_kmcnt 0x0133; GFX1250-NEXT:    v_fma_mixlo_bf16 v6, v0, v2, v4 op_sel_hi:[1,1,1]134; GFX1250-NEXT:    v_fma_mixlo_bf16 v1, v1, v3, v5 op_sel_hi:[1,1,1]135; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)136; GFX1250-NEXT:    v_fma_mixhi_bf16 v6, v0, v2, v4 op_sel:[1,1,1] op_sel_hi:[1,1,1]137; GFX1250-NEXT:    v_mov_b32_e32 v0, v6138; GFX1250-NEXT:    s_set_pc_i64 s[30:31]139  %src0.ext = fpext <3 x bfloat> %src0 to <3 x float>140  %src1.ext = fpext <3 x bfloat> %src1 to <3 x float>141  %src2.ext = fpext <3 x bfloat> %src2 to <3 x float>142  %result = tail call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %src0.ext, <3 x float> %src1.ext, <3 x float> %src2.ext)143  %cvt.result = fptrunc <3 x float> %result to <3 x bfloat>144  ret <3 x bfloat> %cvt.result145}146 147define <4 x bfloat> @v_mad_mix_v4f32(<4 x bfloat> %src0, <4 x bfloat> %src1, <4 x bfloat> %src2) #0 {148; GFX1250-LABEL: v_mad_mix_v4f32:149; GFX1250:       ; %bb.0:150; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0151; GFX1250-NEXT:    s_wait_kmcnt 0x0152; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1153; GFX1250-NEXT:    v_lshlrev_b32_e32 v6, 16, v1154; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v0155; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v0156; GFX1250-NEXT:    v_and_b32_e32 v9, 0xffff0000, v3157; GFX1250-NEXT:    v_lshlrev_b32_e32 v8, 16, v3158; GFX1250-NEXT:    v_and_b32_e32 v3, 0xffff0000, v2159; GFX1250-NEXT:    v_lshlrev_b32_e32 v2, 16, v2160; GFX1250-NEXT:    v_and_b32_e32 v11, 0xffff0000, v5161; GFX1250-NEXT:    v_and_b32_e32 v13, 0xffff0000, v4162; GFX1250-NEXT:    v_dual_lshlrev_b32 v12, 16, v4 :: v_dual_lshlrev_b32 v10, 16, v5163; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)164; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[0:1], v[2:3], v[12:13]165; GFX1250-NEXT:    v_pk_fma_f32 v[2:3], v[6:7], v[8:9], v[10:11]166; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)167; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1168; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v1, v2, v3169; GFX1250-NEXT:    s_set_pc_i64 s[30:31]170  %src0.ext = fpext <4 x bfloat> %src0 to <4 x float>171  %src1.ext = fpext <4 x bfloat> %src1 to <4 x float>172  %src2.ext = fpext <4 x bfloat> %src2 to <4 x float>173  %result = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %src0.ext, <4 x float> %src1.ext, <4 x float> %src2.ext)174  %cvt.result = fptrunc <4 x float> %result to <4 x bfloat>175  ret <4 x bfloat> %cvt.result176}177 178define <2 x bfloat> @v_mad_mix_v2f32_clamp_postcvt(<2 x bfloat> %src0, <2 x bfloat> %src1, <2 x bfloat> %src2) #0 {179; GFX1250-LABEL: v_mad_mix_v2f32_clamp_postcvt:180; GFX1250:       ; %bb.0:181; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0182; GFX1250-NEXT:    s_wait_kmcnt 0x0183; GFX1250-NEXT:    v_and_b32_e32 v5, 0xffff0000, v0184; GFX1250-NEXT:    v_dual_lshlrev_b32 v4, 16, v0 :: v_dual_lshlrev_b32 v6, 16, v1185; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1186; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2187; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v2188; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)189; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[4:5], v[6:7], v[0:1]190; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1 clamp191; GFX1250-NEXT:    s_set_pc_i64 s[30:31]192  %src0.ext = fpext <2 x bfloat> %src0 to <2 x float>193  %src1.ext = fpext <2 x bfloat> %src1 to <2 x float>194  %src2.ext = fpext <2 x bfloat> %src2 to <2 x float>195  %result = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %src0.ext, <2 x float> %src1.ext, <2 x float> %src2.ext)196  %cvt.result = fptrunc <2 x float> %result to <2 x bfloat>197  %max = call <2 x bfloat> @llvm.maxnum.v2bf16(<2 x bfloat> %cvt.result, <2 x bfloat> zeroinitializer)198  %clamp = call <2 x bfloat> @llvm.minnum.v2bf16(<2 x bfloat> %max, <2 x bfloat> <bfloat 1.0, bfloat 1.0>)199  ret <2 x bfloat> %clamp200}201 202define <3 x bfloat> @v_mad_mix_v3f32_clamp_postcvt(<3 x bfloat> %src0, <3 x bfloat> %src1, <3 x bfloat> %src2) #0 {203; GFX1250-LABEL: v_mad_mix_v3f32_clamp_postcvt:204; GFX1250:       ; %bb.0:205; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0206; GFX1250-NEXT:    s_wait_kmcnt 0x0207; GFX1250-NEXT:    v_fma_mixlo_bf16 v6, v0, v2, v4 op_sel_hi:[1,1,1] clamp208; GFX1250-NEXT:    v_fma_mixlo_bf16 v1, v1, v3, v5 op_sel_hi:[1,1,1]209; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)210; GFX1250-NEXT:    v_fma_mixhi_bf16 v6, v0, v2, v4 op_sel:[1,1,1] op_sel_hi:[1,1,1] clamp211; GFX1250-NEXT:    v_pk_max_num_bf16 v1, v1, v1 clamp212; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2)213; GFX1250-NEXT:    v_mov_b32_e32 v0, v6214; GFX1250-NEXT:    s_set_pc_i64 s[30:31]215  %src0.ext = fpext <3 x bfloat> %src0 to <3 x float>216  %src1.ext = fpext <3 x bfloat> %src1 to <3 x float>217  %src2.ext = fpext <3 x bfloat> %src2 to <3 x float>218  %result = tail call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %src0.ext, <3 x float> %src1.ext, <3 x float> %src2.ext)219  %cvt.result = fptrunc <3 x float> %result to <3 x bfloat>220  %max = call <3 x bfloat> @llvm.maxnum.v3bf16(<3 x bfloat> %cvt.result, <3 x bfloat> zeroinitializer)221  %clamp = call <3 x bfloat> @llvm.minnum.v3bf16(<3 x bfloat> %max, <3 x bfloat> <bfloat 1.0, bfloat 1.0, bfloat 1.0>)222  ret <3 x bfloat> %clamp223}224 225define <4 x bfloat> @v_mad_mix_v4f32_clamp_postcvt(<4 x bfloat> %src0, <4 x bfloat> %src1, <4 x bfloat> %src2) #0 {226; GFX1250-LABEL: v_mad_mix_v4f32_clamp_postcvt:227; GFX1250:       ; %bb.0:228; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0229; GFX1250-NEXT:    s_wait_kmcnt 0x0230; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v0231; GFX1250-NEXT:    v_dual_lshlrev_b32 v6, 16, v0 :: v_dual_lshlrev_b32 v8, 16, v1232; GFX1250-NEXT:    v_and_b32_e32 v9, 0xffff0000, v1233; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2234; GFX1250-NEXT:    v_dual_lshlrev_b32 v0, 16, v2 :: v_dual_lshlrev_b32 v10, 16, v3235; GFX1250-NEXT:    v_and_b32_e32 v11, 0xffff0000, v3236; GFX1250-NEXT:    v_and_b32_e32 v3, 0xffff0000, v4237; GFX1250-NEXT:    v_dual_lshlrev_b32 v2, 16, v4 :: v_dual_lshlrev_b32 v12, 16, v5238; GFX1250-NEXT:    v_and_b32_e32 v13, 0xffff0000, v5239; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)240; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[6:7], v[0:1], v[2:3]241; GFX1250-NEXT:    v_pk_fma_f32 v[2:3], v[8:9], v[10:11], v[12:13]242; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)243; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1 clamp244; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v1, v2, v3 clamp245; GFX1250-NEXT:    s_set_pc_i64 s[30:31]246  %src0.ext = fpext <4 x bfloat> %src0 to <4 x float>247  %src1.ext = fpext <4 x bfloat> %src1 to <4 x float>248  %src2.ext = fpext <4 x bfloat> %src2 to <4 x float>249  %result = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %src0.ext, <4 x float> %src1.ext, <4 x float> %src2.ext)250  %cvt.result = fptrunc <4 x float> %result to <4 x bfloat>251  %max = call <4 x bfloat> @llvm.maxnum.v4bf16(<4 x bfloat> %cvt.result, <4 x bfloat> zeroinitializer)252  %clamp = call <4 x bfloat> @llvm.minnum.v4bf16(<4 x bfloat> %max, <4 x bfloat> <bfloat 1.0, bfloat 1.0, bfloat 1.0, bfloat 1.0>)253  ret <4 x bfloat> %clamp254}255 256define <2 x bfloat> @v_mad_mix_v2f32_clamp_postcvt_lo(<2 x bfloat> %src0, <2 x bfloat> %src1, <2 x bfloat> %src2) #0 {257; GFX1250-LABEL: v_mad_mix_v2f32_clamp_postcvt_lo:258; GFX1250:       ; %bb.0:259; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0260; GFX1250-NEXT:    s_wait_kmcnt 0x0261; GFX1250-NEXT:    v_and_b32_e32 v5, 0xffff0000, v0262; GFX1250-NEXT:    v_dual_lshlrev_b32 v4, 16, v0 :: v_dual_lshlrev_b32 v6, 16, v1263; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1264; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2265; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v2266; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)267; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[4:5], v[6:7], v[0:1]268; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1269; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)270; GFX1250-NEXT:    v_pk_max_num_bf16 v1, v0, v0 clamp271; GFX1250-NEXT:    v_bfi_b32 v0, 0xffff, v1, v0272; GFX1250-NEXT:    s_set_pc_i64 s[30:31]273  %src0.ext = fpext <2 x bfloat> %src0 to <2 x float>274  %src1.ext = fpext <2 x bfloat> %src1 to <2 x float>275  %src2.ext = fpext <2 x bfloat> %src2 to <2 x float>276  %result = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %src0.ext, <2 x float> %src1.ext, <2 x float> %src2.ext)277  %cvt.result = fptrunc <2 x float> %result to <2 x bfloat>278  %cvt.lo = extractelement <2 x bfloat> %cvt.result, i32 0279  %max.lo = call bfloat @llvm.maxnum.bf16(bfloat %cvt.lo, bfloat 0.0)280  %clamp.lo = call bfloat @llvm.minnum.bf16(bfloat %max.lo, bfloat 1.0)281  %insert = insertelement <2 x bfloat> %cvt.result, bfloat %clamp.lo, i32 0282  ret <2 x bfloat> %insert283}284 285define <2 x bfloat> @v_mad_mix_v2f32_clamp_postcvt_hi(<2 x bfloat> %src0, <2 x bfloat> %src1, <2 x bfloat> %src2) #0 {286; GFX1250-LABEL: v_mad_mix_v2f32_clamp_postcvt_hi:287; GFX1250:       ; %bb.0:288; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0289; GFX1250-NEXT:    s_wait_kmcnt 0x0290; GFX1250-NEXT:    v_and_b32_e32 v5, 0xffff0000, v0291; GFX1250-NEXT:    v_dual_lshlrev_b32 v4, 16, v0 :: v_dual_lshlrev_b32 v6, 16, v1292; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1293; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2294; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v2295; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)296; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[4:5], v[6:7], v[0:1]297; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1298; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)299; GFX1250-NEXT:    v_lshrrev_b32_e32 v1, 16, v0300; GFX1250-NEXT:    v_pk_max_num_bf16 v1, v1, v1 clamp301; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1)302; GFX1250-NEXT:    v_perm_b32 v0, v1, v0, 0x5040100303; GFX1250-NEXT:    s_set_pc_i64 s[30:31]304  %src0.ext = fpext <2 x bfloat> %src0 to <2 x float>305  %src1.ext = fpext <2 x bfloat> %src1 to <2 x float>306  %src2.ext = fpext <2 x bfloat> %src2 to <2 x float>307  %result = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %src0.ext, <2 x float> %src1.ext, <2 x float> %src2.ext)308  %cvt.result = fptrunc <2 x float> %result to <2 x bfloat>309  %cvt.hi = extractelement <2 x bfloat> %cvt.result, i32 1310  %max.hi = call bfloat @llvm.maxnum.bf16(bfloat %cvt.hi, bfloat 0.0)311  %clamp.hi = call bfloat @llvm.minnum.bf16(bfloat %max.hi, bfloat 1.0)312  %insert = insertelement <2 x bfloat> %cvt.result, bfloat %clamp.hi, i32 1313  ret <2 x bfloat> %insert314}315 316define <2 x bfloat> @v_mad_mix_v2f32_clamp_precvt(<2 x bfloat> %src0, <2 x bfloat> %src1, <2 x bfloat> %src2) #0 {317; GFX1250-LABEL: v_mad_mix_v2f32_clamp_precvt:318; GFX1250:       ; %bb.0:319; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0320; GFX1250-NEXT:    s_wait_kmcnt 0x0321; GFX1250-NEXT:    v_and_b32_e32 v5, 0xffff0000, v0322; GFX1250-NEXT:    v_dual_lshlrev_b32 v4, 16, v0 :: v_dual_lshlrev_b32 v6, 16, v1323; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v1324; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2325; GFX1250-NEXT:    v_lshlrev_b32_e32 v0, 16, v2326; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)327; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[4:5], v[6:7], v[0:1]328; GFX1250-NEXT:    v_max_num_f32_e64 v1, v1, v1 clamp329; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)330; GFX1250-NEXT:    v_max_num_f32_e64 v0, v0, v0 clamp331; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1332; GFX1250-NEXT:    s_set_pc_i64 s[30:31]333  %src0.ext = fpext <2 x bfloat> %src0 to <2 x float>334  %src1.ext = fpext <2 x bfloat> %src1 to <2 x float>335  %src2.ext = fpext <2 x bfloat> %src2 to <2 x float>336  %result = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %src0.ext, <2 x float> %src1.ext, <2 x float> %src2.ext)337  %max = call <2 x float> @llvm.maxnum.v2f32(<2 x float> %result, <2 x float> zeroinitializer)338  %clamp = call <2 x float> @llvm.minnum.v2f32(<2 x float> %max, <2 x float> <float 1.0, float 1.0>)339  %cvt.result = fptrunc <2 x float> %clamp to <2 x bfloat>340  ret <2 x bfloat> %cvt.result341}342 343define <3 x bfloat> @v_mad_mix_v3f32_clamp_precvt(<3 x bfloat> %src0, <3 x bfloat> %src1, <3 x bfloat> %src2) #0 {344; GFX1250-LABEL: v_mad_mix_v3f32_clamp_precvt:345; GFX1250:       ; %bb.0:346; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0347; GFX1250-NEXT:    s_wait_kmcnt 0x0348; GFX1250-NEXT:    v_fma_mix_f32_bf16 v6, v0, v2, v4 op_sel_hi:[1,1,1] clamp349; GFX1250-NEXT:    v_fma_mix_f32_bf16 v0, v0, v2, v4 op_sel:[1,1,1] op_sel_hi:[1,1,1] clamp350; GFX1250-NEXT:    v_fma_mix_f32_bf16 v1, v1, v3, v5 op_sel_hi:[1,1,1] clamp351; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)352; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v6, v0353; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v1, v1, s0354; GFX1250-NEXT:    s_set_pc_i64 s[30:31]355  %src0.ext = fpext <3 x bfloat> %src0 to <3 x float>356  %src1.ext = fpext <3 x bfloat> %src1 to <3 x float>357  %src2.ext = fpext <3 x bfloat> %src2 to <3 x float>358  %result = tail call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %src0.ext, <3 x float> %src1.ext, <3 x float> %src2.ext)359  %max = call <3 x float> @llvm.maxnum.v3f32(<3 x float> %result, <3 x float> zeroinitializer)360  %clamp = call <3 x float> @llvm.minnum.v3f32(<3 x float> %max, <3 x float> <float 1.0, float 1.0, float 1.0>)361  %cvt.result = fptrunc <3 x float> %clamp to <3 x bfloat>362  ret <3 x bfloat> %cvt.result363}364 365define <4 x bfloat> @v_mad_mix_v4f32_clamp_precvt(<4 x bfloat> %src0, <4 x bfloat> %src1, <4 x bfloat> %src2) #0 {366; GFX1250-LABEL: v_mad_mix_v4f32_clamp_precvt:367; GFX1250:       ; %bb.0:368; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0369; GFX1250-NEXT:    s_wait_kmcnt 0x0370; GFX1250-NEXT:    v_and_b32_e32 v7, 0xffff0000, v0371; GFX1250-NEXT:    v_dual_lshlrev_b32 v6, 16, v0 :: v_dual_lshlrev_b32 v8, 16, v1372; GFX1250-NEXT:    v_and_b32_e32 v9, 0xffff0000, v1373; GFX1250-NEXT:    v_and_b32_e32 v1, 0xffff0000, v2374; GFX1250-NEXT:    v_dual_lshlrev_b32 v0, 16, v2 :: v_dual_lshlrev_b32 v10, 16, v3375; GFX1250-NEXT:    v_and_b32_e32 v11, 0xffff0000, v3376; GFX1250-NEXT:    v_and_b32_e32 v3, 0xffff0000, v4377; GFX1250-NEXT:    v_and_b32_e32 v13, 0xffff0000, v5378; GFX1250-NEXT:    v_dual_lshlrev_b32 v12, 16, v5 :: v_dual_lshlrev_b32 v2, 16, v4379; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)380; GFX1250-NEXT:    v_pk_fma_f32 v[4:5], v[8:9], v[10:11], v[12:13]381; GFX1250-NEXT:    v_pk_fma_f32 v[0:1], v[6:7], v[0:1], v[2:3]382; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)383; GFX1250-NEXT:    v_max_num_f32_e64 v2, v5, v5 clamp384; GFX1250-NEXT:    v_max_num_f32_e64 v1, v1, v1 clamp385; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)386; GFX1250-NEXT:    v_max_num_f32_e64 v0, v0, v0 clamp387; GFX1250-NEXT:    v_max_num_f32_e64 v3, v4, v4 clamp388; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v0, v0, v1389; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_2)390; GFX1250-NEXT:    v_cvt_pk_bf16_f32 v1, v3, v2391; GFX1250-NEXT:    s_set_pc_i64 s[30:31]392  %src0.ext = fpext <4 x bfloat> %src0 to <4 x float>393  %src1.ext = fpext <4 x bfloat> %src1 to <4 x float>394  %src2.ext = fpext <4 x bfloat> %src2 to <4 x float>395  %result = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %src0.ext, <4 x float> %src1.ext, <4 x float> %src2.ext)396  %max = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %result, <4 x float> zeroinitializer)397  %clamp = call <4 x float> @llvm.minnum.v4f32(<4 x float> %max, <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>)398  %cvt.result = fptrunc <4 x float> %clamp to <4 x bfloat>399  ret <4 x bfloat> %cvt.result400}401 402define i32 @mixlo_zext(float %src0, float %src1, float %src2) #0 {403; GFX1250-LABEL: mixlo_zext:404; GFX1250:       ; %bb.0:405; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0406; GFX1250-NEXT:    s_wait_kmcnt 0x0407; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, v2408; GFX1250-NEXT:    s_delay_alu instid0(VALU_DEP_1)409; GFX1250-NEXT:    v_and_b32_e32 v0, 0xffff, v0410; GFX1250-NEXT:    s_set_pc_i64 s[30:31]411  %result = call float @llvm.fmuladd.f32(float %src0, float %src1, float %src2)412  %cvt.result = fptrunc float %result to bfloat413  %cvt.result.i16 = bitcast bfloat %cvt.result to i16414  %cvt.result.i32 = zext i16 %cvt.result.i16 to i32415  ret i32 %cvt.result.i32416}417 418define bfloat @mixlo_fptrunc(float %a, float %b) #0 {419; GFX1250-LABEL: mixlo_fptrunc:420; GFX1250:       ; %bb.0: ; %.entry421; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0422; GFX1250-NEXT:    s_wait_kmcnt 0x0423; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, 0424; GFX1250-NEXT:    s_set_pc_i64 s[30:31]425.entry:426  %mul = fmul float %a, %b427  %trunc = fptrunc float %mul to bfloat428  ret bfloat %trunc429}430 431define bfloat @mixlo_fptrunc_no_flush(float %a, float %b) {432; GFX1250-LABEL: mixlo_fptrunc_no_flush:433; GFX1250:       ; %bb.0: ; %.entry434; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0435; GFX1250-NEXT:    s_wait_kmcnt 0x0436; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, v0, v1, 0437; GFX1250-NEXT:    s_set_pc_i64 s[30:31]438.entry:439  %mul = fmul float %a, %b440  %trunc = fptrunc float %mul to bfloat441  ret bfloat %trunc442}443 444define bfloat @mixlo_fptrunc_abs_src_mod(float %a, float %b) #0 {445; GFX1250-LABEL: mixlo_fptrunc_abs_src_mod:446; GFX1250:       ; %bb.0: ; %.entry447; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0448; GFX1250-NEXT:    s_wait_kmcnt 0x0449; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, |v0|, v1, 0450; GFX1250-NEXT:    s_set_pc_i64 s[30:31]451.entry:452  %a.fabs = call float @llvm.fabs.f32(float %a)453  %mul = fmul float %a.fabs, %b454  %trunc = fptrunc float %mul to bfloat455  ret bfloat %trunc456}457 458define bfloat @mixlo_fptrunc_neg_src_mod(float %a, float %b) #0 {459; GFX1250-LABEL: mixlo_fptrunc_neg_src_mod:460; GFX1250:       ; %bb.0: ; %.entry461; GFX1250-NEXT:    s_wait_loadcnt_dscnt 0x0462; GFX1250-NEXT:    s_wait_kmcnt 0x0463; GFX1250-NEXT:    v_fma_mixlo_bf16 v0, -v0, v1, 0464; GFX1250-NEXT:    s_set_pc_i64 s[30:31]465.entry:466  %a.fneg = fneg float %a467  %mul = fmul float %a.fneg, %b468  %trunc = fptrunc float %mul to bfloat469  ret bfloat %trunc470}471 472declare float @llvm.fabs.f32(float) #1473 474declare bfloat @llvm.minnum.bf16(bfloat, bfloat) #1475declare <2 x bfloat> @llvm.minnum.v2bf16(<2 x bfloat>, <2 x bfloat>) #1476declare <3 x bfloat> @llvm.minnum.v3bf16(<3 x bfloat>, <3 x bfloat>) #1477declare <4 x bfloat> @llvm.minnum.v4bf16(<4 x bfloat>, <4 x bfloat>) #1478 479declare bfloat @llvm.maxnum.bf16(bfloat, bfloat) #1480declare <2 x bfloat> @llvm.maxnum.v2bf16(<2 x bfloat>, <2 x bfloat>) #1481declare <3 x bfloat> @llvm.maxnum.v3bf16(<3 x bfloat>, <3 x bfloat>) #1482declare <4 x bfloat> @llvm.maxnum.v4bf16(<4 x bfloat>, <4 x bfloat>) #1483 484declare float @llvm.minnum.f32(float, float) #1485declare <2 x float> @llvm.minnum.v2f32(<2 x float>, <2 x float>) #1486declare <3 x float> @llvm.minnum.v3f32(<3 x float>, <3 x float>) #1487declare <4 x float> @llvm.minnum.v4f32(<4 x float>, <4 x float>) #1488 489declare float @llvm.maxnum.f32(float, float) #1490declare <2 x float> @llvm.maxnum.v2f32(<2 x float>, <2 x float>) #1491declare <3 x float> @llvm.maxnum.v3f32(<3 x float>, <3 x float>) #1492declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>) #1493 494declare float @llvm.fmuladd.f32(float, float, float) #1495declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #1496declare <3 x float> @llvm.fmuladd.v3f32(<3 x float>, <3 x float>, <3 x float>) #1497declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #1498 499attributes #0 = { nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" }500attributes #1 = { nounwind readnone speculatable }501