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) {
8 ; CHECK-LABEL: isnan_nxv2f16:
10 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
11 ; CHECK-NEXT: vfclass.v v8, v8
12 ; CHECK-NEXT: li a0, 768
13 ; CHECK-NEXT: vand.vx v8, v8, a0
14 ; CHECK-NEXT: vmsne.vi v0, v8, 0
16 %1 = call <vscale x 2 x i1> @llvm.is.fpclass.nxv2f16(<vscale x 2 x half> %x, i32 3) ; nan
17 ret <vscale x 2 x i1> %1
20 define <vscale x 2 x i1> @isnan_nxv2f32(<vscale x 2 x float> %x) {
21 ; CHECK-LABEL: isnan_nxv2f32:
23 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
24 ; CHECK-NEXT: vfclass.v v8, v8
25 ; CHECK-NEXT: li a0, 927
26 ; CHECK-NEXT: vand.vx v8, v8, a0
27 ; CHECK-NEXT: vmsne.vi v0, v8, 0
29 %1 = call <vscale x 2 x i1> @llvm.is.fpclass.nxv2f32(<vscale x 2 x float> %x, i32 639)
30 ret <vscale x 2 x i1> %1
34 define <vscale x 4 x i1> @isnan_nxv4f32(<vscale x 4 x float> %x) {
35 ; CHECK-LABEL: isnan_nxv4f32:
37 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
38 ; CHECK-NEXT: vfclass.v v8, v8
39 ; CHECK-NEXT: li a0, 768
40 ; CHECK-NEXT: vand.vx v8, v8, a0
41 ; CHECK-NEXT: vmsne.vi v0, v8, 0
43 %1 = call <vscale x 4 x i1> @llvm.is.fpclass.nxv4f32(<vscale x 4 x float> %x, i32 3) ; nan
44 ret <vscale x 4 x i1> %1
47 define <vscale x 8 x i1> @isnan_nxv8f32(<vscale x 8 x float> %x) {
48 ; CHECK-LABEL: isnan_nxv8f32:
50 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
51 ; CHECK-NEXT: vfclass.v v8, v8
52 ; CHECK-NEXT: li a0, 512
53 ; CHECK-NEXT: vmseq.vx v0, v8, a0
55 %1 = call <vscale x 8 x i1> @llvm.is.fpclass.nxv8f32(<vscale x 8 x float> %x, i32 2)
56 ret <vscale x 8 x i1> %1
59 define <vscale x 16 x i1> @isnan_nxv16f32(<vscale x 16 x float> %x) {
60 ; CHECK-LABEL: isnan_nxv16f32:
62 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
63 ; CHECK-NEXT: vfclass.v v8, v8
64 ; CHECK-NEXT: li a0, 256
65 ; CHECK-NEXT: vmseq.vx v0, v8, a0
67 %1 = call <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 1)
68 ret <vscale x 16 x i1> %1
71 define <vscale x 2 x i1> @isnormal_nxv2f64(<vscale x 2 x double> %x) {
72 ; CHECK-LABEL: isnormal_nxv2f64:
74 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
75 ; CHECK-NEXT: vfclass.v v8, v8
76 ; CHECK-NEXT: li a0, 129
77 ; CHECK-NEXT: vand.vx v8, v8, a0
78 ; CHECK-NEXT: vmsne.vi v0, v8, 0
80 %1 = call <vscale x 2 x i1> @llvm.is.fpclass.nxv2f64(<vscale x 2 x double> %x, i32 516) ; 0x204 = "inf"
81 ret <vscale x 2 x i1> %1
84 define <vscale x 4 x i1> @isposinf_nxv4f64(<vscale x 4 x double> %x) {
85 ; CHECK-LABEL: isposinf_nxv4f64:
87 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
88 ; CHECK-NEXT: vfclass.v v8, v8
89 ; CHECK-NEXT: li a0, 128
90 ; CHECK-NEXT: vmseq.vx v0, v8, a0
92 %1 = call <vscale x 4 x i1> @llvm.is.fpclass.nxv4f64(<vscale x 4 x double> %x, i32 512) ; 0x200 = "+inf"
93 ret <vscale x 4 x i1> %1
96 define <vscale x 8 x i1> @isneginf_nxv8f64(<vscale x 8 x double> %x) {
97 ; CHECK-LABEL: isneginf_nxv8f64:
99 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
100 ; CHECK-NEXT: vfclass.v v8, v8
101 ; CHECK-NEXT: vmseq.vi v0, v8, 1
103 %1 = call <vscale x 8 x i1> @llvm.is.fpclass.nxv8f64(<vscale x 8 x double> %x, i32 4) ; "-inf"
104 ret <vscale x 8 x i1> %1
107 define <vscale x 16 x i1> @isfinite_nxv16f32(<vscale x 16 x float> %x) {
108 ; CHECK-LABEL: isfinite_nxv16f32:
110 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
111 ; CHECK-NEXT: vfclass.v v8, v8
112 ; CHECK-NEXT: li a0, 126
113 ; CHECK-NEXT: vand.vx v8, v8, a0
114 ; CHECK-NEXT: vmsne.vi v0, v8, 0
116 %1 = call <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 504) ; 0x1f8 = "finite"
117 ret <vscale x 16 x i1> %1
120 define <vscale x 16 x i1> @isposfinite_nxv16f32(<vscale x 16 x float> %x) {
121 ; CHECK-LABEL: isposfinite_nxv16f32:
123 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
124 ; CHECK-NEXT: vfclass.v v8, v8
125 ; CHECK-NEXT: li a0, 112
126 ; CHECK-NEXT: vand.vx v8, v8, a0
127 ; CHECK-NEXT: vmsne.vi v0, v8, 0
129 %1 = call <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 448) ; 0x1c0 = "+finite"
130 ret <vscale x 16 x i1> %1
133 define <vscale x 16 x i1> @isnegfinite_nxv16f32(<vscale x 16 x float> %x) {
134 ; CHECK-LABEL: isnegfinite_nxv16f32:
136 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
137 ; CHECK-NEXT: vfclass.v v8, v8
138 ; CHECK-NEXT: vand.vi v8, v8, 14
139 ; CHECK-NEXT: vmsne.vi v0, v8, 0
141 %1 = call <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 56) ; 0x38 = "-finite"
142 ret <vscale x 16 x i1> %1
145 define <vscale x 16 x i1> @isnotfinite_nxv16f32(<vscale x 16 x float> %x) {
146 ; CHECK-LABEL: isnotfinite_nxv16f32:
148 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
149 ; CHECK-NEXT: vfclass.v v8, v8
150 ; CHECK-NEXT: li a0, 897
151 ; CHECK-NEXT: vand.vx v8, v8, a0
152 ; CHECK-NEXT: vmsne.vi v0, v8, 0
154 %1 = call <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float> %x, i32 519) ; 0x207 = "inf|nan"
155 ret <vscale x 16 x i1> %1
158 declare <vscale x 2 x i1> @llvm.is.fpclass.nxv2f16(<vscale x 2 x half>, i32)
159 declare <vscale x 2 x i1> @llvm.is.fpclass.nxv2f32(<vscale x 2 x float>, i32)
160 declare <vscale x 4 x i1> @llvm.is.fpclass.nxv4f32(<vscale x 4 x float>, i32)
161 declare <vscale x 8 x i1> @llvm.is.fpclass.nxv8f32(<vscale x 8 x float>, i32)
162 declare <vscale x 16 x i1> @llvm.is.fpclass.nxv16f32(<vscale x 16 x float>, i32)
163 declare <vscale x 2 x i1> @llvm.is.fpclass.nxv2f64(<vscale x 2 x double>, i32)
164 declare <vscale x 4 x i1> @llvm.is.fpclass.nxv4f64(<vscale x 4 x double>, i32)
165 declare <vscale x 8 x i1> @llvm.is.fpclass.nxv8f64(<vscale x 8 x double>, i32)