1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+v,+m,+zfbfmin,+zvfbfmin -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+v,+m,+zfbfmin,+zvfbfmin -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+v,+zvfh,+m,+zfbfmin,+zvfbfmin -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+v,+m,+zvfh,+zfbfmin,+zvfbfmin -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s
11 declare <2 x bfloat> @llvm.vp.merge.v2bf16(<2 x i1>, <2 x bfloat>, <2 x bfloat>, i32)
13 define <2 x bfloat> @vpmerge_vv_v2bf16(<2 x bfloat> %va, <2 x bfloat> %vb, <2 x i1> %m, i32 zeroext %evl) {
14 ; CHECK-LABEL: vpmerge_vv_v2bf16:
16 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, tu, ma
17 ; CHECK-NEXT: vmerge.vvm v9, v9, v8, v0
18 ; CHECK-NEXT: vmv1r.v v8, v9
20 %v = call <2 x bfloat> @llvm.vp.merge.v2bf16(<2 x i1> %m, <2 x bfloat> %va, <2 x bfloat> %vb, i32 %evl)
24 define <2 x bfloat> @vpmerge_vf_v2bf16(bfloat %a, <2 x bfloat> %vb, <2 x i1> %m, i32 zeroext %evl) {
25 ; CHECK-LABEL: vpmerge_vf_v2bf16:
27 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
28 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
29 ; CHECK-NEXT: vfmv.v.f v9, fa5
30 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, tu, mu
31 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v9, v0.t
33 %elt.head = insertelement <2 x bfloat> poison, bfloat %a, i32 0
34 %va = shufflevector <2 x bfloat> %elt.head, <2 x bfloat> poison, <2 x i32> zeroinitializer
35 %v = call <2 x bfloat> @llvm.vp.merge.v2bf16(<2 x i1> %m, <2 x bfloat> %va, <2 x bfloat> %vb, i32 %evl)
39 declare <4 x bfloat> @llvm.vp.merge.v4bf16(<4 x i1>, <4 x bfloat>, <4 x bfloat>, i32)
41 define <4 x bfloat> @vpmerge_vv_v4bf16(<4 x bfloat> %va, <4 x bfloat> %vb, <4 x i1> %m, i32 zeroext %evl) {
42 ; CHECK-LABEL: vpmerge_vv_v4bf16:
44 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, tu, ma
45 ; CHECK-NEXT: vmerge.vvm v9, v9, v8, v0
46 ; CHECK-NEXT: vmv1r.v v8, v9
48 %v = call <4 x bfloat> @llvm.vp.merge.v4bf16(<4 x i1> %m, <4 x bfloat> %va, <4 x bfloat> %vb, i32 %evl)
52 define <4 x bfloat> @vpmerge_vf_v4bf16(bfloat %a, <4 x bfloat> %vb, <4 x i1> %m, i32 zeroext %evl) {
53 ; CHECK-LABEL: vpmerge_vf_v4bf16:
55 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
56 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
57 ; CHECK-NEXT: vfmv.v.f v9, fa5
58 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, tu, mu
59 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v9, v0.t
61 %elt.head = insertelement <4 x bfloat> poison, bfloat %a, i32 0
62 %va = shufflevector <4 x bfloat> %elt.head, <4 x bfloat> poison, <4 x i32> zeroinitializer
63 %v = call <4 x bfloat> @llvm.vp.merge.v4bf16(<4 x i1> %m, <4 x bfloat> %va, <4 x bfloat> %vb, i32 %evl)
67 declare <8 x bfloat> @llvm.vp.merge.v8bf16(<8 x i1>, <8 x bfloat>, <8 x bfloat>, i32)
69 define <8 x bfloat> @vpmerge_vv_v8bf16(<8 x bfloat> %va, <8 x bfloat> %vb, <8 x i1> %m, i32 zeroext %evl) {
70 ; CHECK-LABEL: vpmerge_vv_v8bf16:
72 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, ma
73 ; CHECK-NEXT: vmerge.vvm v9, v9, v8, v0
74 ; CHECK-NEXT: vmv1r.v v8, v9
76 %v = call <8 x bfloat> @llvm.vp.merge.v8bf16(<8 x i1> %m, <8 x bfloat> %va, <8 x bfloat> %vb, i32 %evl)
80 define <8 x bfloat> @vpmerge_vf_v8bf16(bfloat %a, <8 x bfloat> %vb, <8 x i1> %m, i32 zeroext %evl) {
81 ; CHECK-LABEL: vpmerge_vf_v8bf16:
83 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
84 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
85 ; CHECK-NEXT: vfmv.v.f v10, fa5
86 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, mu
87 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v10, v0.t
89 %elt.head = insertelement <8 x bfloat> poison, bfloat %a, i32 0
90 %va = shufflevector <8 x bfloat> %elt.head, <8 x bfloat> poison, <8 x i32> zeroinitializer
91 %v = call <8 x bfloat> @llvm.vp.merge.v8bf16(<8 x i1> %m, <8 x bfloat> %va, <8 x bfloat> %vb, i32 %evl)
95 declare <16 x bfloat> @llvm.vp.merge.v16bf16(<16 x i1>, <16 x bfloat>, <16 x bfloat>, i32)
97 define <16 x bfloat> @vpmerge_vv_v16bf16(<16 x bfloat> %va, <16 x bfloat> %vb, <16 x i1> %m, i32 zeroext %evl) {
98 ; CHECK-LABEL: vpmerge_vv_v16bf16:
100 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, tu, ma
101 ; CHECK-NEXT: vmerge.vvm v10, v10, v8, v0
102 ; CHECK-NEXT: vmv2r.v v8, v10
104 %v = call <16 x bfloat> @llvm.vp.merge.v16bf16(<16 x i1> %m, <16 x bfloat> %va, <16 x bfloat> %vb, i32 %evl)
108 define <16 x bfloat> @vpmerge_vf_v16bf16(bfloat %a, <16 x bfloat> %vb, <16 x i1> %m, i32 zeroext %evl) {
109 ; CHECK-LABEL: vpmerge_vf_v16bf16:
111 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
112 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
113 ; CHECK-NEXT: vfmv.v.f v12, fa5
114 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, tu, mu
115 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v12, v0.t
117 %elt.head = insertelement <16 x bfloat> poison, bfloat %a, i32 0
118 %va = shufflevector <16 x bfloat> %elt.head, <16 x bfloat> poison, <16 x i32> zeroinitializer
119 %v = call <16 x bfloat> @llvm.vp.merge.v16bf16(<16 x i1> %m, <16 x bfloat> %va, <16 x bfloat> %vb, i32 %evl)