1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+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 %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> splat (i1 true), i32 %evl) ; nan
32 ret <vscale x 2 x i1> %1
35 define <vscale x 2 x i1> @isnan_nxv2f32(<vscale x 2 x float> %x, <vscale x 2 x i1> %m, i32 zeroext %evl) {
36 ; CHECK-LABEL: isnan_nxv2f32:
38 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
39 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
40 ; CHECK-NEXT: li a0, 927
41 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
42 ; CHECK-NEXT: vand.vx v8, v8, a0
43 ; CHECK-NEXT: vmsne.vi v0, v8, 0
45 %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)
46 ret <vscale x 2 x i1> %1
49 define <vscale x 2 x i1> @isnan_nxv2f32_unmasked(<vscale x 2 x float> %x, i32 zeroext %evl) {
50 ; CHECK-LABEL: isnan_nxv2f32_unmasked:
52 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
53 ; CHECK-NEXT: vfclass.v v8, v8
54 ; CHECK-NEXT: li a0, 927
55 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
56 ; CHECK-NEXT: vand.vx v8, v8, a0
57 ; CHECK-NEXT: vmsne.vi v0, v8, 0
59 %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> splat (i1 true), i32 %evl)
60 ret <vscale x 2 x i1> %1
63 define <vscale x 4 x i1> @isnan_nxv4f32(<vscale x 4 x float> %x, <vscale x 4 x i1> %m, i32 zeroext %evl) {
64 ; CHECK-LABEL: isnan_nxv4f32:
66 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
67 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
68 ; CHECK-NEXT: li a0, 768
69 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
70 ; CHECK-NEXT: vand.vx v8, v8, a0
71 ; CHECK-NEXT: vmsne.vi v0, v8, 0
73 %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
74 ret <vscale x 4 x i1> %1
77 define <vscale x 4 x i1> @isnan_nxv4f32_unmasked(<vscale x 4 x float> %x, i32 zeroext %evl) {
78 ; CHECK-LABEL: isnan_nxv4f32_unmasked:
80 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
81 ; CHECK-NEXT: vfclass.v v8, v8
82 ; CHECK-NEXT: li a0, 768
83 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
84 ; CHECK-NEXT: vand.vx v8, v8, a0
85 ; CHECK-NEXT: vmsne.vi v0, v8, 0
87 %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> splat (i1 true), i32 %evl) ; nan
88 ret <vscale x 4 x i1> %1
91 define <vscale x 8 x i1> @isnan_nxv8f32(<vscale x 8 x float> %x, <vscale x 8 x i1> %m, i32 zeroext %evl) {
92 ; CHECK-LABEL: isnan_nxv8f32:
94 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
95 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
96 ; CHECK-NEXT: li a0, 512
97 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
98 ; CHECK-NEXT: vmseq.vx v0, v8, a0
100 %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)
101 ret <vscale x 8 x i1> %1
104 define <vscale x 8 x i1> @isnan_nxv8f32_unmasked(<vscale x 8 x float> %x, i32 zeroext %evl) {
105 ; CHECK-LABEL: isnan_nxv8f32_unmasked:
107 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
108 ; CHECK-NEXT: vfclass.v v8, v8
109 ; CHECK-NEXT: li a0, 512
110 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
111 ; CHECK-NEXT: vmseq.vx v0, v8, a0
113 %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> splat (i1 true), i32 %evl)
114 ret <vscale x 8 x i1> %1
117 define <vscale x 16 x i1> @isnan_nxv16f32(<vscale x 16 x float> %x, <vscale x 16 x i1> %m, i32 zeroext %evl) {
118 ; CHECK-LABEL: isnan_nxv16f32:
120 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
121 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
122 ; CHECK-NEXT: li a0, 256
123 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
124 ; CHECK-NEXT: vmseq.vx v0, v8, a0
126 %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)
127 ret <vscale x 16 x i1> %1
130 define <vscale x 16 x i1> @isnan_nxv16f32_unmasked(<vscale x 16 x float> %x, i32 zeroext %evl) {
131 ; CHECK-LABEL: isnan_nxv16f32_unmasked:
133 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
134 ; CHECK-NEXT: vfclass.v v8, v8
135 ; CHECK-NEXT: li a0, 256
136 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
137 ; CHECK-NEXT: vmseq.vx v0, v8, a0
139 %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> splat (i1 true), i32 %evl)
140 ret <vscale x 16 x i1> %1
143 define <vscale x 2 x i1> @isnormal_nxv2f64(<vscale x 2 x double> %x, <vscale x 2 x i1> %m, i32 zeroext %evl) {
144 ; CHECK-LABEL: isnormal_nxv2f64:
146 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
147 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
148 ; CHECK-NEXT: li a0, 129
149 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
150 ; CHECK-NEXT: vand.vx v8, v8, a0
151 ; CHECK-NEXT: vmsne.vi v0, v8, 0
153 %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"
154 ret <vscale x 2 x i1> %1
157 define <vscale x 2 x i1> @isnormal_nxv2f64_unmasked(<vscale x 2 x double> %x, i32 zeroext %evl) {
158 ; CHECK-LABEL: isnormal_nxv2f64_unmasked:
160 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
161 ; CHECK-NEXT: vfclass.v v8, v8
162 ; CHECK-NEXT: li a0, 129
163 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
164 ; CHECK-NEXT: vand.vx v8, v8, a0
165 ; CHECK-NEXT: vmsne.vi v0, v8, 0
167 %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> splat (i1 true), i32 %evl) ; 0x204 = "inf"
168 ret <vscale x 2 x i1> %1
171 define <vscale x 4 x i1> @isposinf_nxv4f64(<vscale x 4 x double> %x, <vscale x 4 x i1> %m, i32 zeroext %evl) {
172 ; CHECK-LABEL: isposinf_nxv4f64:
174 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
175 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
176 ; CHECK-NEXT: li a0, 128
177 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
178 ; CHECK-NEXT: vmseq.vx v0, v8, a0
180 %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"
181 ret <vscale x 4 x i1> %1
184 define <vscale x 4 x i1> @isposinf_nxv4f64_unmasked(<vscale x 4 x double> %x, i32 zeroext %evl) {
185 ; CHECK-LABEL: isposinf_nxv4f64_unmasked:
187 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
188 ; CHECK-NEXT: vfclass.v v8, v8
189 ; CHECK-NEXT: li a0, 128
190 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
191 ; CHECK-NEXT: vmseq.vx v0, v8, a0
193 %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> splat (i1 true), i32 %evl) ; 0x200 = "+inf"
194 ret <vscale x 4 x i1> %1
197 define <vscale x 8 x i1> @isneginf_nxv8f64(<vscale x 8 x double> %x, <vscale x 8 x i1> %m, i32 zeroext %evl) {
198 ; CHECK-LABEL: isneginf_nxv8f64:
200 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
201 ; CHECK-NEXT: vfclass.v v8, v8, v0.t
202 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
203 ; CHECK-NEXT: vmseq.vi v0, v8, 1
205 %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"
206 ret <vscale x 8 x i1> %1
209 define <vscale x 8 x i1> @isneginf_nxv8f64_unmasked(<vscale x 8 x double> %x, i32 zeroext %evl) {
210 ; CHECK-LABEL: isneginf_nxv8f64_unmasked:
212 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
213 ; CHECK-NEXT: vfclass.v v8, v8
214 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
215 ; CHECK-NEXT: vmseq.vi v0, v8, 1
217 %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> splat (i1 true), i32 %evl) ; "-inf"
218 ret <vscale x 8 x i1> %1
222 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f16(<vscale x 2 x half>, i32, <vscale x 2 x i1>, i32)
223 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f32(<vscale x 2 x float>, i32, <vscale x 2 x i1>, i32)
224 declare <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f32(<vscale x 4 x float>, i32, <vscale x 4 x i1>, i32)
225 declare <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f32(<vscale x 8 x float>, i32, <vscale x 8 x i1>, i32)
226 declare <vscale x 16 x i1> @llvm.vp.is.fpclass.nxv16f32(<vscale x 16 x float>, i32, <vscale x 16 x i1>, i32)
227 declare <vscale x 2 x i1> @llvm.vp.is.fpclass.nxv2f64(<vscale x 2 x double>, i32, <vscale x 2 x i1>, i32)
228 declare <vscale x 4 x i1> @llvm.vp.is.fpclass.nxv4f64(<vscale x 4 x double>, i32, <vscale x 4 x i1>, i32)
229 declare <vscale x 8 x i1> @llvm.vp.is.fpclass.nxv8f64(<vscale x 8 x double>, i32, <vscale x 8 x i1>, i32)