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 %head = insertelement <2 x i1> poison, i1 true, i32 0
30 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
31 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f16(<2 x half> %x, i32 3, <2 x i1> %m, i32 %evl) ; nan
35 define <2 x i1> @isnan_v2f32(<2 x float> %x, <2 x i1> %m, i32 zeroext %evl) {
36 ; CHECK-LABEL: isnan_v2f32:
38 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
39 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
40 ; CHECK-NEXT: li a0, 927
41 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
42 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
44 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float> %x, i32 639, <2 x i1> %m, i32 %evl)
48 define <2 x i1> @isnan_v2f32_unmasked(<2 x float> %x, i32 zeroext %evl) {
49 ; CHECK-LABEL: isnan_v2f32_unmasked:
51 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
52 ; CHECK-NEXT: vfclass.v v8, v8
53 ; CHECK-NEXT: li a0, 927
54 ; CHECK-NEXT: vand.vx v8, v8, a0
55 ; CHECK-NEXT: vmsne.vi v0, v8, 0
57 %head = insertelement <2 x i1> poison, i1 true, i32 0
58 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
59 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float> %x, i32 639, <2 x i1> %m, i32 %evl)
63 define <4 x i1> @isnan_v4f32(<4 x float> %x, <4 x i1> %m, i32 zeroext %evl) {
64 ; CHECK-LABEL: isnan_v4f32:
66 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
67 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
68 ; CHECK-NEXT: li a0, 768
69 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
70 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
72 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float> %x, i32 3, <4 x i1> %m, i32 %evl) ; nan
76 define <4 x i1> @isnan_v4f32_unmasked(<4 x float> %x, i32 zeroext %evl) {
77 ; CHECK-LABEL: isnan_v4f32_unmasked:
79 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
80 ; CHECK-NEXT: vfclass.v v8, v8
81 ; CHECK-NEXT: li a0, 768
82 ; CHECK-NEXT: vand.vx v8, v8, a0
83 ; CHECK-NEXT: vmsne.vi v0, v8, 0
85 %head = insertelement <4 x i1> poison, i1 true, i32 0
86 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
87 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float> %x, i32 3, <4 x i1> %m, i32 %evl) ; nan
91 define <8 x i1> @isnan_v8f32(<8 x float> %x, <8 x i1> %m, i32 zeroext %evl) {
92 ; CHECK-LABEL: isnan_v8f32:
94 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
95 ; CHECK-NEXT: vfclass.v v10, v8, v0.t
96 ; CHECK-NEXT: li a0, 512
97 ; CHECK-NEXT: vmseq.vx v8, v10, a0, v0.t
98 ; CHECK-NEXT: vmv1r.v v0, v8
100 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float> %x, i32 2, <8 x i1> %m, i32 %evl)
104 define <8 x i1> @isnan_v8f32_unmasked(<8 x float> %x, i32 zeroext %evl) {
105 ; CHECK-LABEL: isnan_v8f32_unmasked:
107 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
108 ; CHECK-NEXT: vfclass.v v8, v8
109 ; CHECK-NEXT: li a0, 512
110 ; CHECK-NEXT: vmseq.vx v0, v8, a0
112 %head = insertelement <8 x i1> poison, i1 true, i32 0
113 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
114 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float> %x, i32 2, <8 x i1> %m, i32 %evl)
118 define <16 x i1> @isnan_v16f32(<16 x float> %x, <16 x i1> %m, i32 zeroext %evl) {
119 ; CHECK-LABEL: isnan_v16f32:
121 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
122 ; CHECK-NEXT: vfclass.v v12, v8, v0.t
123 ; CHECK-NEXT: li a0, 256
124 ; CHECK-NEXT: vmseq.vx v8, v12, a0, v0.t
125 ; CHECK-NEXT: vmv1r.v v0, v8
127 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float> %x, i32 1, <16 x i1> %m, i32 %evl)
131 define <16 x i1> @isnan_v16f32_unmasked(<16 x float> %x, i32 zeroext %evl) {
132 ; CHECK-LABEL: isnan_v16f32_unmasked:
134 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
135 ; CHECK-NEXT: vfclass.v v8, v8
136 ; CHECK-NEXT: li a0, 256
137 ; CHECK-NEXT: vmseq.vx v0, v8, a0
139 %head = insertelement <16 x i1> poison, i1 true, i32 0
140 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
141 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float> %x, i32 1, <16 x i1> %m, i32 %evl)
145 define <2 x i1> @isnormal_v2f64(<2 x double> %x, <2 x i1> %m, i32 zeroext %evl) {
146 ; CHECK-LABEL: isnormal_v2f64:
148 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
149 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
150 ; CHECK-NEXT: li a0, 129
151 ; CHECK-NEXT: vand.vx v8, v8, a0, v0.t
152 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
154 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double> %x, i32 516, <2 x i1> %m, i32 %evl) ; 0x204 = "inf"
158 define <2 x i1> @isnormal_v2f64_unmasked(<2 x double> %x, i32 zeroext %evl) {
159 ; CHECK-LABEL: isnormal_v2f64_unmasked:
161 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
162 ; CHECK-NEXT: vfclass.v v8, v8
163 ; CHECK-NEXT: li a0, 129
164 ; CHECK-NEXT: vand.vx v8, v8, a0
165 ; CHECK-NEXT: vmsne.vi v0, v8, 0
167 %head = insertelement <2 x i1> poison, i1 true, i32 0
168 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
169 %1 = call <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double> %x, i32 516, <2 x i1> %m, i32 %evl) ; 0x204 = "inf"
173 define <4 x i1> @isposinf_v4f64(<4 x double> %x, <4 x i1> %m, i32 zeroext %evl) {
174 ; CHECK-LABEL: isposinf_v4f64:
176 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
177 ; CHECK-NEXT: vfclass.v v10, v8, v0.t
178 ; CHECK-NEXT: li a0, 128
179 ; CHECK-NEXT: vmseq.vx v8, v10, a0, v0.t
180 ; CHECK-NEXT: vmv1r.v v0, v8
182 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double> %x, i32 512, <4 x i1> %m, i32 %evl) ; 0x200 = "+inf"
186 define <4 x i1> @isposinf_v4f64_unmasked(<4 x double> %x, i32 zeroext %evl) {
187 ; CHECK-LABEL: isposinf_v4f64_unmasked:
189 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
190 ; CHECK-NEXT: vfclass.v v8, v8
191 ; CHECK-NEXT: li a0, 128
192 ; CHECK-NEXT: vmseq.vx v0, v8, a0
194 %head = insertelement <4 x i1> poison, i1 true, i32 0
195 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
196 %1 = call <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double> %x, i32 512, <4 x i1> %m, i32 %evl) ; 0x200 = "+inf"
200 define <8 x i1> @isneginf_v8f64(<8 x double> %x, <8 x i1> %m, i32 zeroext %evl) {
201 ; CHECK-LABEL: isneginf_v8f64:
203 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
204 ; CHECK-NEXT: vfclass.v v12, v8, v0.t
205 ; CHECK-NEXT: vmseq.vi v8, v12, 1, v0.t
206 ; CHECK-NEXT: vmv1r.v v0, v8
208 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double> %x, i32 4, <8 x i1> %m, i32 %evl) ; "-inf"
212 define <8 x i1> @isneginf_v8f64_unmasked(<8 x double> %x, i32 zeroext %evl) {
213 ; CHECK-LABEL: isneginf_v8f64_unmasked:
215 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
216 ; CHECK-NEXT: vfclass.v v8, v8
217 ; CHECK-NEXT: vmseq.vi v0, v8, 1
219 %head = insertelement <8 x i1> poison, i1 true, i32 0
220 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
221 %1 = call <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double> %x, i32 4, <8 x i1> %m, i32 %evl) ; "-inf"
225 define <16 x i1> @isfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
226 ; CHECK-LABEL: isfinite_v16f64:
228 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
229 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
230 ; CHECK-NEXT: li a0, 126
231 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
232 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
233 ; CHECK-NEXT: vmv1r.v v0, v8
235 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 504, <16 x i1> %m, i32 %evl) ; 0x1f8 = "finite"
239 define <16 x i1> @isfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
240 ; CHECK-LABEL: isfinite_v16f64_unmasked:
242 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
243 ; CHECK-NEXT: vfclass.v v8, v8
244 ; CHECK-NEXT: li a0, 126
245 ; CHECK-NEXT: vand.vx v8, v8, a0
246 ; CHECK-NEXT: vmsne.vi v0, v8, 0
248 %head = insertelement <16 x i1> poison, i1 true, i32 0
249 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
250 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 504, <16 x i1> %m, i32 %evl) ; 0x1f8 = "finite"
254 define <16 x i1> @isposfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
255 ; CHECK-LABEL: isposfinite_v16f64:
257 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
258 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
259 ; CHECK-NEXT: li a0, 112
260 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
261 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
262 ; CHECK-NEXT: vmv1r.v v0, v8
264 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 448, <16 x i1> %m, i32 %evl) ; 0x1c0 = "+finite"
268 define <16 x i1> @isnegfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
269 ; CHECK-LABEL: isnegfinite_v16f64_unmasked:
271 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
272 ; CHECK-NEXT: vfclass.v v8, v8
273 ; CHECK-NEXT: vand.vi v8, v8, 14
274 ; CHECK-NEXT: vmsne.vi v0, v8, 0
276 %head = insertelement <16 x i1> poison, i1 true, i32 0
277 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
278 %1 = call <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double> %x, i32 56, <16 x i1> %m, i32 %evl) ; 0x38 = "-finite"
282 define <16 x i1> @isnotfinite_v16f64(<16 x double> %x, <16 x i1> %m, i32 zeroext %evl) {
283 ; CHECK-LABEL: isnotfinite_v16f64:
285 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
286 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
287 ; CHECK-NEXT: li a0, 897
288 ; CHECK-NEXT: vand.vx v16, v8, a0, v0.t
289 ; CHECK-NEXT: vmsne.vi v8, v16, 0, v0.t
290 ; CHECK-NEXT: vmv1r.v v0, v8
292 %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"
296 define <16 x i1> @isnotfinite_v16f64_unmasked(<16 x double> %x, i32 zeroext %evl) {
297 ; CHECK-LABEL: isnotfinite_v16f64_unmasked:
299 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
300 ; CHECK-NEXT: vfclass.v v8, v8
301 ; CHECK-NEXT: li a0, 897
302 ; CHECK-NEXT: vand.vx v8, v8, a0
303 ; CHECK-NEXT: vmsne.vi v0, v8, 0
305 %head = insertelement <16 x i1> poison, i1 true, i32 0
306 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
307 %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"
311 declare <2 x i1> @llvm.vp.is.fpclass.v2f16(<2 x half>, i32, <2 x i1>, i32)
312 declare <2 x i1> @llvm.vp.is.fpclass.v2f32(<2 x float>, i32, <2 x i1>, i32)
313 declare <4 x i1> @llvm.vp.is.fpclass.v4f32(<4 x float>, i32, <4 x i1>, i32)
314 declare <8 x i1> @llvm.vp.is.fpclass.v8f32(<8 x float>, i32, <8 x i1>, i32)
315 declare <16 x i1> @llvm.vp.is.fpclass.v16f32(<16 x float>, i32, <16 x i1>, i32)
316 declare <2 x i1> @llvm.vp.is.fpclass.v2f64(<2 x double>, i32, <2 x i1>, i32)
317 declare <4 x i1> @llvm.vp.is.fpclass.v4f64(<4 x double>, i32, <4 x i1>, i32)
318 declare <8 x i1> @llvm.vp.is.fpclass.v8f64(<8 x double>, i32, <8 x i1>, i32)
319 declare <16 x i1> @llvm.vp.is.fpclass.v16f64(<16 x double>, i32, <16 x i1>, i32)