1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
5 define arm_aapcs_vfpcc <4 x i32> @build_var0_v4i1(i32 %s, i32 %t, <4 x i32> %a, <4 x i32> %b) {
6 ; CHECK-LABEL: build_var0_v4i1:
7 ; CHECK: @ %bb.0: @ %entry
8 ; CHECK-NEXT: cmp r0, r1
9 ; CHECK-NEXT: mov.w r1, #0
10 ; CHECK-NEXT: cset r0, lo
11 ; CHECK-NEXT: and r0, r0, #1
12 ; CHECK-NEXT: rsbs r0, r0, #0
13 ; CHECK-NEXT: bfi r1, r0, #0, #4
14 ; CHECK-NEXT: vmsr p0, r1
15 ; CHECK-NEXT: vpsel q0, q0, q1
18 %c = icmp ult i32 %s, %t
19 %vc = insertelement <4 x i1> zeroinitializer, i1 %c, i64 0
20 %r = select <4 x i1> %vc, <4 x i32> %a, <4 x i32> %b
24 define arm_aapcs_vfpcc <4 x i32> @build_var3_v4i1(i32 %s, i32 %t, <4 x i32> %a, <4 x i32> %b) {
25 ; CHECK-LABEL: build_var3_v4i1:
26 ; CHECK: @ %bb.0: @ %entry
27 ; CHECK-NEXT: cmp r0, r1
28 ; CHECK-NEXT: mov.w r1, #0
29 ; CHECK-NEXT: cset r0, lo
30 ; CHECK-NEXT: and r0, r0, #1
31 ; CHECK-NEXT: rsbs r0, r0, #0
32 ; CHECK-NEXT: bfi r1, r0, #12, #4
33 ; CHECK-NEXT: vmsr p0, r1
34 ; CHECK-NEXT: vpsel q0, q0, q1
37 %c = icmp ult i32 %s, %t
38 %vc = insertelement <4 x i1> zeroinitializer, i1 %c, i64 3
39 %r = select <4 x i1> %vc, <4 x i32> %a, <4 x i32> %b
43 define arm_aapcs_vfpcc <4 x i32> @build_varN_v4i1(i32 %s, i32 %t, <4 x i32> %a, <4 x i32> %b) {
44 ; CHECK-LABEL: build_varN_v4i1:
45 ; CHECK: @ %bb.0: @ %entry
46 ; CHECK-NEXT: cmp r0, r1
47 ; CHECK-NEXT: mov.w r1, #0
48 ; CHECK-NEXT: cset r0, lo
49 ; CHECK-NEXT: and r0, r0, #1
50 ; CHECK-NEXT: rsbs r0, r0, #0
51 ; CHECK-NEXT: bfi r1, r0, #0, #4
52 ; CHECK-NEXT: bfi r1, r0, #4, #4
53 ; CHECK-NEXT: bfi r1, r0, #8, #4
54 ; CHECK-NEXT: bfi r1, r0, #12, #4
55 ; CHECK-NEXT: vmsr p0, r1
56 ; CHECK-NEXT: vpsel q0, q0, q1
59 %c = icmp ult i32 %s, %t
60 %vc1 = insertelement <4 x i1> undef, i1 %c, i64 0
61 %vc4 = shufflevector <4 x i1> %vc1, <4 x i1> undef, <4 x i32> zeroinitializer
62 %r = select <4 x i1> %vc4, <4 x i32> %a, <4 x i32> %b
67 define arm_aapcs_vfpcc <8 x i16> @build_var0_v8i1(i32 %s, i32 %t, <8 x i16> %a, <8 x i16> %b) {
68 ; CHECK-LABEL: build_var0_v8i1:
69 ; CHECK: @ %bb.0: @ %entry
70 ; CHECK-NEXT: cmp r0, r1
71 ; CHECK-NEXT: mov.w r1, #0
72 ; CHECK-NEXT: cset r0, lo
73 ; CHECK-NEXT: and r0, r0, #1
74 ; CHECK-NEXT: rsbs r0, r0, #0
75 ; CHECK-NEXT: bfi r1, r0, #0, #2
76 ; CHECK-NEXT: vmsr p0, r1
77 ; CHECK-NEXT: vpsel q0, q0, q1
80 %c = icmp ult i32 %s, %t
81 %vc = insertelement <8 x i1> zeroinitializer, i1 %c, i64 0
82 %r = select <8 x i1> %vc, <8 x i16> %a, <8 x i16> %b
86 define arm_aapcs_vfpcc <8 x i16> @build_var3_v8i1(i32 %s, i32 %t, <8 x i16> %a, <8 x i16> %b) {
87 ; CHECK-LABEL: build_var3_v8i1:
88 ; CHECK: @ %bb.0: @ %entry
89 ; CHECK-NEXT: cmp r0, r1
90 ; CHECK-NEXT: mov.w r1, #0
91 ; CHECK-NEXT: cset r0, lo
92 ; CHECK-NEXT: and r0, r0, #1
93 ; CHECK-NEXT: rsbs r0, r0, #0
94 ; CHECK-NEXT: bfi r1, r0, #6, #2
95 ; CHECK-NEXT: vmsr p0, r1
96 ; CHECK-NEXT: vpsel q0, q0, q1
99 %c = icmp ult i32 %s, %t
100 %vc = insertelement <8 x i1> zeroinitializer, i1 %c, i64 3
101 %r = select <8 x i1> %vc, <8 x i16> %a, <8 x i16> %b
105 define arm_aapcs_vfpcc <8 x i16> @build_varN_v8i1(i32 %s, i32 %t, <8 x i16> %a, <8 x i16> %b) {
106 ; CHECK-LABEL: build_varN_v8i1:
107 ; CHECK: @ %bb.0: @ %entry
108 ; CHECK-NEXT: cmp r0, r1
109 ; CHECK-NEXT: mov.w r1, #0
110 ; CHECK-NEXT: cset r0, lo
111 ; CHECK-NEXT: and r0, r0, #1
112 ; CHECK-NEXT: rsbs r0, r0, #0
113 ; CHECK-NEXT: bfi r1, r0, #0, #2
114 ; CHECK-NEXT: bfi r1, r0, #2, #2
115 ; CHECK-NEXT: bfi r1, r0, #4, #2
116 ; CHECK-NEXT: bfi r1, r0, #6, #2
117 ; CHECK-NEXT: bfi r1, r0, #8, #2
118 ; CHECK-NEXT: bfi r1, r0, #10, #2
119 ; CHECK-NEXT: bfi r1, r0, #12, #2
120 ; CHECK-NEXT: bfi r1, r0, #14, #2
121 ; CHECK-NEXT: vmsr p0, r1
122 ; CHECK-NEXT: vpsel q0, q0, q1
125 %c = icmp ult i32 %s, %t
126 %vc1 = insertelement <8 x i1> undef, i1 %c, i64 0
127 %vc4 = shufflevector <8 x i1> %vc1, <8 x i1> undef, <8 x i32> zeroinitializer
128 %r = select <8 x i1> %vc4, <8 x i16> %a, <8 x i16> %b
133 define arm_aapcs_vfpcc <16 x i8> @build_var0_v16i1(i32 %s, i32 %t, <16 x i8> %a, <16 x i8> %b) {
134 ; CHECK-LABEL: build_var0_v16i1:
135 ; CHECK: @ %bb.0: @ %entry
136 ; CHECK-NEXT: cmp r0, r1
137 ; CHECK-NEXT: mov.w r1, #0
138 ; CHECK-NEXT: cset r0, lo
139 ; CHECK-NEXT: and r0, r0, #1
140 ; CHECK-NEXT: rsbs r0, r0, #0
141 ; CHECK-NEXT: bfi r1, r0, #0, #1
142 ; CHECK-NEXT: vmsr p0, r1
143 ; CHECK-NEXT: vpsel q0, q0, q1
146 %c = icmp ult i32 %s, %t
147 %vc = insertelement <16 x i1> zeroinitializer, i1 %c, i64 0
148 %r = select <16 x i1> %vc, <16 x i8> %a, <16 x i8> %b
152 define arm_aapcs_vfpcc <16 x i8> @build_var3_v16i1(i32 %s, i32 %t, <16 x i8> %a, <16 x i8> %b) {
153 ; CHECK-LABEL: build_var3_v16i1:
154 ; CHECK: @ %bb.0: @ %entry
155 ; CHECK-NEXT: cmp r0, r1
156 ; CHECK-NEXT: mov.w r1, #0
157 ; CHECK-NEXT: cset r0, lo
158 ; CHECK-NEXT: and r0, r0, #1
159 ; CHECK-NEXT: rsbs r0, r0, #0
160 ; CHECK-NEXT: bfi r1, r0, #3, #1
161 ; CHECK-NEXT: vmsr p0, r1
162 ; CHECK-NEXT: vpsel q0, q0, q1
165 %c = icmp ult i32 %s, %t
166 %vc = insertelement <16 x i1> zeroinitializer, i1 %c, i64 3
167 %r = select <16 x i1> %vc, <16 x i8> %a, <16 x i8> %b
171 define arm_aapcs_vfpcc <16 x i8> @build_varN_v16i1(i32 %s, i32 %t, <16 x i8> %a, <16 x i8> %b) {
172 ; CHECK-LABEL: build_varN_v16i1:
173 ; CHECK: @ %bb.0: @ %entry
174 ; CHECK-NEXT: cmp r0, r1
175 ; CHECK-NEXT: mov.w r1, #0
176 ; CHECK-NEXT: cset r0, lo
177 ; CHECK-NEXT: and r0, r0, #1
178 ; CHECK-NEXT: rsbs r0, r0, #0
179 ; CHECK-NEXT: bfi r1, r0, #0, #1
180 ; CHECK-NEXT: bfi r1, r0, #1, #1
181 ; CHECK-NEXT: bfi r1, r0, #2, #1
182 ; CHECK-NEXT: bfi r1, r0, #3, #1
183 ; CHECK-NEXT: bfi r1, r0, #4, #1
184 ; CHECK-NEXT: bfi r1, r0, #5, #1
185 ; CHECK-NEXT: bfi r1, r0, #6, #1
186 ; CHECK-NEXT: bfi r1, r0, #7, #1
187 ; CHECK-NEXT: bfi r1, r0, #8, #1
188 ; CHECK-NEXT: bfi r1, r0, #9, #1
189 ; CHECK-NEXT: bfi r1, r0, #10, #1
190 ; CHECK-NEXT: bfi r1, r0, #11, #1
191 ; CHECK-NEXT: bfi r1, r0, #12, #1
192 ; CHECK-NEXT: bfi r1, r0, #13, #1
193 ; CHECK-NEXT: bfi r1, r0, #14, #1
194 ; CHECK-NEXT: bfi r1, r0, #15, #1
195 ; CHECK-NEXT: vmsr p0, r1
196 ; CHECK-NEXT: vpsel q0, q0, q1
199 %c = icmp ult i32 %s, %t
200 %vc1 = insertelement <16 x i1> undef, i1 %c, i64 0
201 %vc4 = shufflevector <16 x i1> %vc1, <16 x i1> undef, <16 x i32> zeroinitializer
202 %r = select <16 x i1> %vc4, <16 x i8> %a, <16 x i8> %b
207 define arm_aapcs_vfpcc <2 x i64> @build_var0_v2i1(i32 %s, i32 %t, <2 x i64> %a, <2 x i64> %b) {
208 ; CHECK-LABEL: build_var0_v2i1:
209 ; CHECK: @ %bb.0: @ %entry
210 ; CHECK-NEXT: cmp r0, r1
211 ; CHECK-NEXT: cset r0, lo
212 ; CHECK-NEXT: and r0, r0, #1
213 ; CHECK-NEXT: rsbs r0, r0, #0
214 ; CHECK-NEXT: vmov s8, r0
215 ; CHECK-NEXT: vldr s10, .LCPI9_0
216 ; CHECK-NEXT: vmov.f32 s9, s8
217 ; CHECK-NEXT: vmov.f32 s11, s10
218 ; CHECK-NEXT: vbic q1, q1, q2
219 ; CHECK-NEXT: vand q0, q0, q2
220 ; CHECK-NEXT: vorr q0, q0, q1
222 ; CHECK-NEXT: .p2align 2
223 ; CHECK-NEXT: @ %bb.1:
224 ; CHECK-NEXT: .LCPI9_0:
225 ; CHECK-NEXT: .long 0 @ float 0
227 %c = icmp ult i32 %s, %t
228 %vc = insertelement <2 x i1> zeroinitializer, i1 %c, i64 0
229 %r = select <2 x i1> %vc, <2 x i64> %a, <2 x i64> %b
233 define arm_aapcs_vfpcc <2 x i64> @build_var1_v2i1(i32 %s, i32 %t, <2 x i64> %a, <2 x i64> %b) {
234 ; CHECK-LABEL: build_var1_v2i1:
235 ; CHECK: @ %bb.0: @ %entry
236 ; CHECK-NEXT: cmp r0, r1
237 ; CHECK-NEXT: cset r0, lo
238 ; CHECK-NEXT: and r0, r0, #1
239 ; CHECK-NEXT: rsbs r0, r0, #0
240 ; CHECK-NEXT: vmov s10, r0
241 ; CHECK-NEXT: vldr s8, .LCPI10_0
242 ; CHECK-NEXT: vmov.f32 s9, s8
243 ; CHECK-NEXT: vmov.f32 s11, s10
244 ; CHECK-NEXT: vbic q1, q1, q2
245 ; CHECK-NEXT: vand q0, q0, q2
246 ; CHECK-NEXT: vorr q0, q0, q1
248 ; CHECK-NEXT: .p2align 2
249 ; CHECK-NEXT: @ %bb.1:
250 ; CHECK-NEXT: .LCPI10_0:
251 ; CHECK-NEXT: .long 0 @ float 0
253 %c = icmp ult i32 %s, %t
254 %vc = insertelement <2 x i1> zeroinitializer, i1 %c, i64 1
255 %r = select <2 x i1> %vc, <2 x i64> %a, <2 x i64> %b
259 define arm_aapcs_vfpcc <2 x i64> @build_varN_v2i1(i32 %s, i32 %t, <2 x i64> %a, <2 x i64> %b) {
260 ; CHECK-LABEL: build_varN_v2i1:
261 ; CHECK: @ %bb.0: @ %entry
262 ; CHECK-NEXT: cmp r0, r1
263 ; CHECK-NEXT: cset r0, lo
264 ; CHECK-NEXT: and r0, r0, #1
265 ; CHECK-NEXT: rsbs r0, r0, #0
266 ; CHECK-NEXT: vdup.32 q2, r0
267 ; CHECK-NEXT: vbic q1, q1, q2
268 ; CHECK-NEXT: vand q0, q0, q2
269 ; CHECK-NEXT: vorr q0, q0, q1
272 %c = icmp ult i32 %s, %t
273 %vc1 = insertelement <2 x i1> undef, i1 %c, i64 0
274 %vc4 = shufflevector <2 x i1> %vc1, <2 x i1> undef, <2 x i32> zeroinitializer
275 %r = select <2 x i1> %vc4, <2 x i64> %a, <2 x i64> %b