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 <vscale x 2 x i1> @isnan_nxv2f16(<vscale x 2 x half> %x, <vscale x 2 x i1> %m, i32 zeroext %evl) {
8 ; CHECK-LABEL: isnan_nxv2f16:
10 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
11 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
12 ; CHECK-NEXT: li a0, 768
13 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
14 ; CHECK-NEXT: vand.vx v8, v8, a0
15 ; CHECK-NEXT: vmsne.vi v0, v8, 0
17 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f16(<vscale x 2 x half> %x, i32 3, <vscale x 2 x i1> %m, i32 %evl) ; nan
18 ret <vscale x 2 x i1> %1
21 define <vscale x 2 x i1> @isnan_nxv2f16_unmasked(<vscale x 2 x half> %x, i32 zeroext %evl) {
22 ; CHECK-LABEL: isnan_nxv2f16_unmasked:
24 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
25 ; CHECK-NEXT: vfclass.v v8, v8
26 ; CHECK-NEXT: li a0, 768
27 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
28 ; CHECK-NEXT: vand.vx v8, v8, a0
29 ; CHECK-NEXT: vmsne.vi v0, v8, 0
31 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
32 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
33 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f16(<vscale x 2 x half> %x, i32 3, <vscale x 2 x i1> %m, i32 %evl) ; nan
34 ret <vscale x 2 x i1> %1
37 define <vscale x 2 x i1> @isnan_nxv2f32(<vscale x 2 x float> %x, <vscale x 2 x i1> %m, i32 zeroext %evl) {
38 ; CHECK-LABEL: isnan_nxv2f32:
40 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
41 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
42 ; CHECK-NEXT: li a0, 927
43 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
44 ; CHECK-NEXT: vand.vx v8, v8, a0
45 ; CHECK-NEXT: vmsne.vi v0, v8, 0
47 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f32(<vscale x 2 x float> %x, i32 639, <vscale x 2 x i1> %m, i32 %evl)
48 ret <vscale x 2 x i1> %1
51 define <vscale x 2 x i1> @isnan_nxv2f32_unmasked(<vscale x 2 x float> %x, i32 zeroext %evl) {
52 ; CHECK-LABEL: isnan_nxv2f32_unmasked:
54 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
55 ; CHECK-NEXT: vfclass.v v8, v8
56 ; CHECK-NEXT: li a0, 927
57 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
58 ; CHECK-NEXT: vand.vx v8, v8, a0
59 ; CHECK-NEXT: vmsne.vi v0, v8, 0
61 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
62 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
63 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f32(<vscale x 2 x float> %x, i32 639, <vscale x 2 x i1> %m, i32 %evl)
64 ret <vscale x 2 x i1> %1
67 define <vscale x 4 x i1> @isnan_nxv4f32(<vscale x 4 x float> %x, <vscale x 4 x i1> %m, i32 zeroext %evl) {
68 ; CHECK-LABEL: isnan_nxv4f32:
70 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
71 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
72 ; CHECK-NEXT: li a0, 768
73 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
74 ; CHECK-NEXT: vand.vx v8, v8, a0
75 ; CHECK-NEXT: vmsne.vi v0, v8, 0
77 %1 = call <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f32(<vscale x 4 x float> %x, i32 3, <vscale x 4 x i1> %m, i32 %evl) ; nan
78 ret <vscale x 4 x i1> %1
81 define <vscale x 4 x i1> @isnan_nxv4f32_unmasked(<vscale x 4 x float> %x, i32 zeroext %evl) {
82 ; CHECK-LABEL: isnan_nxv4f32_unmasked:
84 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
85 ; CHECK-NEXT: vfclass.v v8, v8
86 ; CHECK-NEXT: li a0, 768
87 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
88 ; CHECK-NEXT: vand.vx v8, v8, a0
89 ; CHECK-NEXT: vmsne.vi v0, v8, 0
91 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
92 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
93 %1 = call <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f32(<vscale x 4 x float> %x, i32 3, <vscale x 4 x i1> %m, i32 %evl) ; nan
94 ret <vscale x 4 x i1> %1
97 define <vscale x 8 x i1> @isnan_nxv8f32(<vscale x 8 x float> %x, <vscale x 8 x i1> %m, i32 zeroext %evl) {
98 ; CHECK-LABEL: isnan_nxv8f32:
100 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
101 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
102 ; CHECK-NEXT: li a0, 512
103 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
104 ; CHECK-NEXT: vmseq.vx v0, v8, a0
106 %1 = call <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f32(<vscale x 8 x float> %x, i32 2, <vscale x 8 x i1> %m, i32 %evl)
107 ret <vscale x 8 x i1> %1
110 define <vscale x 8 x i1> @isnan_nxv8f32_unmasked(<vscale x 8 x float> %x, i32 zeroext %evl) {
111 ; CHECK-LABEL: isnan_nxv8f32_unmasked:
113 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
114 ; CHECK-NEXT: vfclass.v v8, v8
115 ; CHECK-NEXT: li a0, 512
116 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
117 ; CHECK-NEXT: vmseq.vx v0, v8, a0
119 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
120 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
121 %1 = call <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f32(<vscale x 8 x float> %x, i32 2, <vscale x 8 x i1> %m, i32 %evl)
122 ret <vscale x 8 x i1> %1
125 define <vscale x 16 x i1> @isnan_nxv16f32(<vscale x 16 x float> %x, <vscale x 16 x i1> %m, i32 zeroext %evl) {
126 ; CHECK-LABEL: isnan_nxv16f32:
128 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
129 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
130 ; CHECK-NEXT: li a0, 256
131 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
132 ; CHECK-NEXT: vmseq.vx v0, v8, a0
134 %1 = call <vscale x 16 x i1> @llvm.vp.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 1, <vscale x 16 x i1> %m, i32 %evl)
135 ret <vscale x 16 x i1> %1
138 define <vscale x 16 x i1> @isnan_nxv16f32_unmasked(<vscale x 16 x float> %x, i32 zeroext %evl) {
139 ; CHECK-LABEL: isnan_nxv16f32_unmasked:
141 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
142 ; CHECK-NEXT: vfclass.v v8, v8
143 ; CHECK-NEXT: li a0, 256
144 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
145 ; CHECK-NEXT: vmseq.vx v0, v8, a0
147 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
148 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
149 %1 = call <vscale x 16 x i1> @llvm.vp.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 1, <vscale x 16 x i1> %m, i32 %evl)
150 ret <vscale x 16 x i1> %1
153 define <vscale x 2 x i1> @isnormal_nxv2f64(<vscale x 2 x double> %x, <vscale x 2 x i1> %m, i32 zeroext %evl) {
154 ; CHECK-LABEL: isnormal_nxv2f64:
156 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
157 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
158 ; CHECK-NEXT: li a0, 129
159 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
160 ; CHECK-NEXT: vand.vx v8, v8, a0
161 ; CHECK-NEXT: vmsne.vi v0, v8, 0
163 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f64(<vscale x 2 x double> %x, i32 516, <vscale x 2 x i1> %m, i32 %evl) ; 0x204 = "inf"
164 ret <vscale x 2 x i1> %1
167 define <vscale x 2 x i1> @isnormal_nxv2f64_unmasked(<vscale x 2 x double> %x, i32 zeroext %evl) {
168 ; CHECK-LABEL: isnormal_nxv2f64_unmasked:
170 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
171 ; CHECK-NEXT: vfclass.v v8, v8
172 ; CHECK-NEXT: li a0, 129
173 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
174 ; CHECK-NEXT: vand.vx v8, v8, a0
175 ; CHECK-NEXT: vmsne.vi v0, v8, 0
177 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
178 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
179 %1 = call <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f64(<vscale x 2 x double> %x, i32 516, <vscale x 2 x i1> %m, i32 %evl) ; 0x204 = "inf"
180 ret <vscale x 2 x i1> %1
183 define <vscale x 4 x i1> @isposinf_nxv4f64(<vscale x 4 x double> %x, <vscale x 4 x i1> %m, i32 zeroext %evl) {
184 ; CHECK-LABEL: isposinf_nxv4f64:
186 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
187 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
188 ; CHECK-NEXT: li a0, 128
189 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
190 ; CHECK-NEXT: vmseq.vx v0, v8, a0
192 %1 = call <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f64(<vscale x 4 x double> %x, i32 512, <vscale x 4 x i1> %m, i32 %evl) ; 0x200 = "+inf"
193 ret <vscale x 4 x i1> %1
196 define <vscale x 4 x i1> @isposinf_nxv4f64_unmasked(<vscale x 4 x double> %x, i32 zeroext %evl) {
197 ; CHECK-LABEL: isposinf_nxv4f64_unmasked:
199 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
200 ; CHECK-NEXT: vfclass.v v8, v8
201 ; CHECK-NEXT: li a0, 128
202 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
203 ; CHECK-NEXT: vmseq.vx v0, v8, a0
205 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
206 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
207 %1 = call <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f64(<vscale x 4 x double> %x, i32 512, <vscale x 4 x i1> %m, i32 %evl) ; 0x200 = "+inf"
208 ret <vscale x 4 x i1> %1
211 define <vscale x 8 x i1> @isneginf_nxv8f64(<vscale x 8 x double> %x, <vscale x 8 x i1> %m, i32 zeroext %evl) {
212 ; CHECK-LABEL: isneginf_nxv8f64:
214 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
215 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
216 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
217 ; CHECK-NEXT: vmseq.vi v0, v8, 1
219 %1 = call <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f64(<vscale x 8 x double> %x, i32 4, <vscale x 8 x i1> %m, i32 %evl) ; "-inf"
220 ret <vscale x 8 x i1> %1
223 define <vscale x 8 x i1> @isneginf_nxv8f64_unmasked(<vscale x 8 x double> %x, i32 zeroext %evl) {
224 ; CHECK-LABEL: isneginf_nxv8f64_unmasked:
226 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
227 ; CHECK-NEXT: vfclass.v v8, v8
228 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
229 ; CHECK-NEXT: vmseq.vi v0, v8, 1
231 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
232 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
233 %1 = call <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f64(<vscale x 8 x double> %x, i32 4, <vscale x 8 x i1> %m, i32 %evl) ; "-inf"
234 ret <vscale x 8 x i1> %1
238 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f16(<vscale x 2 x half>, i32, <vscale x 2 x i1>, i32)
239 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f32(<vscale x 2 x float>, i32, <vscale x 2 x i1>, i32)
240 declare <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f32(<vscale x 4 x float>, i32, <vscale x 4 x i1>, i32)
241 declare <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f32(<vscale x 8 x float>, i32, <vscale x 8 x i1>, i32)
242 declare <vscale x 16 x i1> @llvm.vp.is.fpclass.nxv16f32(<vscale x 16 x float>, i32, <vscale x 16 x i1>, i32)
243 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f64(<vscale x 2 x double>, i32, <vscale x 2 x i1>, i32)
244 declare <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f64(<vscale x 4 x double>, i32, <vscale x 4 x i1>, i32)
245 declare <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f64(<vscale x 8 x double>, i32, <vscale x 8 x i1>, i32)