1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 define <2 x i1> @isnan_v2f16(<2 x half> %x, <2 x i1> %m, i32 zeroext %evl) {
8 ; CHECK-LABEL: isnan_v2f16:
10 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
11 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
12 ; CHECK-NEXT: li a0, 768
13 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
14 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
16 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f16(<2 x half> %x, i32 3, <2 x i1> %m, i32 %evl) ; nan
20 define <2 x i1> @isnan_v2f16_unmasked(<2 x half> %x, i32 zeroext %evl) {
21 ; CHECK-LABEL: isnan_v2f16_unmasked:
23 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
24 ; CHECK-NEXT: vfclass.v v8, v8
25 ; CHECK-NEXT: li a0, 768
26 ; CHECK-NEXT: vand.vx v8, v8, a0
27 ; CHECK-NEXT: vmsne.vi v0, v8, 0
29 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f16(<2 x half> %x, i32 3, <2 x i1> splat (i1 true), i32 %evl) ; nan
33 define <2 x i1> @isnan_v2f32(<2 x float> %x, <2 x i1> %m, i32 zeroext %evl) {
34 ; CHECK-LABEL: isnan_v2f32:
36 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
37 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
38 ; CHECK-NEXT: li a0, 927
39 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
40 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
42 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float> %x, i32 639, <2 x i1> %m, i32 %evl)
46 define <2 x i1> @isnan_v2f32_unmasked(<2 x float> %x, i32 zeroext %evl) {
47 ; CHECK-LABEL: isnan_v2f32_unmasked:
49 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
50 ; CHECK-NEXT: vfclass.v v8, v8
51 ; CHECK-NEXT: li a0, 927
52 ; CHECK-NEXT: vand.vx v8, v8, a0
53 ; CHECK-NEXT: vmsne.vi v0, v8, 0
55 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float> %x, i32 639, <2 x i1> splat (i1 true), i32 %evl)
59 define <4 x i1> @isnan_v4f32(<4 x float> %x, <4 x i1> %m, i32 zeroext %evl) {
60 ; CHECK-LABEL: isnan_v4f32:
62 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
63 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
64 ; CHECK-NEXT: li a0, 768
65 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
66 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
68 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float> %x, i32 3, <4 x i1> %m, i32 %evl) ; nan
72 define <4 x i1> @isnan_v4f32_unmasked(<4 x float> %x, i32 zeroext %evl) {
73 ; CHECK-LABEL: isnan_v4f32_unmasked:
75 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
76 ; CHECK-NEXT: vfclass.v v8, v8
77 ; CHECK-NEXT: li a0, 768
78 ; CHECK-NEXT: vand.vx v8, v8, a0
79 ; CHECK-NEXT: vmsne.vi v0, v8, 0
81 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float> %x, i32 3, <4 x i1> splat (i1 true), i32 %evl) ; nan
85 define <8 x i1> @isnan_v8f32(<8 x float> %x, <8 x i1> %m, i32 zeroext %evl) {
86 ; CHECK-LABEL: isnan_v8f32:
88 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
89 ; CHECK-NEXT: vfclass.v v10, v8, v0.t
90 ; CHECK-NEXT: li a0, 512
91 ; CHECK-NEXT: vmseq.vx v8, v10, a0, v0.t
92 ; CHECK-NEXT: vmv1r.v v0, v8
94 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float> %x, i32 2, <8 x i1> %m, i32 %evl)
98 define <8 x i1> @isnan_v8f32_unmasked(<8 x float> %x, i32 zeroext %evl) {
99 ; CHECK-LABEL: isnan_v8f32_unmasked:
101 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
102 ; CHECK-NEXT: vfclass.v v8, v8
103 ; CHECK-NEXT: li a0, 512
104 ; CHECK-NEXT: vmseq.vx v0, v8, a0
106 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float> %x, i32 2, <8 x i1> splat (i1 true), i32 %evl)
110 define <16 x i1> @isnan_v16f32(<16 x float> %x, <16 x i1> %m, i32 zeroext %evl) {
111 ; CHECK-LABEL: isnan_v16f32:
113 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
114 ; CHECK-NEXT: vfclass.v v12, v8, v0.t
115 ; CHECK-NEXT: li a0, 256
116 ; CHECK-NEXT: vmseq.vx v8, v12, a0, v0.t
117 ; CHECK-NEXT: vmv1r.v v0, v8
119 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float> %x, i32 1, <16 x i1> %m, i32 %evl)
123 define <16 x i1> @isnan_v16f32_unmasked(<16 x float> %x, i32 zeroext %evl) {
124 ; CHECK-LABEL: isnan_v16f32_unmasked:
126 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
127 ; CHECK-NEXT: vfclass.v v8, v8
128 ; CHECK-NEXT: li a0, 256
129 ; CHECK-NEXT: vmseq.vx v0, v8, a0
131 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float> %x, i32 1, <16 x i1> splat (i1 true), i32 %evl)
135 define <2 x i1> @isnormal_v2f64(<2 x double> %x, <2 x i1> %m, i32 zeroext %evl) {
136 ; CHECK-LABEL: isnormal_v2f64:
138 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
139 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
140 ; CHECK-NEXT: li a0, 129
141 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
142 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
144 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double> %x, i32 516, <2 x i1> %m, i32 %evl) ; 0x204 = "inf"
148 define <2 x i1> @isnormal_v2f64_unmasked(<2 x double> %x, i32 zeroext %evl) {
149 ; CHECK-LABEL: isnormal_v2f64_unmasked:
151 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
152 ; CHECK-NEXT: vfclass.v v8, v8
153 ; CHECK-NEXT: li a0, 129
154 ; CHECK-NEXT: vand.vx v8, v8, a0
155 ; CHECK-NEXT: vmsne.vi v0, v8, 0
157 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double> %x, i32 516, <2 x i1> splat (i1 true), i32 %evl) ; 0x204 = "inf"
161 define <4 x i1> @isposinf_v4f64(<4 x double> %x, <4 x i1> %m, i32 zeroext %evl) {
162 ; CHECK-LABEL: isposinf_v4f64:
164 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
165 ; CHECK-NEXT: vfclass.v v10, v8, v0.t
166 ; CHECK-NEXT: li a0, 128
167 ; CHECK-NEXT: vmseq.vx v8, v10, a0, v0.t
168 ; CHECK-NEXT: vmv1r.v v0, v8
170 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double> %x, i32 512, <4 x i1> %m, i32 %evl) ; 0x200 = "+inf"
174 define <4 x i1> @isposinf_v4f64_unmasked(<4 x double> %x, i32 zeroext %evl) {
175 ; CHECK-LABEL: isposinf_v4f64_unmasked:
177 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
178 ; CHECK-NEXT: vfclass.v v8, v8
179 ; CHECK-NEXT: li a0, 128
180 ; CHECK-NEXT: vmseq.vx v0, v8, a0
182 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double> %x, i32 512, <4 x i1> splat (i1 true), i32 %evl) ; 0x200 = "+inf"
186 define <8 x i1> @isneginf_v8f64(<8 x double> %x, <8 x i1> %m, i32 zeroext %evl) {
187 ; CHECK-LABEL: isneginf_v8f64:
189 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
190 ; CHECK-NEXT: vfclass.v v12, v8, v0.t
191 ; CHECK-NEXT: vmseq.vi v8, v12, 1, v0.t
192 ; CHECK-NEXT: vmv1r.v v0, v8
194 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double> %x, i32 4, <8 x i1> %m, i32 %evl) ; "-inf"
198 define <8 x i1> @isneginf_v8f64_unmasked(<8 x double> %x, i32 zeroext %evl) {
199 ; CHECK-LABEL: isneginf_v8f64_unmasked:
201 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
202 ; CHECK-NEXT: vfclass.v v8, v8
203 ; CHECK-NEXT: vmseq.vi v0, v8, 1
205 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double> %x, i32 4, <8 x i1> splat (i1 true), i32 %evl) ; "-inf"
209 define <16 x i1> @isfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
210 ; CHECK-LABEL: isfinite_v16f64:
212 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
213 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
214 ; CHECK-NEXT: li a0, 126
215 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
216 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
217 ; CHECK-NEXT: vmv1r.v v0, v8
219 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 504, <16 x i1> %m, i32 %evl) ; 0x1f8 = "finite"
223 define <16 x i1> @isfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
224 ; CHECK-LABEL: isfinite_v16f64_unmasked:
226 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
227 ; CHECK-NEXT: vfclass.v v8, v8
228 ; CHECK-NEXT: li a0, 126
229 ; CHECK-NEXT: vand.vx v8, v8, a0
230 ; CHECK-NEXT: vmsne.vi v0, v8, 0
232 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 504, <16 x i1> splat (i1 true), i32 %evl) ; 0x1f8 = "finite"
236 define <16 x i1> @isposfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
237 ; CHECK-LABEL: isposfinite_v16f64:
239 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
240 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
241 ; CHECK-NEXT: li a0, 112
242 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
243 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
244 ; CHECK-NEXT: vmv1r.v v0, v8
246 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 448, <16 x i1> %m, i32 %evl) ; 0x1c0 = "+finite"
250 define <16 x i1> @isnegfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
251 ; CHECK-LABEL: isnegfinite_v16f64_unmasked:
253 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
254 ; CHECK-NEXT: vfclass.v v8, v8
255 ; CHECK-NEXT: vand.vi v8, v8, 14
256 ; CHECK-NEXT: vmsne.vi v0, v8, 0
258 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 56, <16 x i1> splat (i1 true), i32 %evl) ; 0x38 = "-finite"
262 define <16 x i1> @isnotfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
263 ; CHECK-LABEL: isnotfinite_v16f64:
265 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
266 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
267 ; CHECK-NEXT: li a0, 897
268 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
269 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
270 ; CHECK-NEXT: vmv1r.v v0, v8
272 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 519, <16 x i1> %m, i32 %evl) ; 0x207 = "inf|nan"
276 define <16 x i1> @isnotfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
277 ; CHECK-LABEL: isnotfinite_v16f64_unmasked:
279 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
280 ; CHECK-NEXT: vfclass.v v8, v8
281 ; CHECK-NEXT: li a0, 897
282 ; CHECK-NEXT: vand.vx v8, v8, a0
283 ; CHECK-NEXT: vmsne.vi v0, v8, 0
285 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 519, <16 x i1> splat (i1 true), i32 %evl) ; 0x207 = "inf|nan"
289 declare <2 x i1> @llvm.vp.is.fpclass.v2f16(<2 x half>, i32, <2 x i1>, i32)
290 declare <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float>, i32, <2 x i1>, i32)
291 declare <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float>, i32, <4 x i1>, i32)
292 declare <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float>, i32, <8 x i1>, i32)
293 declare <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float>, i32, <16 x i1>, i32)
294 declare <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double>, i32, <2 x i1>, i32)
295 declare <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double>, i32, <4 x i1>, i32)
296 declare <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double>, i32, <8 x i1>, i32)
297 declare <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double>, i32, <16 x i1>, i32)