xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/divrem-pow2.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 \
3; RUN:  | FileCheck %s -check-prefix=COST
4
5; Check that all divide/remainder instructions are implemented by cheaper instructions.
6; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -o - | FileCheck %s
7; CHECK-NOT: dsg
8; CHECK-NOT: dl
9
10; Scalar sdiv
11
12define i64 @fun0(i64 %a) {
13; COST-LABEL: 'fun0'
14; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, 2
15; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
16;
17  %r = sdiv i64 %a, 2
18  ret i64 %r
19}
20
21define i64 @fun1(i64 %a) {
22; COST-LABEL: 'fun1'
23; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, -4
24; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
25;
26  %r = sdiv i64 %a, -4
27  ret i64 %r
28}
29
30define i32 @fun2(i32 %a) {
31; COST-LABEL: 'fun2'
32; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, 8
33; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
34;
35  %r = sdiv i32 %a, 8
36  ret i32 %r
37}
38
39define i32 @fun3(i32 %a) {
40; COST-LABEL: 'fun3'
41; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, -16
42; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
43;
44  %r = sdiv i32 %a, -16
45  ret i32 %r
46}
47
48define i16 @fun4(i16 %a) {
49; COST-LABEL: 'fun4'
50; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, 32
51; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
52;
53  %r = sdiv i16 %a, 32
54  ret i16 %r
55}
56
57define i16 @fun5(i16 %a) {
58; COST-LABEL: 'fun5'
59; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, -64
60; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
61;
62  %r = sdiv i16 %a, -64
63  ret i16 %r
64}
65
66define i8 @fun6(i8 %a) {
67; COST-LABEL: 'fun6'
68; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, 64
69; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
70;
71  %r = sdiv i8 %a, 64
72  ret i8 %r
73}
74
75define i8 @fun7(i8 %a) {
76; COST-LABEL: 'fun7'
77; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, -128
78; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
79;
80  %r = sdiv i8 %a, -128
81  ret i8 %r
82}
83
84; Vector sdiv
85
86define <2 x i64> @fun8(<2 x i64> %a) {
87; COST-LABEL: 'fun8'
88; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, splat (i64 2)
89; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
90;
91  %r = sdiv <2 x i64> %a, <i64 2, i64 2>
92  ret <2 x i64> %r
93}
94
95define <2 x i64> @fun9(<2 x i64> %a) {
96; COST-LABEL: 'fun9'
97; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, splat (i64 -4)
98; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
99;
100  %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
101  ret <2 x i64> %r
102}
103
104define <4 x i32> @fun10(<4 x i32> %a) {
105; COST-LABEL: 'fun10'
106; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, splat (i32 8)
107; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
108;
109  %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
110  ret <4 x i32> %r
111}
112
113define <4 x i32> @fun11(<4 x i32> %a) {
114; COST-LABEL: 'fun11'
115; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, splat (i32 -16)
116; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
117;
118  %r = sdiv <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
119  ret <4 x i32> %r
120}
121
122define <2 x i32> @fun12(<2 x i32> %a) {
123; COST-LABEL: 'fun12'
124; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i32> %a, splat (i32 -16)
125; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i32> %r
126;
127  %r = sdiv <2 x i32> %a, <i32 -16, i32 -16>
128  ret <2 x i32> %r
129}
130
131define <8 x i16> @fun13(<8 x i16> %a) {
132; COST-LABEL: 'fun13'
133; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, splat (i16 32)
134; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
135;
136  %r = sdiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
137  ret <8 x i16> %r
138}
139
140define <8 x i16> @fun14(<8 x i16> %a) {
141; COST-LABEL: 'fun14'
142; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, splat (i16 -64)
143; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
144;
145  %r = sdiv <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
146  ret <8 x i16> %r
147}
148
149define <4 x i16> @fun15(<4 x i16> %a) {
150; COST-LABEL: 'fun15'
151; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i16> %a, splat (i16 32)
152; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i16> %r
153;
154  %r = sdiv <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
155  ret <4 x i16> %r
156}
157
158define <16 x i8> @fun16(<16 x i8> %a) {
159; COST-LABEL: 'fun16'
160; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, splat (i8 64)
161; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
162;
163  %r = sdiv <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
164  ret <16 x i8> %r
165}
166
167define <16 x i8> @fun17(<16 x i8> %a) {
168; COST-LABEL: 'fun17'
169; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, splat (i8 -128)
170; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
171;
172  %r = sdiv <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
173  ret <16 x i8> %r
174}
175
176define <8 x i8> @fun18(<8 x i8> %a) {
177; COST-LABEL: 'fun18'
178; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i8> %a, splat (i8 -128)
179; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i8> %r
180;
181  %r = sdiv <8 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
182  ret <8 x i8> %r
183}
184
185; Scalar udiv
186
187define i64 @fun19(i64 %a) {
188; COST-LABEL: 'fun19'
189; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i64 %a, 2
190; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
191;
192  %r = udiv i64 %a, 2
193  ret i64 %r
194}
195
196define i32 @fun20(i32 %a) {
197; COST-LABEL: 'fun20'
198; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i32 %a, 8
199; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
200;
201  %r = udiv i32 %a, 8
202  ret i32 %r
203}
204
205define i16 @fun21(i16 %a) {
206; COST-LABEL: 'fun21'
207; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i16 %a, 32
208; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
209;
210  %r = udiv i16 %a, 32
211  ret i16 %r
212}
213
214define i8 @fun22(i8 %a) {
215; COST-LABEL: 'fun22'
216; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i8 %a, -128
217; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
218;
219  %r = udiv i8 %a, 128
220  ret i8 %r
221}
222
223; Vector udiv
224
225define <2 x i64> @fun23(<2 x i64> %a) {
226; COST-LABEL: 'fun23'
227; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i64> %a, splat (i64 2)
228; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
229;
230  %r = udiv <2 x i64> %a, <i64 2, i64 2>
231  ret <2 x i64> %r
232}
233
234define <4 x i32> @fun24(<4 x i32> %a) {
235; COST-LABEL: 'fun24'
236; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i32> %a, splat (i32 8)
237; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
238;
239  %r = udiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
240  ret <4 x i32> %r
241}
242
243define <2 x i32> @fun25(<2 x i32> %a) {
244; COST-LABEL: 'fun25'
245; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i32> %a, splat (i32 8)
246; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i32> %r
247;
248  %r = udiv <2 x i32> %a, <i32 8, i32 8>
249  ret <2 x i32> %r
250}
251
252define <8 x i16> @fun26(<8 x i16> %a) {
253; COST-LABEL: 'fun26'
254; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i16> %a, splat (i16 32)
255; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
256;
257  %r = udiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
258  ret <8 x i16> %r
259}
260
261define <4 x i16> @fun27(<4 x i16> %a) {
262; COST-LABEL: 'fun27'
263; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i16> %a, splat (i16 32)
264; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i16> %r
265;
266  %r = udiv <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
267  ret <4 x i16> %r
268}
269
270define <16 x i8> @fun28(<16 x i8> %a) {
271; COST-LABEL: 'fun28'
272; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <16 x i8> %a, splat (i8 -128)
273; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
274;
275  %r = udiv <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
276  ret <16 x i8> %r
277}
278
279define <8 x i8> @fun29(<8 x i8> %a) {
280; COST-LABEL: 'fun29'
281; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i8> %a, splat (i8 -128)
282; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i8> %r
283;
284  %r = udiv <8 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
285  ret <8 x i8> %r
286}
287
288; Scalar srem
289
290define i64 @fun30(i64 %a) {
291; COST-LABEL: 'fun30'
292; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %a, 2
293; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
294;
295  %r = srem i64 %a, 2
296  ret i64 %r
297}
298
299define i64 @fun31(i64 %a) {
300; COST-LABEL: 'fun31'
301; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %a, -4
302; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
303;
304  %r = srem i64 %a, -4
305  ret i64 %r
306}
307
308define i32 @fun32(i32 %a) {
309; COST-LABEL: 'fun32'
310; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i32 %a, 8
311; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
312;
313  %r = srem i32 %a, 8
314  ret i32 %r
315}
316
317define i32 @fun33(i32 %a) {
318; COST-LABEL: 'fun33'
319; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i32 %a, -16
320; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
321;
322  %r = srem i32 %a, -16
323  ret i32 %r
324}
325
326define i16 @fun34(i16 %a) {
327; COST-LABEL: 'fun34'
328; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i16 %a, 32
329; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
330;
331  %r = srem i16 %a, 32
332  ret i16 %r
333}
334
335define i16 @fun35(i16 %a) {
336; COST-LABEL: 'fun35'
337; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i16 %a, -64
338; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
339;
340  %r = srem i16 %a, -64
341  ret i16 %r
342}
343
344define i8 @fun36(i8 %a) {
345; COST-LABEL: 'fun36'
346; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i8 %a, 64
347; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
348;
349  %r = srem i8 %a, 64
350  ret i8 %r
351}
352
353define i8 @fun37(i8 %a) {
354; COST-LABEL: 'fun37'
355; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem i8 %a, -128
356; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
357;
358  %r = srem i8 %a, -128
359  ret i8 %r
360}
361
362; Vector srem
363
364define <2 x i64> @fun38(<2 x i64> %a) {
365; COST-LABEL: 'fun38'
366; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, splat (i64 2)
367; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
368;
369  %r = srem <2 x i64> %a, <i64 2, i64 2>
370  ret <2 x i64> %r
371}
372
373define <2 x i64> @fun39(<2 x i64> %a) {
374; COST-LABEL: 'fun39'
375; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, splat (i64 -4)
376; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
377;
378  %r = srem <2 x i64> %a, <i64 -4, i64 -4>
379  ret <2 x i64> %r
380}
381
382define <4 x i32> @fun40(<4 x i32> %a) {
383; COST-LABEL: 'fun40'
384; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, splat (i32 8)
385; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
386;
387  %r = srem <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
388  ret <4 x i32> %r
389}
390
391define <4 x i32> @fun41(<4 x i32> %a) {
392; COST-LABEL: 'fun41'
393; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, splat (i32 -16)
394; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
395;
396  %r = srem <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
397  ret <4 x i32> %r
398}
399
400define <2 x i32> @fun42(<2 x i32> %a) {
401; COST-LABEL: 'fun42'
402; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i32> %a, splat (i32 -16)
403; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i32> %r
404;
405  %r = srem <2 x i32> %a, <i32 -16, i32 -16>
406  ret <2 x i32> %r
407}
408
409define <8 x i16> @fun43(<8 x i16> %a) {
410; COST-LABEL: 'fun43'
411; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, splat (i16 32)
412; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
413;
414  %r = srem <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
415  ret <8 x i16> %r
416}
417
418define <8 x i16> @fun44(<8 x i16> %a) {
419; COST-LABEL: 'fun44'
420; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, splat (i16 -64)
421; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
422;
423  %r = srem <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
424  ret <8 x i16> %r
425}
426
427define <4 x i16> @fun45(<4 x i16> %a) {
428; COST-LABEL: 'fun45'
429; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i16> %a, splat (i16 32)
430; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i16> %r
431;
432  %r = srem <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
433  ret <4 x i16> %r
434}
435
436define <16 x i8> @fun46(<16 x i8> %a) {
437; COST-LABEL: 'fun46'
438; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, splat (i8 64)
439; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
440;
441  %r = srem <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
442  ret <16 x i8> %r
443}
444
445define <16 x i8> @fun47(<16 x i8> %a) {
446; COST-LABEL: 'fun47'
447; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, splat (i8 -128)
448; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
449;
450  %r = srem <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
451  ret <16 x i8> %r
452}
453
454define <8 x i8> @fun48(<8 x i8> %a) {
455; COST-LABEL: 'fun48'
456; COST-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i8> %a, splat (i8 -128)
457; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i8> %r
458;
459  %r = srem <8 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
460  ret <8 x i8> %r
461}
462
463; Scalar urem
464
465define i64 @fun49(i64 %a) {
466; COST-LABEL: 'fun49'
467; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem i64 %a, 2
468; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
469;
470  %r = urem i64 %a, 2
471  ret i64 %r
472}
473
474define i32 @fun50(i32 %a) {
475; COST-LABEL: 'fun50'
476; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem i32 %a, 8
477; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
478;
479  %r = urem i32 %a, 8
480  ret i32 %r
481}
482
483define i16 @fun51(i16 %a) {
484; COST-LABEL: 'fun51'
485; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem i16 %a, 32
486; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %r
487;
488  %r = urem i16 %a, 32
489  ret i16 %r
490}
491
492define i8 @fun52(i8 %a) {
493; COST-LABEL: 'fun52'
494; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem i8 %a, -128
495; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
496;
497  %r = urem i8 %a, 128
498  ret i8 %r
499}
500
501; Vector urem
502
503define <2 x i64> @fun53(<2 x i64> %a) {
504; COST-LABEL: 'fun53'
505; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i64> %a, splat (i64 2)
506; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %r
507;
508  %r = urem <2 x i64> %a, <i64 2, i64 2>
509  ret <2 x i64> %r
510}
511
512define <4 x i32> @fun54(<4 x i32> %a) {
513; COST-LABEL: 'fun54'
514; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i32> %a, splat (i32 8)
515; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %r
516;
517  %r = urem <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
518  ret <4 x i32> %r
519}
520
521define <2 x i32> @fun55(<2 x i32> %a) {
522; COST-LABEL: 'fun55'
523; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i32> %a, splat (i32 8)
524; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i32> %r
525;
526  %r = urem <2 x i32> %a, <i32 8, i32 8>
527  ret <2 x i32> %r
528}
529
530define <8 x i16> @fun56(<8 x i16> %a) {
531; COST-LABEL: 'fun56'
532; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i16> %a, splat (i16 32)
533; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %r
534;
535  %r = urem <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
536  ret <8 x i16> %r
537}
538
539define <4 x i16> @fun57(<4 x i16> %a) {
540; COST-LABEL: 'fun57'
541; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i16> %a, splat (i16 32)
542; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i16> %r
543;
544  %r = urem <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
545  ret <4 x i16> %r
546}
547
548define <16 x i8> @fun58(<16 x i8> %a) {
549; COST-LABEL: 'fun58'
550; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <16 x i8> %a, splat (i8 -128)
551; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %r
552;
553  %r = urem <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
554  ret <16 x i8> %r
555}
556
557define <8 x i8> @fun59(<8 x i8> %a) {
558; COST-LABEL: 'fun59'
559; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i8> %a, splat (i8 -128)
560; COST-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i8> %r
561;
562  %r = urem <8 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
563  ret <8 x i8> %r
564}
565