1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
5 define <4 x i32> @test_srem_odd_even(<4 x i32> %X) nounwind {
6 ; CHECK-LABEL: test_srem_odd_even:
8 ; CHECK-NEXT: adrp x8, .LCPI0_0
9 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI0_0]
10 ; CHECK-NEXT: adrp x8, .LCPI0_1
11 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI0_1]
12 ; CHECK-NEXT: adrp x8, .LCPI0_2
13 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI0_2]
14 ; CHECK-NEXT: adrp x8, .LCPI0_3
15 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
16 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI0_3]
17 ; CHECK-NEXT: adrp x8, .LCPI0_4
18 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI0_4]
19 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
20 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
21 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
22 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
23 ; CHECK-NEXT: movi v1.4s, #1
24 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
26 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 25, i32 100>
27 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
28 %ret = zext <4 x i1> %cmp to <4 x i32>
32 ;==============================================================================;
34 ; One all-ones divisor in odd divisor
35 define <4 x i32> @test_srem_odd_allones_eq(<4 x i32> %X) nounwind {
36 ; CHECK-LABEL: test_srem_odd_allones_eq:
38 ; CHECK-NEXT: adrp x10, .LCPI1_0
39 ; CHECK-NEXT: mov w8, #52429
40 ; CHECK-NEXT: mov w9, #39321
41 ; CHECK-NEXT: ldr q1, [x10, :lo12:.LCPI1_0]
42 ; CHECK-NEXT: movk w8, #52428, lsl #16
43 ; CHECK-NEXT: movk w9, #6553, lsl #16
44 ; CHECK-NEXT: dup v2.4s, w8
45 ; CHECK-NEXT: dup v3.4s, w9
46 ; CHECK-NEXT: mla v3.4s, v0.4s, v2.4s
47 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v3.4s
48 ; CHECK-NEXT: movi v1.4s, #1
49 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
51 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 4294967295, i32 5>
52 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
53 %ret = zext <4 x i1> %cmp to <4 x i32>
56 define <4 x i32> @test_srem_odd_allones_ne(<4 x i32> %X) nounwind {
57 ; CHECK-LABEL: test_srem_odd_allones_ne:
59 ; CHECK-NEXT: adrp x10, .LCPI2_0
60 ; CHECK-NEXT: mov w8, #52429
61 ; CHECK-NEXT: mov w9, #39321
62 ; CHECK-NEXT: ldr q1, [x10, :lo12:.LCPI2_0]
63 ; CHECK-NEXT: movk w8, #52428, lsl #16
64 ; CHECK-NEXT: movk w9, #6553, lsl #16
65 ; CHECK-NEXT: dup v2.4s, w8
66 ; CHECK-NEXT: dup v3.4s, w9
67 ; CHECK-NEXT: mla v3.4s, v0.4s, v2.4s
68 ; CHECK-NEXT: cmhi v0.4s, v3.4s, v1.4s
69 ; CHECK-NEXT: movi v1.4s, #1
70 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
72 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 4294967295, i32 5>
73 %cmp = icmp ne <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
74 %ret = zext <4 x i1> %cmp to <4 x i32>
78 ; One all-ones divisor in even divisor
79 define <4 x i32> @test_srem_even_allones_eq(<4 x i32> %X) nounwind {
80 ; CHECK-LABEL: test_srem_even_allones_eq:
82 ; CHECK-NEXT: mov w8, #28087
83 ; CHECK-NEXT: mov w9, #9362
84 ; CHECK-NEXT: movk w8, #46811, lsl #16
85 ; CHECK-NEXT: movk w9, #4681, lsl #16
86 ; CHECK-NEXT: adrp x10, .LCPI3_0
87 ; CHECK-NEXT: dup v1.4s, w8
88 ; CHECK-NEXT: dup v2.4s, w9
89 ; CHECK-NEXT: ldr q3, [x10, :lo12:.LCPI3_0]
90 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
91 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
92 ; CHECK-NEXT: ushr v1.4s, v2.4s, #1
93 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
94 ; CHECK-NEXT: cmhs v0.4s, v3.4s, v0.4s
95 ; CHECK-NEXT: movi v1.4s, #1
96 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
98 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 4294967295, i32 14>
99 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
100 %ret = zext <4 x i1> %cmp to <4 x i32>
103 define <4 x i32> @test_srem_even_allones_ne(<4 x i32> %X) nounwind {
104 ; CHECK-LABEL: test_srem_even_allones_ne:
106 ; CHECK-NEXT: mov w8, #28087
107 ; CHECK-NEXT: mov w9, #9362
108 ; CHECK-NEXT: movk w8, #46811, lsl #16
109 ; CHECK-NEXT: movk w9, #4681, lsl #16
110 ; CHECK-NEXT: adrp x10, .LCPI4_0
111 ; CHECK-NEXT: dup v1.4s, w8
112 ; CHECK-NEXT: dup v2.4s, w9
113 ; CHECK-NEXT: ldr q3, [x10, :lo12:.LCPI4_0]
114 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
115 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
116 ; CHECK-NEXT: ushr v1.4s, v2.4s, #1
117 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
118 ; CHECK-NEXT: cmhi v0.4s, v0.4s, v3.4s
119 ; CHECK-NEXT: movi v1.4s, #1
120 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
122 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 4294967295, i32 14>
123 %cmp = icmp ne <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
124 %ret = zext <4 x i1> %cmp to <4 x i32>
128 ; One all-ones divisor in odd+even divisor
129 define <4 x i32> @test_srem_odd_even_allones_eq(<4 x i32> %X) nounwind {
130 ; CHECK-LABEL: test_srem_odd_even_allones_eq:
132 ; CHECK-NEXT: adrp x8, .LCPI5_0
133 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI5_0]
134 ; CHECK-NEXT: adrp x8, .LCPI5_1
135 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI5_1]
136 ; CHECK-NEXT: adrp x8, .LCPI5_2
137 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI5_2]
138 ; CHECK-NEXT: adrp x8, .LCPI5_3
139 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
140 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI5_3]
141 ; CHECK-NEXT: adrp x8, .LCPI5_4
142 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI5_4]
143 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
144 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
145 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
146 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
147 ; CHECK-NEXT: movi v1.4s, #1
148 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
150 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 4294967295, i32 100>
151 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
152 %ret = zext <4 x i1> %cmp to <4 x i32>
155 define <4 x i32> @test_srem_odd_even_allones_ne(<4 x i32> %X) nounwind {
156 ; CHECK-LABEL: test_srem_odd_even_allones_ne:
158 ; CHECK-NEXT: adrp x8, .LCPI6_0
159 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI6_0]
160 ; CHECK-NEXT: adrp x8, .LCPI6_1
161 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI6_1]
162 ; CHECK-NEXT: adrp x8, .LCPI6_2
163 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI6_2]
164 ; CHECK-NEXT: adrp x8, .LCPI6_3
165 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
166 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI6_3]
167 ; CHECK-NEXT: adrp x8, .LCPI6_4
168 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI6_4]
169 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
170 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
171 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
172 ; CHECK-NEXT: cmhi v0.4s, v0.4s, v1.4s
173 ; CHECK-NEXT: movi v1.4s, #1
174 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
176 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 4294967295, i32 100>
177 %cmp = icmp ne <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
178 %ret = zext <4 x i1> %cmp to <4 x i32>
182 ;------------------------------------------------------------------------------;
184 ; One power-of-two divisor in odd divisor
185 define <4 x i32> @test_srem_odd_poweroftwo(<4 x i32> %X) nounwind {
186 ; CHECK-LABEL: test_srem_odd_poweroftwo:
188 ; CHECK-NEXT: adrp x8, .LCPI7_0
189 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI7_0]
190 ; CHECK-NEXT: adrp x8, .LCPI7_1
191 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI7_1]
192 ; CHECK-NEXT: adrp x8, .LCPI7_2
193 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI7_2]
194 ; CHECK-NEXT: adrp x8, .LCPI7_3
195 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
196 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI7_3]
197 ; CHECK-NEXT: adrp x8, .LCPI7_4
198 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI7_4]
199 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
200 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
201 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
202 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
203 ; CHECK-NEXT: movi v1.4s, #1
204 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
206 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 16, i32 5>
207 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
208 %ret = zext <4 x i1> %cmp to <4 x i32>
212 ; One power-of-two divisor in even divisor
213 define <4 x i32> @test_srem_even_poweroftwo(<4 x i32> %X) nounwind {
214 ; CHECK-LABEL: test_srem_even_poweroftwo:
216 ; CHECK-NEXT: adrp x8, .LCPI8_0
217 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI8_0]
218 ; CHECK-NEXT: adrp x8, .LCPI8_1
219 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI8_1]
220 ; CHECK-NEXT: adrp x8, .LCPI8_2
221 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI8_2]
222 ; CHECK-NEXT: adrp x8, .LCPI8_3
223 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
224 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI8_3]
225 ; CHECK-NEXT: adrp x8, .LCPI8_4
226 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI8_4]
227 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
228 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
229 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
230 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
231 ; CHECK-NEXT: movi v1.4s, #1
232 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
234 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 16, i32 14>
235 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
236 %ret = zext <4 x i1> %cmp to <4 x i32>
240 ; One power-of-two divisor in odd+even divisor
241 define <4 x i32> @test_srem_odd_even_poweroftwo(<4 x i32> %X) nounwind {
242 ; CHECK-LABEL: test_srem_odd_even_poweroftwo:
244 ; CHECK-NEXT: adrp x8, .LCPI9_0
245 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI9_0]
246 ; CHECK-NEXT: adrp x8, .LCPI9_1
247 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI9_1]
248 ; CHECK-NEXT: adrp x8, .LCPI9_2
249 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI9_2]
250 ; CHECK-NEXT: adrp x8, .LCPI9_3
251 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
252 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI9_3]
253 ; CHECK-NEXT: adrp x8, .LCPI9_4
254 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI9_4]
255 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
256 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
257 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
258 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
259 ; CHECK-NEXT: movi v1.4s, #1
260 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
262 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 16, i32 100>
263 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
264 %ret = zext <4 x i1> %cmp to <4 x i32>
268 ;------------------------------------------------------------------------------;
270 ; One one divisor in odd divisor
271 define <4 x i32> @test_srem_odd_one(<4 x i32> %X) nounwind {
272 ; CHECK-LABEL: test_srem_odd_one:
274 ; CHECK-NEXT: adrp x10, .LCPI10_0
275 ; CHECK-NEXT: mov w8, #52429
276 ; CHECK-NEXT: mov w9, #39321
277 ; CHECK-NEXT: ldr q1, [x10, :lo12:.LCPI10_0]
278 ; CHECK-NEXT: movk w8, #52428, lsl #16
279 ; CHECK-NEXT: movk w9, #6553, lsl #16
280 ; CHECK-NEXT: dup v2.4s, w8
281 ; CHECK-NEXT: dup v3.4s, w9
282 ; CHECK-NEXT: mla v3.4s, v0.4s, v2.4s
283 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v3.4s
284 ; CHECK-NEXT: movi v1.4s, #1
285 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
287 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 1, i32 5>
288 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
289 %ret = zext <4 x i1> %cmp to <4 x i32>
293 ; One one divisor in even divisor
294 define <4 x i32> @test_srem_even_one(<4 x i32> %X) nounwind {
295 ; CHECK-LABEL: test_srem_even_one:
297 ; CHECK-NEXT: mov w8, #28087
298 ; CHECK-NEXT: mov w9, #9362
299 ; CHECK-NEXT: movk w8, #46811, lsl #16
300 ; CHECK-NEXT: movk w9, #4681, lsl #16
301 ; CHECK-NEXT: adrp x10, .LCPI11_0
302 ; CHECK-NEXT: dup v1.4s, w8
303 ; CHECK-NEXT: dup v2.4s, w9
304 ; CHECK-NEXT: ldr q3, [x10, :lo12:.LCPI11_0]
305 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
306 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
307 ; CHECK-NEXT: ushr v1.4s, v2.4s, #1
308 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
309 ; CHECK-NEXT: cmhs v0.4s, v3.4s, v0.4s
310 ; CHECK-NEXT: movi v1.4s, #1
311 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
313 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 1, i32 14>
314 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
315 %ret = zext <4 x i1> %cmp to <4 x i32>
319 ; One one divisor in odd+even divisor
320 define <4 x i32> @test_srem_odd_even_one(<4 x i32> %X) nounwind {
321 ; CHECK-LABEL: test_srem_odd_even_one:
323 ; CHECK-NEXT: adrp x8, .LCPI12_0
324 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI12_0]
325 ; CHECK-NEXT: adrp x8, .LCPI12_1
326 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI12_1]
327 ; CHECK-NEXT: adrp x8, .LCPI12_2
328 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI12_2]
329 ; CHECK-NEXT: adrp x8, .LCPI12_3
330 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
331 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI12_3]
332 ; CHECK-NEXT: adrp x8, .LCPI12_4
333 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI12_4]
334 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
335 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
336 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
337 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
338 ; CHECK-NEXT: movi v1.4s, #1
339 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
341 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 1, i32 100>
342 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
343 %ret = zext <4 x i1> %cmp to <4 x i32>
347 ;------------------------------------------------------------------------------;
349 ; One INT_MIN divisor in odd divisor
350 define <4 x i32> @test_srem_odd_INT_MIN(<4 x i32> %X) nounwind {
351 ; CHECK-LABEL: test_srem_odd_INT_MIN:
353 ; CHECK-NEXT: adrp x8, .LCPI13_0
354 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI13_0]
355 ; CHECK-NEXT: adrp x8, .LCPI13_1
356 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI13_1]
357 ; CHECK-NEXT: adrp x8, .LCPI13_2
358 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI13_2]
359 ; CHECK-NEXT: adrp x8, .LCPI13_3
360 ; CHECK-NEXT: smull2 v4.2d, v0.4s, v1.4s
361 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
362 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v4.4s
363 ; CHECK-NEXT: ldr q4, [x8, :lo12:.LCPI13_3]
364 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
365 ; CHECK-NEXT: sshl v2.4s, v1.4s, v3.4s
366 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
367 ; CHECK-NEXT: mls v0.4s, v2.4s, v4.4s
368 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
369 ; CHECK-NEXT: movi v1.4s, #1
370 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
372 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 2147483648, i32 5>
373 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
374 %ret = zext <4 x i1> %cmp to <4 x i32>
378 ; One INT_MIN divisor in even divisor
379 define <4 x i32> @test_srem_even_INT_MIN(<4 x i32> %X) nounwind {
380 ; CHECK-LABEL: test_srem_even_INT_MIN:
382 ; CHECK-NEXT: adrp x8, .LCPI14_0
383 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI14_0]
384 ; CHECK-NEXT: adrp x8, .LCPI14_1
385 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI14_1]
386 ; CHECK-NEXT: adrp x8, .LCPI14_2
387 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI14_2]
388 ; CHECK-NEXT: adrp x8, .LCPI14_3
389 ; CHECK-NEXT: smull2 v4.2d, v0.4s, v1.4s
390 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
391 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v4.4s
392 ; CHECK-NEXT: ldr q4, [x8, :lo12:.LCPI14_3]
393 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
394 ; CHECK-NEXT: sshl v2.4s, v1.4s, v3.4s
395 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
396 ; CHECK-NEXT: mls v0.4s, v2.4s, v4.4s
397 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
398 ; CHECK-NEXT: movi v1.4s, #1
399 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
401 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 2147483648, i32 14>
402 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
403 %ret = zext <4 x i1> %cmp to <4 x i32>
407 ; One INT_MIN divisor in odd+even divisor
408 define <4 x i32> @test_srem_odd_even_INT_MIN(<4 x i32> %X) nounwind {
409 ; CHECK-LABEL: test_srem_odd_even_INT_MIN:
411 ; CHECK-NEXT: adrp x8, .LCPI15_0
412 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI15_0]
413 ; CHECK-NEXT: adrp x8, .LCPI15_1
414 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI15_1]
415 ; CHECK-NEXT: adrp x8, .LCPI15_2
416 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI15_2]
417 ; CHECK-NEXT: adrp x8, .LCPI15_3
418 ; CHECK-NEXT: smull2 v4.2d, v0.4s, v1.4s
419 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
420 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v4.4s
421 ; CHECK-NEXT: ldr q4, [x8, :lo12:.LCPI15_3]
422 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
423 ; CHECK-NEXT: sshl v2.4s, v1.4s, v3.4s
424 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
425 ; CHECK-NEXT: mls v0.4s, v2.4s, v4.4s
426 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
427 ; CHECK-NEXT: movi v1.4s, #1
428 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
430 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 2147483648, i32 100>
431 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
432 %ret = zext <4 x i1> %cmp to <4 x i32>
436 ;==============================================================================;
438 ; One all-ones divisor and power-of-two divisor divisor in odd divisor
439 define <4 x i32> @test_srem_odd_allones_and_poweroftwo(<4 x i32> %X) nounwind {
440 ; CHECK-LABEL: test_srem_odd_allones_and_poweroftwo:
442 ; CHECK-NEXT: adrp x8, .LCPI16_0
443 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_0]
444 ; CHECK-NEXT: adrp x8, .LCPI16_1
445 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI16_1]
446 ; CHECK-NEXT: adrp x8, .LCPI16_2
447 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI16_2]
448 ; CHECK-NEXT: adrp x8, .LCPI16_3
449 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
450 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI16_3]
451 ; CHECK-NEXT: adrp x8, .LCPI16_4
452 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_4]
453 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
454 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
455 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
456 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
457 ; CHECK-NEXT: movi v1.4s, #1
458 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
460 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 5>
461 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
462 %ret = zext <4 x i1> %cmp to <4 x i32>
466 ; One all-ones divisor and power-of-two divisor divisor in even divisor
467 define <4 x i32> @test_srem_even_allones_and_poweroftwo(<4 x i32> %X) nounwind {
468 ; CHECK-LABEL: test_srem_even_allones_and_poweroftwo:
470 ; CHECK-NEXT: adrp x8, .LCPI17_0
471 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_0]
472 ; CHECK-NEXT: adrp x8, .LCPI17_1
473 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI17_1]
474 ; CHECK-NEXT: adrp x8, .LCPI17_2
475 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI17_2]
476 ; CHECK-NEXT: adrp x8, .LCPI17_3
477 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
478 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI17_3]
479 ; CHECK-NEXT: adrp x8, .LCPI17_4
480 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_4]
481 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
482 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
483 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
484 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
485 ; CHECK-NEXT: movi v1.4s, #1
486 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
488 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 16, i32 14>
489 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
490 %ret = zext <4 x i1> %cmp to <4 x i32>
494 ; One all-ones divisor and power-of-two divisor divisor in odd+even divisor
495 define <4 x i32> @test_srem_odd_even_allones_and_poweroftwo(<4 x i32> %X) nounwind {
496 ; CHECK-LABEL: test_srem_odd_even_allones_and_poweroftwo:
498 ; CHECK-NEXT: adrp x8, .LCPI18_0
499 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI18_0]
500 ; CHECK-NEXT: adrp x8, .LCPI18_1
501 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI18_1]
502 ; CHECK-NEXT: adrp x8, .LCPI18_2
503 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI18_2]
504 ; CHECK-NEXT: adrp x8, .LCPI18_3
505 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
506 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI18_3]
507 ; CHECK-NEXT: adrp x8, .LCPI18_4
508 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI18_4]
509 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
510 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
511 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
512 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
513 ; CHECK-NEXT: movi v1.4s, #1
514 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
516 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 100>
517 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
518 %ret = zext <4 x i1> %cmp to <4 x i32>
522 ;------------------------------------------------------------------------------;
524 ; One all-ones divisor and one one divisor in odd divisor
525 define <4 x i32> @test_srem_odd_allones_and_one(<4 x i32> %X) nounwind {
526 ; CHECK-LABEL: test_srem_odd_allones_and_one:
528 ; CHECK-NEXT: adrp x10, .LCPI19_0
529 ; CHECK-NEXT: mov w8, #52429
530 ; CHECK-NEXT: mov w9, #39321
531 ; CHECK-NEXT: ldr q1, [x10, :lo12:.LCPI19_0]
532 ; CHECK-NEXT: movk w8, #52428, lsl #16
533 ; CHECK-NEXT: movk w9, #6553, lsl #16
534 ; CHECK-NEXT: dup v2.4s, w8
535 ; CHECK-NEXT: dup v3.4s, w9
536 ; CHECK-NEXT: mla v3.4s, v0.4s, v2.4s
537 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v3.4s
538 ; CHECK-NEXT: movi v1.4s, #1
539 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
541 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 1, i32 5>
542 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
543 %ret = zext <4 x i1> %cmp to <4 x i32>
547 ; One all-ones divisor and one one divisor in even divisor
548 define <4 x i32> @test_srem_even_allones_and_one(<4 x i32> %X) nounwind {
549 ; CHECK-LABEL: test_srem_even_allones_and_one:
551 ; CHECK-NEXT: mov w8, #28087
552 ; CHECK-NEXT: mov w9, #9362
553 ; CHECK-NEXT: movk w8, #46811, lsl #16
554 ; CHECK-NEXT: movk w9, #4681, lsl #16
555 ; CHECK-NEXT: adrp x10, .LCPI20_0
556 ; CHECK-NEXT: dup v1.4s, w8
557 ; CHECK-NEXT: dup v2.4s, w9
558 ; CHECK-NEXT: ldr q3, [x10, :lo12:.LCPI20_0]
559 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
560 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
561 ; CHECK-NEXT: ushr v1.4s, v2.4s, #1
562 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
563 ; CHECK-NEXT: cmhs v0.4s, v3.4s, v0.4s
564 ; CHECK-NEXT: movi v1.4s, #1
565 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
567 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 1, i32 14>
568 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
569 %ret = zext <4 x i1> %cmp to <4 x i32>
573 ; One all-ones divisor and one one divisor in odd+even divisor
574 define <4 x i32> @test_srem_odd_even_allones_and_one(<4 x i32> %X) nounwind {
575 ; CHECK-LABEL: test_srem_odd_even_allones_and_one:
577 ; CHECK-NEXT: adrp x8, .LCPI21_0
578 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI21_0]
579 ; CHECK-NEXT: adrp x8, .LCPI21_1
580 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI21_1]
581 ; CHECK-NEXT: adrp x8, .LCPI21_2
582 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI21_2]
583 ; CHECK-NEXT: adrp x8, .LCPI21_3
584 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
585 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI21_3]
586 ; CHECK-NEXT: adrp x8, .LCPI21_4
587 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI21_4]
588 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
589 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
590 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
591 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
592 ; CHECK-NEXT: movi v1.4s, #1
593 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
595 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 1, i32 100>
596 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
597 %ret = zext <4 x i1> %cmp to <4 x i32>
601 ;------------------------------------------------------------------------------;
603 ; One power-of-two divisor divisor and one divisor in odd divisor
604 define <4 x i32> @test_srem_odd_poweroftwo_and_one(<4 x i32> %X) nounwind {
605 ; CHECK-LABEL: test_srem_odd_poweroftwo_and_one:
607 ; CHECK-NEXT: adrp x8, .LCPI22_0
608 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI22_0]
609 ; CHECK-NEXT: adrp x8, .LCPI22_1
610 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI22_1]
611 ; CHECK-NEXT: adrp x8, .LCPI22_2
612 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI22_2]
613 ; CHECK-NEXT: adrp x8, .LCPI22_3
614 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
615 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI22_3]
616 ; CHECK-NEXT: adrp x8, .LCPI22_4
617 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI22_4]
618 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
619 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
620 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
621 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
622 ; CHECK-NEXT: movi v1.4s, #1
623 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
625 %srem = srem <4 x i32> %X, <i32 5, i32 16, i32 1, i32 5>
626 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
627 %ret = zext <4 x i1> %cmp to <4 x i32>
631 ; One power-of-two divisor divisor and one divisor in even divisor
632 define <4 x i32> @test_srem_even_poweroftwo_and_one(<4 x i32> %X) nounwind {
633 ; CHECK-LABEL: test_srem_even_poweroftwo_and_one:
635 ; CHECK-NEXT: adrp x8, .LCPI23_0
636 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI23_0]
637 ; CHECK-NEXT: adrp x8, .LCPI23_1
638 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI23_1]
639 ; CHECK-NEXT: adrp x8, .LCPI23_2
640 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI23_2]
641 ; CHECK-NEXT: adrp x8, .LCPI23_3
642 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
643 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI23_3]
644 ; CHECK-NEXT: adrp x8, .LCPI23_4
645 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI23_4]
646 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
647 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
648 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
649 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
650 ; CHECK-NEXT: movi v1.4s, #1
651 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
653 %srem = srem <4 x i32> %X, <i32 14, i32 16, i32 1, i32 14>
654 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
655 %ret = zext <4 x i1> %cmp to <4 x i32>
659 ; One power-of-two divisor divisor and one divisor in odd+even divisor
660 define <4 x i32> @test_srem_odd_even_poweroftwo_and_one(<4 x i32> %X) nounwind {
661 ; CHECK-LABEL: test_srem_odd_even_poweroftwo_and_one:
663 ; CHECK-NEXT: adrp x8, .LCPI24_0
664 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI24_0]
665 ; CHECK-NEXT: adrp x8, .LCPI24_1
666 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI24_1]
667 ; CHECK-NEXT: adrp x8, .LCPI24_2
668 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI24_2]
669 ; CHECK-NEXT: adrp x8, .LCPI24_3
670 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
671 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI24_3]
672 ; CHECK-NEXT: adrp x8, .LCPI24_4
673 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI24_4]
674 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
675 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
676 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
677 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
678 ; CHECK-NEXT: movi v1.4s, #1
679 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
681 %srem = srem <4 x i32> %X, <i32 5, i32 16, i32 1, i32 100>
682 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
683 %ret = zext <4 x i1> %cmp to <4 x i32>
687 ;------------------------------------------------------------------------------;
689 define <4 x i32> @test_srem_odd_allones_and_poweroftwo_and_one(<4 x i32> %X) nounwind {
690 ; CHECK-LABEL: test_srem_odd_allones_and_poweroftwo_and_one:
692 ; CHECK-NEXT: adrp x8, .LCPI25_0
693 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI25_0]
694 ; CHECK-NEXT: adrp x8, .LCPI25_1
695 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI25_1]
696 ; CHECK-NEXT: adrp x8, .LCPI25_2
697 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI25_2]
698 ; CHECK-NEXT: adrp x8, .LCPI25_3
699 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
700 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI25_3]
701 ; CHECK-NEXT: adrp x8, .LCPI25_4
702 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI25_4]
703 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
704 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
705 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
706 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
707 ; CHECK-NEXT: movi v1.4s, #1
708 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
710 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 1>
711 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
712 %ret = zext <4 x i1> %cmp to <4 x i32>
716 define <4 x i32> @test_srem_even_allones_and_poweroftwo_and_one(<4 x i32> %X) nounwind {
717 ; CHECK-LABEL: test_srem_even_allones_and_poweroftwo_and_one:
719 ; CHECK-NEXT: adrp x8, .LCPI26_0
720 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI26_0]
721 ; CHECK-NEXT: adrp x8, .LCPI26_1
722 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI26_1]
723 ; CHECK-NEXT: adrp x8, .LCPI26_2
724 ; CHECK-NEXT: ldr q3, [x8, :lo12:.LCPI26_2]
725 ; CHECK-NEXT: adrp x8, .LCPI26_3
726 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
727 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI26_3]
728 ; CHECK-NEXT: adrp x8, .LCPI26_4
729 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI26_4]
730 ; CHECK-NEXT: ushl v3.4s, v2.4s, v3.4s
731 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
732 ; CHECK-NEXT: orr v0.16b, v0.16b, v3.16b
733 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
734 ; CHECK-NEXT: movi v1.4s, #1
735 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
737 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 16, i32 1>
738 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
739 %ret = zext <4 x i1> %cmp to <4 x i32>