1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v,+experimental-zvfbfmin -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+experimental-zvfbfmin -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v,+experimental-zvfbfmin -verify-machineinstrs < %s | FileCheck %s
5 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v,+experimental-zvfbfmin -verify-machineinstrs < %s | FileCheck %s
7 declare <2 x float> @llvm.vp.fpext.v2f32.v2f16(<2 x half>, <2 x i1>, i32)
9 define <2 x float> @vfpext_v2f16_v2f32(<2 x half> %a, <2 x i1> %m, i32 zeroext %vl) {
10 ; CHECK-LABEL: vfpext_v2f16_v2f32:
12 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
13 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8, v0.t
14 ; CHECK-NEXT: vmv1r.v v8, v9
16 %v = call <2 x float> @llvm.vp.fpext.v2f32.v2f16(<2 x half> %a, <2 x i1> %m, i32 %vl)
20 define <2 x float> @vfpext_v2f16_v2f32_unmasked(<2 x half> %a, i32 zeroext %vl) {
21 ; CHECK-LABEL: vfpext_v2f16_v2f32_unmasked:
23 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
24 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
25 ; CHECK-NEXT: vmv1r.v v8, v9
27 %v = call <2 x float> @llvm.vp.fpext.v2f32.v2f16(<2 x half> %a, <2 x i1> splat (i1 true), i32 %vl)
31 declare <2 x double> @llvm.vp.fpext.v2f64.v2f16(<2 x half>, <2 x i1>, i32)
33 define <2 x double> @vfpext_v2f16_v2f64(<2 x half> %a, <2 x i1> %m, i32 zeroext %vl) {
34 ; CHECK-LABEL: vfpext_v2f16_v2f64:
36 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
37 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8, v0.t
38 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
39 ; CHECK-NEXT: vfwcvt.f.f.v v8, v9, v0.t
41 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2f16(<2 x half> %a, <2 x i1> %m, i32 %vl)
45 define <2 x double> @vfpext_v2f16_v2f64_unmasked(<2 x half> %a, i32 zeroext %vl) {
46 ; CHECK-LABEL: vfpext_v2f16_v2f64_unmasked:
48 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
49 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
50 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
51 ; CHECK-NEXT: vfwcvt.f.f.v v8, v9
53 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2f16(<2 x half> %a, <2 x i1> splat (i1 true), i32 %vl)
57 declare <2 x double> @llvm.vp.fpext.v2f64.v2f32(<2 x float>, <2 x i1>, i32)
59 define <2 x double> @vfpext_v2f32_v2f64(<2 x float> %a, <2 x i1> %m, i32 zeroext %vl) {
60 ; CHECK-LABEL: vfpext_v2f32_v2f64:
62 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
63 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8, v0.t
64 ; CHECK-NEXT: vmv1r.v v8, v9
66 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2f32(<2 x float> %a, <2 x i1> %m, i32 %vl)
70 define <2 x double> @vfpext_v2f32_v2f64_unmasked(<2 x float> %a, i32 zeroext %vl) {
71 ; CHECK-LABEL: vfpext_v2f32_v2f64_unmasked:
73 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
74 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
75 ; CHECK-NEXT: vmv1r.v v8, v9
77 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2f32(<2 x float> %a, <2 x i1> splat (i1 true), i32 %vl)
81 declare <15 x double> @llvm.vp.fpext.v15f64.v15f32(<15 x float>, <15 x i1>, i32)
83 define <15 x double> @vfpext_v15f32_v15f64(<15 x float> %a, <15 x i1> %m, i32 zeroext %vl) {
84 ; CHECK-LABEL: vfpext_v15f32_v15f64:
86 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
87 ; CHECK-NEXT: vfwcvt.f.f.v v16, v8, v0.t
88 ; CHECK-NEXT: vmv8r.v v8, v16
90 %v = call <15 x double> @llvm.vp.fpext.v15f64.v15f32(<15 x float> %a, <15 x i1> %m, i32 %vl)
94 declare <32 x double> @llvm.vp.fpext.v32f64.v32f32(<32 x float>, <32 x i1>, i32)
96 define <32 x double> @vfpext_v32f32_v32f64(<32 x float> %a, <32 x i1> %m, i32 zeroext %vl) {
97 ; CHECK-LABEL: vfpext_v32f32_v32f64:
99 ; CHECK-NEXT: li a2, 16
100 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
101 ; CHECK-NEXT: vslidedown.vi v16, v0, 2
102 ; CHECK-NEXT: mv a1, a0
103 ; CHECK-NEXT: bltu a0, a2, .LBB7_2
104 ; CHECK-NEXT: # %bb.1:
105 ; CHECK-NEXT: li a1, 16
106 ; CHECK-NEXT: .LBB7_2:
107 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
108 ; CHECK-NEXT: vfwcvt.f.f.v v24, v8, v0.t
109 ; CHECK-NEXT: addi a1, a0, -16
110 ; CHECK-NEXT: sltu a0, a0, a1
111 ; CHECK-NEXT: addi a0, a0, -1
112 ; CHECK-NEXT: and a0, a0, a1
113 ; CHECK-NEXT: vsetivli zero, 16, e32, m8, ta, ma
114 ; CHECK-NEXT: vslidedown.vi v8, v8, 16
115 ; CHECK-NEXT: vmv1r.v v0, v16
116 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
117 ; CHECK-NEXT: vfwcvt.f.f.v v16, v8, v0.t
118 ; CHECK-NEXT: vmv8r.v v8, v24
120 %v = call <32 x double> @llvm.vp.fpext.v32f64.v32f32(<32 x float> %a, <32 x i1> %m, i32 %vl)
124 declare <2 x float> @llvm.vp.fpext.v2f32.v2bf16(<2 x bfloat>, <2 x i1>, i32)
126 define <2 x float> @vfpext_v2bf16_v2f32(<2 x bfloat> %a, <2 x i1> %m, i32 zeroext %vl) {
127 ; CHECK-LABEL: vfpext_v2bf16_v2f32:
129 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
130 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8, v0.t
131 ; CHECK-NEXT: vmv1r.v v8, v9
133 %v = call <2 x float> @llvm.vp.fpext.v2f32.v2bf16(<2 x bfloat> %a, <2 x i1> %m, i32 %vl)
137 define <2 x float> @vfpext_v2bf16_v2f32_unmasked(<2 x bfloat> %a, i32 zeroext %vl) {
138 ; CHECK-LABEL: vfpext_v2bf16_v2f32_unmasked:
140 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
141 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
142 ; CHECK-NEXT: vmv1r.v v8, v9
144 %v = call <2 x float> @llvm.vp.fpext.v2f32.v2bf16(<2 x bfloat> %a, <2 x i1> shufflevector (<2 x i1> insertelement (<2 x i1> undef, i1 true, i32 0), <2 x i1> undef, <2 x i32> zeroinitializer), i32 %vl)
148 declare <2 x double> @llvm.vp.fpext.v2f64.v2bf16(<2 x bfloat>, <2 x i1>, i32)
150 define <2 x double> @vfpext_v2bf16_v2f64(<2 x bfloat> %a, <2 x i1> %m, i32 zeroext %vl) {
151 ; CHECK-LABEL: vfpext_v2bf16_v2f64:
153 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
154 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8, v0.t
155 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
156 ; CHECK-NEXT: vfwcvt.f.f.v v8, v9, v0.t
158 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2bf16(<2 x bfloat> %a, <2 x i1> %m, i32 %vl)
162 define <2 x double> @vfpext_v2bf16_v2f64_unmasked(<2 x bfloat> %a, i32 zeroext %vl) {
163 ; CHECK-LABEL: vfpext_v2bf16_v2f64_unmasked:
165 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
166 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
167 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
168 ; CHECK-NEXT: vfwcvt.f.f.v v8, v9
170 %v = call <2 x double> @llvm.vp.fpext.v2f64.v2bf16(<2 x bfloat> %a, <2 x i1> shufflevector (<2 x i1> insertelement (<2 x i1> undef, i1 true, i32 0), <2 x i1> undef, <2 x i32> zeroinitializer), i32 %vl)