236 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc < %s -mtriple=riscv32 -mattr=+v,+zvfbfwma -verify-machineinstrs | FileCheck %s --check-prefix=ZVFBFWMA3; RUN: llc < %s -mtriple=riscv64 -mattr=+v,+zvfbfwma -verify-machineinstrs | FileCheck %s --check-prefix=ZVFBFWMA4; RUN: llc < %s -mtriple=riscv32 -mattr=+v,+zvfbfmin -verify-machineinstrs | FileCheck %s --check-prefix=ZVFBFMIN5; RUN: llc < %s -mtriple=riscv64 -mattr=+v,+zvfbfmin -verify-machineinstrs | FileCheck %s --check-prefix=ZVFBFMIN6 7define <vscale x 1 x float> @vfwmaccbf16_vv_nxv1f32(<vscale x 1 x float> %a, <vscale x 1 x bfloat> %b, <vscale x 1 x bfloat> %c) {8; ZVFBFWMA-LABEL: vfwmaccbf16_vv_nxv1f32:9; ZVFBFWMA: # %bb.0:10; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, mf4, ta, ma11; ZVFBFWMA-NEXT: vfwmaccbf16.vv v8, v9, v1012; ZVFBFWMA-NEXT: ret13;14; ZVFBFMIN-LABEL: vfwmaccbf16_vv_nxv1f32:15; ZVFBFMIN: # %bb.0:16; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma17; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v11, v918; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v9, v1019; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma20; ZVFBFMIN-NEXT: vfmacc.vv v8, v11, v921; ZVFBFMIN-NEXT: ret22 %b.ext = fpext <vscale x 1 x bfloat> %b to <vscale x 1 x float>23 %c.ext = fpext <vscale x 1 x bfloat> %c to <vscale x 1 x float>24 %res = call <vscale x 1 x float> @llvm.fma.nxv1f32(<vscale x 1 x float> %b.ext, <vscale x 1 x float> %c.ext, <vscale x 1 x float> %a)25 ret <vscale x 1 x float> %res26}27 28define <vscale x 1 x float> @vfwmaccbf16_vf_nxv1f32(<vscale x 1 x float> %a, bfloat %b, <vscale x 1 x bfloat> %c) {29; ZVFBFWMA-LABEL: vfwmaccbf16_vf_nxv1f32:30; ZVFBFWMA: # %bb.0:31; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, mf4, ta, ma32; ZVFBFWMA-NEXT: vfwmaccbf16.vf v8, fa0, v933; ZVFBFWMA-NEXT: ret34;35; ZVFBFMIN-LABEL: vfwmaccbf16_vf_nxv1f32:36; ZVFBFMIN: # %bb.0:37; ZVFBFMIN-NEXT: fmv.x.w a0, fa038; ZVFBFMIN-NEXT: slli a0, a0, 1639; ZVFBFMIN-NEXT: fmv.w.x fa5, a040; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma41; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v10, v942; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma43; ZVFBFMIN-NEXT: vfmacc.vf v8, fa5, v1044; ZVFBFMIN-NEXT: ret45 %b.head = insertelement <vscale x 1 x bfloat> poison, bfloat %b, i32 046 %b.splat = shufflevector <vscale x 1 x bfloat> %b.head, <vscale x 1 x bfloat> poison, <vscale x 1 x i32> zeroinitializer47 %b.ext = fpext <vscale x 1 x bfloat> %b.splat to <vscale x 1 x float>48 %c.ext = fpext <vscale x 1 x bfloat> %c to <vscale x 1 x float>49 %res = call <vscale x 1 x float> @llvm.fma.nxv1f32(<vscale x 1 x float> %b.ext, <vscale x 1 x float> %c.ext, <vscale x 1 x float> %a)50 ret <vscale x 1 x float> %res51}52 53define <vscale x 2 x float> @vfwmaccbf16_vv_nxv2f32(<vscale x 2 x float> %a, <vscale x 2 x bfloat> %b, <vscale x 2 x bfloat> %c) {54; ZVFBFWMA-LABEL: vfwmaccbf16_vv_nxv2f32:55; ZVFBFWMA: # %bb.0:56; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, mf2, ta, ma57; ZVFBFWMA-NEXT: vfwmaccbf16.vv v8, v9, v1058; ZVFBFWMA-NEXT: ret59;60; ZVFBFMIN-LABEL: vfwmaccbf16_vv_nxv2f32:61; ZVFBFMIN: # %bb.0:62; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma63; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v11, v964; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v9, v1065; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma66; ZVFBFMIN-NEXT: vfmacc.vv v8, v11, v967; ZVFBFMIN-NEXT: ret68 %b.ext = fpext <vscale x 2 x bfloat> %b to <vscale x 2 x float>69 %c.ext = fpext <vscale x 2 x bfloat> %c to <vscale x 2 x float>70 %res = call <vscale x 2 x float> @llvm.fma.nxv2f32(<vscale x 2 x float> %b.ext, <vscale x 2 x float> %c.ext, <vscale x 2 x float> %a)71 ret <vscale x 2 x float> %res72}73 74define <vscale x 2 x float> @vfwmaccbf16_vf_nxv2f32(<vscale x 2 x float> %a, bfloat %b, <vscale x 2 x bfloat> %c) {75; ZVFBFWMA-LABEL: vfwmaccbf16_vf_nxv2f32:76; ZVFBFWMA: # %bb.0:77; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, mf2, ta, ma78; ZVFBFWMA-NEXT: vfwmaccbf16.vf v8, fa0, v979; ZVFBFWMA-NEXT: ret80;81; ZVFBFMIN-LABEL: vfwmaccbf16_vf_nxv2f32:82; ZVFBFMIN: # %bb.0:83; ZVFBFMIN-NEXT: fmv.x.w a0, fa084; ZVFBFMIN-NEXT: slli a0, a0, 1685; ZVFBFMIN-NEXT: fmv.w.x fa5, a086; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma87; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v10, v988; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma89; ZVFBFMIN-NEXT: vfmacc.vf v8, fa5, v1090; ZVFBFMIN-NEXT: ret91 %b.head = insertelement <vscale x 2 x bfloat> poison, bfloat %b, i32 092 %b.splat = shufflevector <vscale x 2 x bfloat> %b.head, <vscale x 2 x bfloat> poison, <vscale x 2 x i32> zeroinitializer93 %b.ext = fpext <vscale x 2 x bfloat> %b.splat to <vscale x 2 x float>94 %c.ext = fpext <vscale x 2 x bfloat> %c to <vscale x 2 x float>95 %res = call <vscale x 2 x float> @llvm.fma.nxv2f32(<vscale x 2 x float> %b.ext, <vscale x 2 x float> %c.ext, <vscale x 2 x float> %a)96 ret <vscale x 2 x float> %res97}98 99define <vscale x 4 x float> @vfwmaccbf16_vv_nxv4f32(<vscale x 4 x float> %a, <vscale x 4 x bfloat> %b, <vscale x 4 x bfloat> %c) {100; ZVFBFWMA-LABEL: vfwmaccbf16_vv_nxv4f32:101; ZVFBFWMA: # %bb.0:102; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m1, ta, ma103; ZVFBFWMA-NEXT: vfwmaccbf16.vv v8, v10, v11104; ZVFBFWMA-NEXT: ret105;106; ZVFBFMIN-LABEL: vfwmaccbf16_vv_nxv4f32:107; ZVFBFMIN: # %bb.0:108; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma109; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v12, v10110; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v14, v11111; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma112; ZVFBFMIN-NEXT: vfmacc.vv v8, v12, v14113; ZVFBFMIN-NEXT: ret114 %b.ext = fpext <vscale x 4 x bfloat> %b to <vscale x 4 x float>115 %c.ext = fpext <vscale x 4 x bfloat> %c to <vscale x 4 x float>116 %res = call <vscale x 4 x float> @llvm.fma.nxv4f32(<vscale x 4 x float> %b.ext, <vscale x 4 x float> %c.ext, <vscale x 4 x float> %a)117 ret <vscale x 4 x float> %res118}119 120define <vscale x 4 x float> @vfwmaccbf16_vf_nxv4f32(<vscale x 4 x float> %a, bfloat %b, <vscale x 4 x bfloat> %c) {121; ZVFBFWMA-LABEL: vfwmaccbf16_vf_nxv4f32:122; ZVFBFWMA: # %bb.0:123; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m1, ta, ma124; ZVFBFWMA-NEXT: vfwmaccbf16.vf v8, fa0, v10125; ZVFBFWMA-NEXT: ret126;127; ZVFBFMIN-LABEL: vfwmaccbf16_vf_nxv4f32:128; ZVFBFMIN: # %bb.0:129; ZVFBFMIN-NEXT: fmv.x.w a0, fa0130; ZVFBFMIN-NEXT: slli a0, a0, 16131; ZVFBFMIN-NEXT: fmv.w.x fa5, a0132; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma133; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v12, v10134; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma135; ZVFBFMIN-NEXT: vfmacc.vf v8, fa5, v12136; ZVFBFMIN-NEXT: ret137 %b.head = insertelement <vscale x 4 x bfloat> poison, bfloat %b, i32 0138 %b.splat = shufflevector <vscale x 4 x bfloat> %b.head, <vscale x 4 x bfloat> poison, <vscale x 4 x i32> zeroinitializer139 %b.ext = fpext <vscale x 4 x bfloat> %b.splat to <vscale x 4 x float>140 %c.ext = fpext <vscale x 4 x bfloat> %c to <vscale x 4 x float>141 %res = call <vscale x 4 x float> @llvm.fma.nxv4f32(<vscale x 4 x float> %b.ext, <vscale x 4 x float> %c.ext, <vscale x 4 x float> %a)142 ret <vscale x 4 x float> %res143}144 145define <vscale x 8 x float> @vfwmaccbf16_vv_nxv8f32(<vscale x 8 x float> %a, <vscale x 8 x bfloat> %b, <vscale x 8 x bfloat> %c) {146; ZVFBFWMA-LABEL: vfwmaccbf16_vv_nxv8f32:147; ZVFBFWMA: # %bb.0:148; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m2, ta, ma149; ZVFBFWMA-NEXT: vfwmaccbf16.vv v8, v12, v14150; ZVFBFWMA-NEXT: ret151;152; ZVFBFMIN-LABEL: vfwmaccbf16_vv_nxv8f32:153; ZVFBFMIN: # %bb.0:154; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma155; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v16, v12156; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v20, v14157; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma158; ZVFBFMIN-NEXT: vfmacc.vv v8, v16, v20159; ZVFBFMIN-NEXT: ret160 %b.ext = fpext <vscale x 8 x bfloat> %b to <vscale x 8 x float>161 %c.ext = fpext <vscale x 8 x bfloat> %c to <vscale x 8 x float>162 %res = call <vscale x 8 x float> @llvm.fma.nxv8f32(<vscale x 8 x float> %b.ext, <vscale x 8 x float> %c.ext, <vscale x 8 x float> %a)163 ret <vscale x 8 x float> %res164}165 166define <vscale x 8 x float> @vfwmaccbf16_vf_nxv8f32(<vscale x 8 x float> %a, bfloat %b, <vscale x 8 x bfloat> %c) {167; ZVFBFWMA-LABEL: vfwmaccbf16_vf_nxv8f32:168; ZVFBFWMA: # %bb.0:169; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m2, ta, ma170; ZVFBFWMA-NEXT: vfwmaccbf16.vf v8, fa0, v12171; ZVFBFWMA-NEXT: ret172;173; ZVFBFMIN-LABEL: vfwmaccbf16_vf_nxv8f32:174; ZVFBFMIN: # %bb.0:175; ZVFBFMIN-NEXT: fmv.x.w a0, fa0176; ZVFBFMIN-NEXT: slli a0, a0, 16177; ZVFBFMIN-NEXT: fmv.w.x fa5, a0178; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma179; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v16, v12180; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma181; ZVFBFMIN-NEXT: vfmacc.vf v8, fa5, v16182; ZVFBFMIN-NEXT: ret183 %b.head = insertelement <vscale x 8 x bfloat> poison, bfloat %b, i32 0184 %b.splat = shufflevector <vscale x 8 x bfloat> %b.head, <vscale x 8 x bfloat> poison, <vscale x 8 x i32> zeroinitializer185 %b.ext = fpext <vscale x 8 x bfloat> %b.splat to <vscale x 8 x float>186 %c.ext = fpext <vscale x 8 x bfloat> %c to <vscale x 8 x float>187 %res = call <vscale x 8 x float> @llvm.fma.nxv8f32(<vscale x 8 x float> %b.ext, <vscale x 8 x float> %c.ext, <vscale x 8 x float> %a)188 ret <vscale x 8 x float> %res189}190 191define <vscale x 16 x float> @vfwmaccbf16_vv_nxv16f32(<vscale x 16 x float> %a, <vscale x 16 x bfloat> %b, <vscale x 16 x bfloat> %c) {192; ZVFBFWMA-LABEL: vfwmaccbf16_vv_nxv16f32:193; ZVFBFWMA: # %bb.0:194; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m4, ta, ma195; ZVFBFWMA-NEXT: vfwmaccbf16.vv v8, v16, v20196; ZVFBFWMA-NEXT: ret197;198; ZVFBFMIN-LABEL: vfwmaccbf16_vv_nxv16f32:199; ZVFBFMIN: # %bb.0:200; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma201; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v24, v16202; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v0, v20203; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma204; ZVFBFMIN-NEXT: vfmacc.vv v8, v24, v0205; ZVFBFMIN-NEXT: ret206 %b.ext = fpext <vscale x 16 x bfloat> %b to <vscale x 16 x float>207 %c.ext = fpext <vscale x 16 x bfloat> %c to <vscale x 16 x float>208 %res = call <vscale x 16 x float> @llvm.fma.nxv16f32(<vscale x 16 x float> %b.ext, <vscale x 16 x float> %c.ext, <vscale x 16 x float> %a)209 ret <vscale x 16 x float> %res210}211 212define <vscale x 16 x float> @vfwmaccbf16_vf_nxv16f32(<vscale x 16 x float> %a, bfloat %b, <vscale x 16 x bfloat> %c) {213; ZVFBFWMA-LABEL: vfwmaccbf16_vf_nxv16f32:214; ZVFBFWMA: # %bb.0:215; ZVFBFWMA-NEXT: vsetvli a0, zero, e16, m4, ta, ma216; ZVFBFWMA-NEXT: vfwmaccbf16.vf v8, fa0, v16217; ZVFBFWMA-NEXT: ret218;219; ZVFBFMIN-LABEL: vfwmaccbf16_vf_nxv16f32:220; ZVFBFMIN: # %bb.0:221; ZVFBFMIN-NEXT: fmv.x.w a0, fa0222; ZVFBFMIN-NEXT: slli a0, a0, 16223; ZVFBFMIN-NEXT: fmv.w.x fa5, a0224; ZVFBFMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma225; ZVFBFMIN-NEXT: vfwcvtbf16.f.f.v v24, v16226; ZVFBFMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma227; ZVFBFMIN-NEXT: vfmacc.vf v8, fa5, v24228; ZVFBFMIN-NEXT: ret229 %b.head = insertelement <vscale x 16 x bfloat> poison, bfloat %b, i32 0230 %b.splat = shufflevector <vscale x 16 x bfloat> %b.head, <vscale x 16 x bfloat> poison, <vscale x 16 x i32> zeroinitializer231 %b.ext = fpext <vscale x 16 x bfloat> %b.splat to <vscale x 16 x float>232 %c.ext = fpext <vscale x 16 x bfloat> %c to <vscale x 16 x float>233 %res = call <vscale x 16 x float> @llvm.fma.nxv16f32(<vscale x 16 x float> %b.ext, <vscale x 16 x float> %c.ext, <vscale x 16 x float> %a)234 ret <vscale x 16 x float> %res235}236