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: adrp x9, .LCPI0_1
10 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI0_0]
11 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI0_1]
12 ; CHECK-NEXT: adrp x8, .LCPI0_2
13 ; CHECK-NEXT: adrp x9, .LCPI0_3
14 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
15 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI0_2]
16 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI0_3]
17 ; CHECK-NEXT: adrp x8, .LCPI0_4
18 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
19 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
20 ; CHECK-NEXT: movi v2.4s, #1
21 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
22 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI0_4]
23 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
24 ; CHECK-NEXT: and v0.16b, v0.16b, v2.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: mov w8, #52429 // =0xcccd
39 ; CHECK-NEXT: mov w9, #39321 // =0x9999
40 ; CHECK-NEXT: movk w8, #52428, lsl #16
41 ; CHECK-NEXT: movk w9, #6553, lsl #16
42 ; CHECK-NEXT: dup v1.4s, w8
43 ; CHECK-NEXT: dup v2.4s, w9
44 ; CHECK-NEXT: adrp x8, .LCPI1_0
45 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
46 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI1_0]
47 ; CHECK-NEXT: movi v1.4s, #1
48 ; CHECK-NEXT: cmhs v0.4s, v0.4s, v2.4s
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: mov w8, #52429 // =0xcccd
60 ; CHECK-NEXT: mov w9, #39321 // =0x9999
61 ; CHECK-NEXT: movk w8, #52428, lsl #16
62 ; CHECK-NEXT: movk w9, #6553, lsl #16
63 ; CHECK-NEXT: dup v1.4s, w8
64 ; CHECK-NEXT: dup v2.4s, w9
65 ; CHECK-NEXT: adrp x8, .LCPI2_0
66 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
67 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI2_0]
68 ; CHECK-NEXT: movi v1.4s, #1
69 ; CHECK-NEXT: cmhi v0.4s, v2.4s, v0.4s
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 // =0x6db7
83 ; CHECK-NEXT: mov w9, #9362 // =0x2492
84 ; CHECK-NEXT: movk w8, #46811, lsl #16
85 ; CHECK-NEXT: movk w9, #4681, lsl #16
86 ; CHECK-NEXT: dup v1.4s, w8
87 ; CHECK-NEXT: dup v2.4s, w9
88 ; CHECK-NEXT: adrp x8, .LCPI3_0
89 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
90 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI3_0]
91 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
92 ; CHECK-NEXT: usra v0.4s, v2.4s, #1
93 ; CHECK-NEXT: movi v2.4s, #1
94 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
95 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
97 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 4294967295, i32 14>
98 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
99 %ret = zext <4 x i1> %cmp to <4 x i32>
102 define <4 x i32> @test_srem_even_allones_ne(<4 x i32> %X) nounwind {
103 ; CHECK-LABEL: test_srem_even_allones_ne:
105 ; CHECK-NEXT: mov w8, #28087 // =0x6db7
106 ; CHECK-NEXT: mov w9, #9362 // =0x2492
107 ; CHECK-NEXT: movk w8, #46811, lsl #16
108 ; CHECK-NEXT: movk w9, #4681, lsl #16
109 ; CHECK-NEXT: dup v1.4s, w8
110 ; CHECK-NEXT: dup v2.4s, w9
111 ; CHECK-NEXT: adrp x8, .LCPI4_0
112 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
113 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI4_0]
114 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
115 ; CHECK-NEXT: usra v0.4s, v2.4s, #1
116 ; CHECK-NEXT: movi v2.4s, #1
117 ; CHECK-NEXT: cmhi v0.4s, v0.4s, v1.4s
118 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
120 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 4294967295, i32 14>
121 %cmp = icmp ne <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
122 %ret = zext <4 x i1> %cmp to <4 x i32>
126 ; One all-ones divisor in odd+even divisor
127 define <4 x i32> @test_srem_odd_even_allones_eq(<4 x i32> %X) nounwind {
128 ; CHECK-LABEL: test_srem_odd_even_allones_eq:
130 ; CHECK-NEXT: adrp x8, .LCPI5_0
131 ; CHECK-NEXT: adrp x9, .LCPI5_1
132 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI5_0]
133 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI5_1]
134 ; CHECK-NEXT: adrp x8, .LCPI5_2
135 ; CHECK-NEXT: adrp x9, .LCPI5_3
136 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
137 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI5_2]
138 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI5_3]
139 ; CHECK-NEXT: adrp x8, .LCPI5_4
140 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
141 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
142 ; CHECK-NEXT: movi v2.4s, #1
143 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
144 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI5_4]
145 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
146 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
148 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 4294967295, i32 100>
149 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
150 %ret = zext <4 x i1> %cmp to <4 x i32>
153 define <4 x i32> @test_srem_odd_even_allones_ne(<4 x i32> %X) nounwind {
154 ; CHECK-LABEL: test_srem_odd_even_allones_ne:
156 ; CHECK-NEXT: adrp x8, .LCPI6_0
157 ; CHECK-NEXT: adrp x9, .LCPI6_1
158 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI6_0]
159 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI6_1]
160 ; CHECK-NEXT: adrp x8, .LCPI6_2
161 ; CHECK-NEXT: adrp x9, .LCPI6_3
162 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
163 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI6_2]
164 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI6_3]
165 ; CHECK-NEXT: adrp x8, .LCPI6_4
166 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
167 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
168 ; CHECK-NEXT: movi v2.4s, #1
169 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
170 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI6_4]
171 ; CHECK-NEXT: cmhi v0.4s, v0.4s, v1.4s
172 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
174 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 4294967295, i32 100>
175 %cmp = icmp ne <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
176 %ret = zext <4 x i1> %cmp to <4 x i32>
180 ;------------------------------------------------------------------------------;
182 ; One power-of-two divisor in odd divisor
183 define <4 x i32> @test_srem_odd_poweroftwo(<4 x i32> %X) nounwind {
184 ; CHECK-LABEL: test_srem_odd_poweroftwo:
186 ; CHECK-NEXT: adrp x8, .LCPI7_0
187 ; CHECK-NEXT: adrp x9, .LCPI7_1
188 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI7_0]
189 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI7_1]
190 ; CHECK-NEXT: adrp x8, .LCPI7_2
191 ; CHECK-NEXT: adrp x9, .LCPI7_3
192 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
193 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI7_2]
194 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI7_3]
195 ; CHECK-NEXT: adrp x8, .LCPI7_4
196 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
197 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
198 ; CHECK-NEXT: movi v2.4s, #1
199 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
200 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI7_4]
201 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
202 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
204 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 16, i32 5>
205 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
206 %ret = zext <4 x i1> %cmp to <4 x i32>
210 ; One power-of-two divisor in even divisor
211 define <4 x i32> @test_srem_even_poweroftwo(<4 x i32> %X) nounwind {
212 ; CHECK-LABEL: test_srem_even_poweroftwo:
214 ; CHECK-NEXT: adrp x8, .LCPI8_0
215 ; CHECK-NEXT: adrp x9, .LCPI8_1
216 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI8_0]
217 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI8_1]
218 ; CHECK-NEXT: adrp x8, .LCPI8_2
219 ; CHECK-NEXT: adrp x9, .LCPI8_3
220 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
221 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI8_2]
222 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI8_3]
223 ; CHECK-NEXT: adrp x8, .LCPI8_4
224 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
225 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
226 ; CHECK-NEXT: movi v2.4s, #1
227 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
228 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI8_4]
229 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
230 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
232 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 16, i32 14>
233 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
234 %ret = zext <4 x i1> %cmp to <4 x i32>
238 ; One power-of-two divisor in odd+even divisor
239 define <4 x i32> @test_srem_odd_even_poweroftwo(<4 x i32> %X) nounwind {
240 ; CHECK-LABEL: test_srem_odd_even_poweroftwo:
242 ; CHECK-NEXT: adrp x8, .LCPI9_0
243 ; CHECK-NEXT: adrp x9, .LCPI9_1
244 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI9_0]
245 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI9_1]
246 ; CHECK-NEXT: adrp x8, .LCPI9_2
247 ; CHECK-NEXT: adrp x9, .LCPI9_3
248 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
249 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI9_2]
250 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI9_3]
251 ; CHECK-NEXT: adrp x8, .LCPI9_4
252 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
253 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
254 ; CHECK-NEXT: movi v2.4s, #1
255 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
256 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI9_4]
257 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
258 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
260 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 16, i32 100>
261 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
262 %ret = zext <4 x i1> %cmp to <4 x i32>
266 ;------------------------------------------------------------------------------;
268 ; One one divisor in odd divisor
269 define <4 x i32> @test_srem_odd_one(<4 x i32> %X) nounwind {
270 ; CHECK-LABEL: test_srem_odd_one:
272 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
273 ; CHECK-NEXT: mov w9, #39321 // =0x9999
274 ; CHECK-NEXT: movk w8, #52428, lsl #16
275 ; CHECK-NEXT: movk w9, #6553, lsl #16
276 ; CHECK-NEXT: dup v1.4s, w8
277 ; CHECK-NEXT: dup v2.4s, w9
278 ; CHECK-NEXT: adrp x8, .LCPI10_0
279 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
280 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI10_0]
281 ; CHECK-NEXT: movi v1.4s, #1
282 ; CHECK-NEXT: cmhs v0.4s, v0.4s, v2.4s
283 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
285 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 1, i32 5>
286 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
287 %ret = zext <4 x i1> %cmp to <4 x i32>
291 ; One one divisor in even divisor
292 define <4 x i32> @test_srem_even_one(<4 x i32> %X) nounwind {
293 ; CHECK-LABEL: test_srem_even_one:
295 ; CHECK-NEXT: mov w8, #28087 // =0x6db7
296 ; CHECK-NEXT: mov w9, #9362 // =0x2492
297 ; CHECK-NEXT: movk w8, #46811, lsl #16
298 ; CHECK-NEXT: movk w9, #4681, lsl #16
299 ; CHECK-NEXT: dup v1.4s, w8
300 ; CHECK-NEXT: dup v2.4s, w9
301 ; CHECK-NEXT: adrp x8, .LCPI11_0
302 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
303 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI11_0]
304 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
305 ; CHECK-NEXT: usra v0.4s, v2.4s, #1
306 ; CHECK-NEXT: movi v2.4s, #1
307 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
308 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
310 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 1, i32 14>
311 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
312 %ret = zext <4 x i1> %cmp to <4 x i32>
316 ; One one divisor in odd+even divisor
317 define <4 x i32> @test_srem_odd_even_one(<4 x i32> %X) nounwind {
318 ; CHECK-LABEL: test_srem_odd_even_one:
320 ; CHECK-NEXT: adrp x8, .LCPI12_0
321 ; CHECK-NEXT: adrp x9, .LCPI12_1
322 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI12_0]
323 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI12_1]
324 ; CHECK-NEXT: adrp x8, .LCPI12_2
325 ; CHECK-NEXT: adrp x9, .LCPI12_3
326 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
327 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI12_2]
328 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI12_3]
329 ; CHECK-NEXT: adrp x8, .LCPI12_4
330 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
331 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
332 ; CHECK-NEXT: movi v2.4s, #1
333 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
334 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI12_4]
335 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
336 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
338 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 1, i32 100>
339 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
340 %ret = zext <4 x i1> %cmp to <4 x i32>
344 ;------------------------------------------------------------------------------;
346 ; One INT_MIN divisor in odd divisor
347 define <4 x i32> @test_srem_odd_INT_MIN(<4 x i32> %X) nounwind {
348 ; CHECK-LABEL: test_srem_odd_INT_MIN:
350 ; CHECK-NEXT: adrp x8, .LCPI13_0
351 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI13_0]
352 ; CHECK-NEXT: adrp x8, .LCPI13_1
353 ; CHECK-NEXT: smull2 v2.2d, v0.4s, v1.4s
354 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
355 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v2.4s
356 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI13_1]
357 ; CHECK-NEXT: adrp x8, .LCPI13_2
358 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
359 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI13_2]
360 ; CHECK-NEXT: adrp x8, .LCPI13_3
361 ; CHECK-NEXT: sshl v2.4s, v1.4s, v2.4s
362 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
363 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI13_3]
364 ; CHECK-NEXT: mls v0.4s, v2.4s, v1.4s
365 ; CHECK-NEXT: movi v1.4s, #1
366 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
367 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
369 %srem = srem <4 x i32> %X, <i32 5, i32 5, i32 2147483648, i32 5>
370 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
371 %ret = zext <4 x i1> %cmp to <4 x i32>
375 ; One INT_MIN divisor in even divisor
376 define <4 x i32> @test_srem_even_INT_MIN(<4 x i32> %X) nounwind {
377 ; CHECK-LABEL: test_srem_even_INT_MIN:
379 ; CHECK-NEXT: adrp x8, .LCPI14_0
380 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI14_0]
381 ; CHECK-NEXT: adrp x8, .LCPI14_1
382 ; CHECK-NEXT: smull2 v2.2d, v0.4s, v1.4s
383 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
384 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v2.4s
385 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI14_1]
386 ; CHECK-NEXT: adrp x8, .LCPI14_2
387 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
388 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI14_2]
389 ; CHECK-NEXT: adrp x8, .LCPI14_3
390 ; CHECK-NEXT: sshl v2.4s, v1.4s, v2.4s
391 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
392 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI14_3]
393 ; CHECK-NEXT: mls v0.4s, v2.4s, v1.4s
394 ; CHECK-NEXT: movi v1.4s, #1
395 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
396 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
398 %srem = srem <4 x i32> %X, <i32 14, i32 14, i32 2147483648, i32 14>
399 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
400 %ret = zext <4 x i1> %cmp to <4 x i32>
404 ; One INT_MIN divisor in odd+even divisor
405 define <4 x i32> @test_srem_odd_even_INT_MIN(<4 x i32> %X) nounwind {
406 ; CHECK-LABEL: test_srem_odd_even_INT_MIN:
408 ; CHECK-NEXT: adrp x8, .LCPI15_0
409 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI15_0]
410 ; CHECK-NEXT: adrp x8, .LCPI15_1
411 ; CHECK-NEXT: smull2 v2.2d, v0.4s, v1.4s
412 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
413 ; CHECK-NEXT: uzp2 v1.4s, v1.4s, v2.4s
414 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI15_1]
415 ; CHECK-NEXT: adrp x8, .LCPI15_2
416 ; CHECK-NEXT: mla v1.4s, v0.4s, v2.4s
417 ; CHECK-NEXT: ldr q2, [x8, :lo12:.LCPI15_2]
418 ; CHECK-NEXT: adrp x8, .LCPI15_3
419 ; CHECK-NEXT: sshl v2.4s, v1.4s, v2.4s
420 ; CHECK-NEXT: usra v2.4s, v1.4s, #31
421 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI15_3]
422 ; CHECK-NEXT: mls v0.4s, v2.4s, v1.4s
423 ; CHECK-NEXT: movi v1.4s, #1
424 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
425 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
427 %srem = srem <4 x i32> %X, <i32 5, i32 14, i32 2147483648, i32 100>
428 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
429 %ret = zext <4 x i1> %cmp to <4 x i32>
433 ;==============================================================================;
435 ; One all-ones divisor and power-of-two divisor divisor in odd divisor
436 define <4 x i32> @test_srem_odd_allones_and_poweroftwo(<4 x i32> %X) nounwind {
437 ; CHECK-LABEL: test_srem_odd_allones_and_poweroftwo:
439 ; CHECK-NEXT: adrp x8, .LCPI16_0
440 ; CHECK-NEXT: adrp x9, .LCPI16_1
441 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_0]
442 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI16_1]
443 ; CHECK-NEXT: adrp x8, .LCPI16_2
444 ; CHECK-NEXT: adrp x9, .LCPI16_3
445 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
446 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI16_2]
447 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI16_3]
448 ; CHECK-NEXT: adrp x8, .LCPI16_4
449 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
450 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
451 ; CHECK-NEXT: movi v2.4s, #1
452 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
453 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_4]
454 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
455 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
457 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 5>
458 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
459 %ret = zext <4 x i1> %cmp to <4 x i32>
463 ; One all-ones divisor and power-of-two divisor divisor in even divisor
464 define <4 x i32> @test_srem_even_allones_and_poweroftwo(<4 x i32> %X) nounwind {
465 ; CHECK-LABEL: test_srem_even_allones_and_poweroftwo:
467 ; CHECK-NEXT: adrp x8, .LCPI17_0
468 ; CHECK-NEXT: adrp x9, .LCPI17_1
469 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_0]
470 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI17_1]
471 ; CHECK-NEXT: adrp x8, .LCPI17_2
472 ; CHECK-NEXT: adrp x9, .LCPI17_3
473 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
474 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI17_2]
475 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI17_3]
476 ; CHECK-NEXT: adrp x8, .LCPI17_4
477 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
478 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
479 ; CHECK-NEXT: movi v2.4s, #1
480 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
481 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_4]
482 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
483 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
485 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 16, i32 14>
486 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
487 %ret = zext <4 x i1> %cmp to <4 x i32>
491 ; One all-ones divisor and power-of-two divisor divisor in odd+even divisor
492 define <4 x i32> @test_srem_odd_even_allones_and_poweroftwo(<4 x i32> %X) nounwind {
493 ; CHECK-LABEL: test_srem_odd_even_allones_and_poweroftwo:
495 ; CHECK-NEXT: adrp x8, .LCPI18_0
496 ; CHECK-NEXT: adrp x9, .LCPI18_1
497 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI18_0]
498 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI18_1]
499 ; CHECK-NEXT: adrp x8, .LCPI18_2
500 ; CHECK-NEXT: adrp x9, .LCPI18_3
501 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
502 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI18_2]
503 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI18_3]
504 ; CHECK-NEXT: adrp x8, .LCPI18_4
505 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
506 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
507 ; CHECK-NEXT: movi v2.4s, #1
508 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
509 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI18_4]
510 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
511 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
513 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 100>
514 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
515 %ret = zext <4 x i1> %cmp to <4 x i32>
519 ;------------------------------------------------------------------------------;
521 ; One all-ones divisor and one one divisor in odd divisor
522 define <4 x i32> @test_srem_odd_allones_and_one(<4 x i32> %X) nounwind {
523 ; CHECK-LABEL: test_srem_odd_allones_and_one:
525 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
526 ; CHECK-NEXT: mov w9, #39321 // =0x9999
527 ; CHECK-NEXT: movk w8, #52428, lsl #16
528 ; CHECK-NEXT: movk w9, #6553, lsl #16
529 ; CHECK-NEXT: dup v1.4s, w8
530 ; CHECK-NEXT: dup v2.4s, w9
531 ; CHECK-NEXT: adrp x8, .LCPI19_0
532 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
533 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI19_0]
534 ; CHECK-NEXT: movi v1.4s, #1
535 ; CHECK-NEXT: cmhs v0.4s, v0.4s, v2.4s
536 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
538 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 1, i32 5>
539 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
540 %ret = zext <4 x i1> %cmp to <4 x i32>
544 ; One all-ones divisor and one one divisor in even divisor
545 define <4 x i32> @test_srem_even_allones_and_one(<4 x i32> %X) nounwind {
546 ; CHECK-LABEL: test_srem_even_allones_and_one:
548 ; CHECK-NEXT: mov w8, #28087 // =0x6db7
549 ; CHECK-NEXT: mov w9, #9362 // =0x2492
550 ; CHECK-NEXT: movk w8, #46811, lsl #16
551 ; CHECK-NEXT: movk w9, #4681, lsl #16
552 ; CHECK-NEXT: dup v1.4s, w8
553 ; CHECK-NEXT: dup v2.4s, w9
554 ; CHECK-NEXT: adrp x8, .LCPI20_0
555 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
556 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI20_0]
557 ; CHECK-NEXT: shl v0.4s, v2.4s, #31
558 ; CHECK-NEXT: usra v0.4s, v2.4s, #1
559 ; CHECK-NEXT: movi v2.4s, #1
560 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
561 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
563 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 1, i32 14>
564 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
565 %ret = zext <4 x i1> %cmp to <4 x i32>
569 ; One all-ones divisor and one one divisor in odd+even divisor
570 define <4 x i32> @test_srem_odd_even_allones_and_one(<4 x i32> %X) nounwind {
571 ; CHECK-LABEL: test_srem_odd_even_allones_and_one:
573 ; CHECK-NEXT: adrp x8, .LCPI21_0
574 ; CHECK-NEXT: adrp x9, .LCPI21_1
575 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI21_0]
576 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI21_1]
577 ; CHECK-NEXT: adrp x8, .LCPI21_2
578 ; CHECK-NEXT: adrp x9, .LCPI21_3
579 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
580 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI21_2]
581 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI21_3]
582 ; CHECK-NEXT: adrp x8, .LCPI21_4
583 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
584 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
585 ; CHECK-NEXT: movi v2.4s, #1
586 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
587 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI21_4]
588 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
589 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
591 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 1, i32 100>
592 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
593 %ret = zext <4 x i1> %cmp to <4 x i32>
597 ;------------------------------------------------------------------------------;
599 ; One power-of-two divisor divisor and one divisor in odd divisor
600 define <4 x i32> @test_srem_odd_poweroftwo_and_one(<4 x i32> %X) nounwind {
601 ; CHECK-LABEL: test_srem_odd_poweroftwo_and_one:
603 ; CHECK-NEXT: adrp x8, .LCPI22_0
604 ; CHECK-NEXT: adrp x9, .LCPI22_1
605 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI22_0]
606 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI22_1]
607 ; CHECK-NEXT: adrp x8, .LCPI22_2
608 ; CHECK-NEXT: adrp x9, .LCPI22_3
609 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
610 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI22_2]
611 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI22_3]
612 ; CHECK-NEXT: adrp x8, .LCPI22_4
613 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
614 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
615 ; CHECK-NEXT: movi v2.4s, #1
616 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
617 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI22_4]
618 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
619 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
621 %srem = srem <4 x i32> %X, <i32 5, i32 16, i32 1, i32 5>
622 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
623 %ret = zext <4 x i1> %cmp to <4 x i32>
627 ; One power-of-two divisor divisor and one divisor in even divisor
628 define <4 x i32> @test_srem_even_poweroftwo_and_one(<4 x i32> %X) nounwind {
629 ; CHECK-LABEL: test_srem_even_poweroftwo_and_one:
631 ; CHECK-NEXT: adrp x8, .LCPI23_0
632 ; CHECK-NEXT: adrp x9, .LCPI23_1
633 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI23_0]
634 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI23_1]
635 ; CHECK-NEXT: adrp x8, .LCPI23_2
636 ; CHECK-NEXT: adrp x9, .LCPI23_3
637 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
638 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI23_2]
639 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI23_3]
640 ; CHECK-NEXT: adrp x8, .LCPI23_4
641 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
642 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
643 ; CHECK-NEXT: movi v2.4s, #1
644 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
645 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI23_4]
646 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
647 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
649 %srem = srem <4 x i32> %X, <i32 14, i32 16, i32 1, i32 14>
650 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
651 %ret = zext <4 x i1> %cmp to <4 x i32>
655 ; One power-of-two divisor divisor and one divisor in odd+even divisor
656 define <4 x i32> @test_srem_odd_even_poweroftwo_and_one(<4 x i32> %X) nounwind {
657 ; CHECK-LABEL: test_srem_odd_even_poweroftwo_and_one:
659 ; CHECK-NEXT: adrp x8, .LCPI24_0
660 ; CHECK-NEXT: adrp x9, .LCPI24_1
661 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI24_0]
662 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI24_1]
663 ; CHECK-NEXT: adrp x8, .LCPI24_2
664 ; CHECK-NEXT: adrp x9, .LCPI24_3
665 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
666 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI24_2]
667 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI24_3]
668 ; CHECK-NEXT: adrp x8, .LCPI24_4
669 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
670 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
671 ; CHECK-NEXT: movi v2.4s, #1
672 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
673 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI24_4]
674 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
675 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
677 %srem = srem <4 x i32> %X, <i32 5, i32 16, i32 1, i32 100>
678 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
679 %ret = zext <4 x i1> %cmp to <4 x i32>
683 ;------------------------------------------------------------------------------;
685 define <4 x i32> @test_srem_odd_allones_and_poweroftwo_and_one(<4 x i32> %X) nounwind {
686 ; CHECK-LABEL: test_srem_odd_allones_and_poweroftwo_and_one:
688 ; CHECK-NEXT: adrp x8, .LCPI25_0
689 ; CHECK-NEXT: adrp x9, .LCPI25_1
690 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI25_0]
691 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI25_1]
692 ; CHECK-NEXT: adrp x8, .LCPI25_2
693 ; CHECK-NEXT: adrp x9, .LCPI25_3
694 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
695 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI25_2]
696 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI25_3]
697 ; CHECK-NEXT: adrp x8, .LCPI25_4
698 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
699 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
700 ; CHECK-NEXT: movi v2.4s, #1
701 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
702 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI25_4]
703 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
704 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
706 %srem = srem <4 x i32> %X, <i32 5, i32 4294967295, i32 16, i32 1>
707 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
708 %ret = zext <4 x i1> %cmp to <4 x i32>
712 define <4 x i32> @test_srem_even_allones_and_poweroftwo_and_one(<4 x i32> %X) nounwind {
713 ; CHECK-LABEL: test_srem_even_allones_and_poweroftwo_and_one:
715 ; CHECK-NEXT: adrp x8, .LCPI26_0
716 ; CHECK-NEXT: adrp x9, .LCPI26_1
717 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI26_0]
718 ; CHECK-NEXT: ldr q2, [x9, :lo12:.LCPI26_1]
719 ; CHECK-NEXT: adrp x8, .LCPI26_2
720 ; CHECK-NEXT: adrp x9, .LCPI26_3
721 ; CHECK-NEXT: mla v2.4s, v0.4s, v1.4s
722 ; CHECK-NEXT: ldr q0, [x8, :lo12:.LCPI26_2]
723 ; CHECK-NEXT: ldr q1, [x9, :lo12:.LCPI26_3]
724 ; CHECK-NEXT: adrp x8, .LCPI26_4
725 ; CHECK-NEXT: ushl v0.4s, v2.4s, v0.4s
726 ; CHECK-NEXT: ushl v1.4s, v2.4s, v1.4s
727 ; CHECK-NEXT: movi v2.4s, #1
728 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
729 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI26_4]
730 ; CHECK-NEXT: cmhs v0.4s, v1.4s, v0.4s
731 ; CHECK-NEXT: and v0.16b, v0.16b, v2.16b
733 %srem = srem <4 x i32> %X, <i32 14, i32 4294967295, i32 16, i32 1>
734 %cmp = icmp eq <4 x i32> %srem, <i32 0, i32 0, i32 0, i32 0>
735 %ret = zext <4 x i1> %cmp to <4 x i32>