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: fcmeq p1.s, p0/z, z0.s, z1.s
118 ; CHECK-NEXT: ptest p0, p1.b
119 ; CHECK-NEXT: cset w0, lo
121 %vcond = fcmp oeq <vscale x 4 x float> %a, %b
122 %vscale = call i64 @llvm.vscale.i64()
123 %shl2 = shl nuw nsw i64 %vscale, 2
124 %idx = add nuw nsw i64 %shl2, -1
125 %bit = extractelement <vscale x 4 x i1> %vcond, i64 %idx
129 define i1 @whilege_first(i64 %next, i64 %end) {
130 ; CHECK-LABEL: whilege_first:
132 ; CHECK-NEXT: whilege p0.s, x0, x1
133 ; CHECK-NEXT: cset w0, mi
135 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i64(i64 %next, i64 %end)
136 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
140 define i1 @whilegt_first(i64 %next, i64 %end) {
141 ; CHECK-LABEL: whilegt_first:
143 ; CHECK-NEXT: whilegt p0.s, x0, x1
144 ; CHECK-NEXT: cset w0, mi
146 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilegt.nxv4i1.i64(i64 %next, i64 %end)
147 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
151 define i1 @whilehi_first(i64 %next, i64 %end) {
152 ; CHECK-LABEL: whilehi_first:
154 ; CHECK-NEXT: whilehi p0.s, x0, x1
155 ; CHECK-NEXT: cset w0, mi
157 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehi.nxv4i1.i64(i64 %next, i64 %end)
158 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
162 define i1 @whilehs_first(i64 %next, i64 %end) {
163 ; CHECK-LABEL: whilehs_first:
165 ; CHECK-NEXT: whilehs p0.s, x0, x1
166 ; CHECK-NEXT: cset w0, mi
168 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i64(i64 %next, i64 %end)
169 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
173 define i1 @whilele_first(i64 %next, i64 %end) {
174 ; CHECK-LABEL: whilele_first:
176 ; CHECK-NEXT: whilele p0.s, x0, x1
177 ; CHECK-NEXT: cset w0, mi
179 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilele.nxv4i1.i64(i64 %next, i64 %end)
180 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
184 define i1 @whilelo_first(i64 %next, i64 %end) {
185 ; CHECK-LABEL: whilelo_first:
187 ; CHECK-NEXT: whilelo p0.s, x0, x1
188 ; CHECK-NEXT: cset w0, mi
190 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64 %next, i64 %end)
191 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
195 define i1 @whilels_first(i64 %next, i64 %end) {
196 ; CHECK-LABEL: whilels_first:
198 ; CHECK-NEXT: whilels p0.s, x0, x1
199 ; CHECK-NEXT: cset w0, mi
201 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilels.nxv4i1.i64(i64 %next, i64 %end)
202 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
206 define i1 @whilelt_first(i64 %next, i64 %end) {
207 ; CHECK-LABEL: whilelt_first:
209 ; CHECK-NEXT: whilelt p0.s, x0, x1
210 ; CHECK-NEXT: cset w0, mi
212 %predicate = call <vscale x 4 x i1> @llvm.aarch64.sve.whilelt.nxv4i1.i64(i64 %next, i64 %end)
213 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
217 define i1 @lane_mask_first(i64 %next, i64 %end) {
218 ; CHECK-LABEL: lane_mask_first:
220 ; CHECK-NEXT: whilelo p0.s, x0, x1
221 ; CHECK-NEXT: cset w0, mi
223 %predicate = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64 %next, i64 %end)
224 %bit = extractelement <vscale x 4 x i1> %predicate, i64 0
228 declare i64 @llvm.vscale.i64()
229 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i64(i64, i64)
230 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilegt.nxv4i1.i64(i64, i64)
231 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilehi.nxv4i1.i64(i64, i64)
232 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i64(i64, i64)
233 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilele.nxv4i1.i64(i64, i64)
234 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilelo.nxv4i1.i64(i64, i64)
235 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilels.nxv4i1.i64(i64, i64)
236 declare <vscale x 4 x i1> @llvm.aarch64.sve.whilelt.nxv4i1.i64(i64, i64)
237 declare <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64, i64)