1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-unknown -mattr=+sve2 -o - < %s | FileCheck %s
4 define <vscale x 8 x i1> @not_icmp_sle_nxv8i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
5 ; CHECK-LABEL: not_icmp_sle_nxv8i16:
7 ; CHECK-NEXT: ptrue p0.h
8 ; CHECK-NEXT: cmpgt p0.h, p0/z, z0.h, z1.h
10 %icmp = icmp sle <vscale x 8 x i16> %a, %b
11 %tmp = insertelement <vscale x 8 x i1> undef, i1 true, i32 0
12 %ones = shufflevector <vscale x 8 x i1> %tmp, <vscale x 8 x i1> undef, <vscale x 8 x i32> zeroinitializer
13 %not = xor <vscale x 8 x i1> %ones, %icmp
14 ret <vscale x 8 x i1> %not
17 define <vscale x 4 x i1> @not_icmp_sgt_nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
18 ; CHECK-LABEL: not_icmp_sgt_nxv4i32:
20 ; CHECK-NEXT: ptrue p0.s
21 ; CHECK-NEXT: cmpge p0.s, p0/z, z1.s, z0.s
23 %icmp = icmp sgt <vscale x 4 x i32> %a, %b
24 %tmp = insertelement <vscale x 4 x i1> undef, i1 true, i32 0
25 %ones = shufflevector <vscale x 4 x i1> %tmp, <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer
26 %not = xor <vscale x 4 x i1> %icmp, %ones
27 ret <vscale x 4 x i1> %not
30 define <vscale x 2 x i1> @not_fcmp_une_nxv2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
31 ; CHECK-LABEL: not_fcmp_une_nxv2f64:
33 ; CHECK-NEXT: ptrue p0.d
34 ; CHECK-NEXT: fcmeq p0.d, p0/z, z0.d, z1.d
36 %icmp = fcmp une <vscale x 2 x double> %a, %b
37 %tmp = insertelement <vscale x 2 x i1> undef, i1 true, i32 0
38 %ones = shufflevector <vscale x 2 x i1> %tmp, <vscale x 2 x i1> undef, <vscale x 2 x i32> zeroinitializer
39 %not = xor <vscale x 2 x i1> %icmp, %ones
40 ret <vscale x 2 x i1> %not
43 define <vscale x 4 x i1> @not_fcmp_uge_nxv4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
44 ; CHECK-LABEL: not_fcmp_uge_nxv4f32:
46 ; CHECK-NEXT: ptrue p0.s
47 ; CHECK-NEXT: fcmgt p0.s, p0/z, z1.s, z0.s
49 %icmp = fcmp uge <vscale x 4 x float> %a, %b
50 %tmp = insertelement <vscale x 4 x i1> undef, i1 true, i32 0
51 %ones = shufflevector <vscale x 4 x i1> %tmp, <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer
52 %not = xor <vscale x 4 x i1> %icmp, %ones
53 ret <vscale x 4 x i1> %not
56 define <vscale x 16 x i8> @icmp_cnot_nxv16i8(<vscale x 16 x i8> %a) {
57 ; CHECK-LABEL: icmp_cnot_nxv16i8:
59 ; CHECK-NEXT: ptrue p0.b
60 ; CHECK-NEXT: cnot z0.b, p0/m, z0.b
62 %mask = icmp eq <vscale x 16 x i8> %a, zeroinitializer
63 %zext = zext <vscale x 16 x i1> %mask to <vscale x 16 x i8>
64 ret <vscale x 16 x i8> %zext
67 define <vscale x 8 x i16> @icmp_cnot_nxv8i16(<vscale x 8 x i16> %a) {
68 ; CHECK-LABEL: icmp_cnot_nxv8i16:
70 ; CHECK-NEXT: ptrue p0.h
71 ; CHECK-NEXT: cnot z0.h, p0/m, z0.h
73 %mask = icmp eq <vscale x 8 x i16> %a, zeroinitializer
74 %zext = zext <vscale x 8 x i1> %mask to <vscale x 8 x i16>
75 ret <vscale x 8 x i16> %zext
78 define <vscale x 4 x i32> @icmp_cnot_nxv4i32(<vscale x 4 x i32> %a) {
79 ; CHECK-LABEL: icmp_cnot_nxv4i32:
81 ; CHECK-NEXT: ptrue p0.s
82 ; CHECK-NEXT: cnot z0.s, p0/m, z0.s
84 %mask = icmp eq <vscale x 4 x i32> %a, zeroinitializer
85 %zext = zext <vscale x 4 x i1> %mask to <vscale x 4 x i32>
86 ret <vscale x 4 x i32> %zext
89 define <vscale x 2 x i64> @icmp_cnot_nxv2i64(<vscale x 2 x i64> %a) {
90 ; CHECK-LABEL: icmp_cnot_nxv2i64:
92 ; CHECK-NEXT: ptrue p0.d
93 ; CHECK-NEXT: cnot z0.d, p0/m, z0.d
95 %mask = icmp eq <vscale x 2 x i64> %a, zeroinitializer
96 %zext = zext <vscale x 2 x i1> %mask to <vscale x 2 x i64>
97 ret <vscale x 2 x i64> %zext
100 define i1 @foo_first(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
101 ; CHECK-LABEL: foo_first:
103 ; CHECK-NEXT: ptrue p0.s
104 ; CHECK-NEXT: fcmeq p1.s, p0/z, z0.s, z1.s
105 ; CHECK-NEXT: ptest p0, p1.b
106 ; CHECK-NEXT: cset w0, mi
108 %vcond = fcmp oeq <vscale x 4 x float> %a, %b
109 %bit = extractelement <vscale x 4 x i1> %vcond, i64 0
113 define i1 @foo_last(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
114 ; CHECK-LABEL: foo_last:
116 ; CHECK-NEXT: ptrue p0.s
117 ; CHECK-NEXT: mov x8, #-1 // =0xffffffffffffffff
118 ; CHECK-NEXT: fcmeq p0.s, p0/z, z0.s, z1.s
119 ; CHECK-NEXT: mov z0.s, p0/z, #1 // =0x1
120 ; CHECK-NEXT: whilels p0.s, xzr, x8
121 ; CHECK-NEXT: lastb w8, p0, z0.s
122 ; CHECK-NEXT: and w0, w8, #0x1
124 %vcond = fcmp oeq <vscale x 4 x float> %a, %b
125 %vscale = call i64 @llvm.vscale.i64()
126 %shl2 = shl nuw nsw i64 %vscale, 2
127 %idx = add nuw nsw i64 %shl2, -1
128 %bit = extractelement <vscale x 4 x i1> %vcond, i64 %idx
132 define i1 @whilege_first(i64 %next, i64 %end) {
133 ; CHECK-LABEL: whilege_first:
135 ; CHECK-NEXT: whilege p0.s, x0, x1
136 ; CHECK-NEXT: cset w0, mi
138 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i64(i64 %next, i64 %end)
139 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
143 define i1 @whilegt_first(i64 %next, i64 %end) {
144 ; CHECK-LABEL: whilegt_first:
146 ; CHECK-NEXT: whilegt p0.s, x0, x1
147 ; CHECK-NEXT: cset w0, mi
149 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilegt.nxv4i1.i64(i64 %next, i64 %end)
150 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
154 define i1 @whilehi_first(i64 %next, i64 %end) {
155 ; CHECK-LABEL: whilehi_first:
157 ; CHECK-NEXT: whilehi p0.s, x0, x1
158 ; CHECK-NEXT: cset w0, mi
160 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehi.nxv4i1.i64(i64 %next, i64 %end)
161 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
165 define i1 @whilehs_first(i64 %next, i64 %end) {
166 ; CHECK-LABEL: whilehs_first:
168 ; CHECK-NEXT: whilehs p0.s, x0, x1
169 ; CHECK-NEXT: cset w0, mi
171 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i64(i64 %next, i64 %end)
172 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
176 define i1 @whilele_first(i64 %next, i64 %end) {
177 ; CHECK-LABEL: whilele_first:
179 ; CHECK-NEXT: whilele p0.s, x0, x1
180 ; CHECK-NEXT: cset w0, mi
182 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilele.nxv4i1.i64(i64 %next, i64 %end)
183 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
187 define i1 @whilelo_first(i64 %next, i64 %end) {
188 ; CHECK-LABEL: whilelo_first:
190 ; CHECK-NEXT: whilelo p0.s, x0, x1
191 ; CHECK-NEXT: cset w0, mi
193 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64 %next, i64 %end)
194 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
198 define i1 @whilels_first(i64 %next, i64 %end) {
199 ; CHECK-LABEL: whilels_first:
201 ; CHECK-NEXT: whilels p0.s, x0, x1
202 ; CHECK-NEXT: cset w0, mi
204 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilels.nxv4i1.i64(i64 %next, i64 %end)
205 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
209 define i1 @whilelt_first(i64 %next, i64 %end) {
210 ; CHECK-LABEL: whilelt_first:
212 ; CHECK-NEXT: whilelt p0.s, x0, x1
213 ; CHECK-NEXT: cset w0, mi
215 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilelt.nxv4i1.i64(i64 %next, i64 %end)
216 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
220 define i1 @lane_mask_first(i64 %next, i64 %end) {
221 ; CHECK-LABEL: lane_mask_first:
223 ; CHECK-NEXT: whilelo p0.s, x0, x1
224 ; CHECK-NEXT: cset w0, mi
226 %predicate = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64 %next, i64 %end)
227 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
231 declare i64 @llvm.vscale.i64()
232 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i64(i64, i64)
233 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilegt.nxv4i1.i64(i64, i64)
234 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilehi.nxv4i1.i64(i64, i64)
235 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i64(i64, i64)
236 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilele.nxv4i1.i64(i64, i64)
237 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64, i64)
238 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilels.nxv4i1.i64(i64, i64)
239 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilelt.nxv4i1.i64(i64, i64)
240 declare <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64, i64)