1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -O3 -verify-machineinstrs < %s | FileCheck %s
4 ; Test cases are generated from:
5 ; long long NAME(PARAM a, PARAM b) {
12 ; Please note funtion name is defined as <PARAM>_<LHS>_<RHS>. Take ll_a_op_b__1
13 ; for example. ll is PARAM, a_op_b (i.e., a << b) is LHS, _1 (i.e., -1) is RHS.
15 target datalayout = "e-m:e-i64:64-n32:64"
17 define i64 @ll_a_op_b__2(i64 %a, i64 %b) {
18 ; CHECK-LABEL: ll_a_op_b__2:
19 ; CHECK: # %bb.0: # %entry
20 ; CHECK-NEXT: movq %rsi, %rcx
21 ; CHECK-NEXT: movq %rdi, %rax
22 ; CHECK-NEXT: shlq %cl, %rax
23 ; CHECK-NEXT: cmpq $-2, %rax
24 ; CHECK-NEXT: jle .LBB0_1
25 ; CHECK-NEXT: # %bb.2: # %return
26 ; CHECK-NEXT: movq %rcx, %rax
28 ; CHECK-NEXT: .LBB0_1: # %if.end
29 ; CHECK-NEXT: movl $1, %eax
30 ; CHECK-NEXT: cmoveq %rcx, %rax
31 ; CHECK-NEXT: imulq %rdi, %rax
35 %cmp = icmp sgt i64 %shl, -2
36 br i1 %cmp, label %return, label %if.end
38 if.end: ; preds = %entry
39 %cmp2 = icmp eq i64 %shl, -2
40 %mul = select i1 %cmp2, i64 %b, i64 1
41 %spec.select = mul nsw i64 %mul, %a
44 return: ; preds = %entry
48 define i64 @ll_a_op_b__1(i64 %a, i64 %b) {
49 ; CHECK-LABEL: ll_a_op_b__1:
50 ; CHECK: # %bb.0: # %entry
51 ; CHECK-NEXT: movq %rsi, %rcx
52 ; CHECK-NEXT: movq %rdi, %rax
53 ; CHECK-NEXT: shlq %cl, %rax
54 ; CHECK-NEXT: testq %rax, %rax
55 ; CHECK-NEXT: js .LBB1_1
56 ; CHECK-NEXT: # %bb.2: # %return
57 ; CHECK-NEXT: movq %rcx, %rax
59 ; CHECK-NEXT: .LBB1_1: # %if.end
60 ; CHECK-NEXT: cmpq $-1, %rax
61 ; CHECK-NEXT: movl $1, %eax
62 ; CHECK-NEXT: cmoveq %rcx, %rax
63 ; CHECK-NEXT: imulq %rdi, %rax
67 %cmp = icmp sgt i64 %shl, -1
68 br i1 %cmp, label %return, label %if.end
70 if.end: ; preds = %entry
71 %cmp2 = icmp eq i64 %shl, -1
72 %mul = select i1 %cmp2, i64 %b, i64 1
73 %spec.select = mul nsw i64 %mul, %a
76 return: ; preds = %entry
80 define i64 @ll_a_op_b_0(i64 %a, i64 %b) {
81 ; CHECK-LABEL: ll_a_op_b_0:
82 ; CHECK: # %bb.0: # %entry
83 ; CHECK-NEXT: movq %rsi, %rcx
84 ; CHECK-NEXT: movq %rdi, %rax
85 ; CHECK-NEXT: shlq %cl, %rax
86 ; CHECK-NEXT: testq %rax, %rax
87 ; CHECK-NEXT: jle .LBB2_1
88 ; CHECK-NEXT: # %bb.2: # %return
89 ; CHECK-NEXT: movq %rcx, %rax
91 ; CHECK-NEXT: .LBB2_1: # %if.end
92 ; CHECK-NEXT: movl $1, %eax
93 ; CHECK-NEXT: cmoveq %rcx, %rax
94 ; CHECK-NEXT: imulq %rdi, %rax
98 %cmp = icmp sgt i64 %shl, 0
99 br i1 %cmp, label %return, label %if.end
101 if.end: ; preds = %entry
102 %cmp2 = icmp eq i64 %shl, 0
103 %mul = select i1 %cmp2, i64 %b, i64 1
104 %spec.select = mul nsw i64 %mul, %a
107 return: ; preds = %entry
111 define i64 @ll_a_op_b_1(i64 %a, i64 %b) {
112 ; CHECK-LABEL: ll_a_op_b_1:
113 ; CHECK: # %bb.0: # %entry
114 ; CHECK-NEXT: movq %rsi, %rcx
115 ; CHECK-NEXT: movq %rdi, %rax
116 ; CHECK-NEXT: shlq %cl, %rax
117 ; CHECK-NEXT: cmpq $1, %rax
118 ; CHECK-NEXT: jle .LBB3_1
119 ; CHECK-NEXT: # %bb.2: # %return
120 ; CHECK-NEXT: movq %rcx, %rax
122 ; CHECK-NEXT: .LBB3_1: # %if.end
123 ; CHECK-NEXT: movl $1, %eax
124 ; CHECK-NEXT: cmoveq %rcx, %rax
125 ; CHECK-NEXT: imulq %rdi, %rax
128 %shl = shl i64 %a, %b
129 %cmp = icmp sgt i64 %shl, 1
130 br i1 %cmp, label %return, label %if.end
132 if.end: ; preds = %entry
133 %cmp2 = icmp eq i64 %shl, 1
134 %mul = select i1 %cmp2, i64 %b, i64 1
135 %spec.select = mul nsw i64 %mul, %a
138 return: ; preds = %entry
142 define i64 @ll_a_op_b_2(i64 %a, i64 %b) {
143 ; CHECK-LABEL: ll_a_op_b_2:
144 ; CHECK: # %bb.0: # %entry
145 ; CHECK-NEXT: movq %rsi, %rcx
146 ; CHECK-NEXT: movq %rdi, %rax
147 ; CHECK-NEXT: shlq %cl, %rax
148 ; CHECK-NEXT: cmpq $2, %rax
149 ; CHECK-NEXT: jle .LBB4_1
150 ; CHECK-NEXT: # %bb.2: # %return
151 ; CHECK-NEXT: movq %rcx, %rax
153 ; CHECK-NEXT: .LBB4_1: # %if.end
154 ; CHECK-NEXT: movl $1, %eax
155 ; CHECK-NEXT: cmoveq %rcx, %rax
156 ; CHECK-NEXT: imulq %rdi, %rax
159 %shl = shl i64 %a, %b
160 %cmp = icmp sgt i64 %shl, 2
161 br i1 %cmp, label %return, label %if.end
163 if.end: ; preds = %entry
164 %cmp2 = icmp eq i64 %shl, 2
165 %mul = select i1 %cmp2, i64 %b, i64 1
166 %spec.select = mul nsw i64 %mul, %a
169 return: ; preds = %entry
173 define i64 @ll_a__2(i64 %a, i64 %b) {
174 ; CHECK-LABEL: ll_a__2:
175 ; CHECK: # %bb.0: # %entry
176 ; CHECK-NEXT: cmpq $-2, %rdi
177 ; CHECK-NEXT: jle .LBB5_1
178 ; CHECK-NEXT: # %bb.2: # %return
179 ; CHECK-NEXT: movq %rsi, %rax
181 ; CHECK-NEXT: .LBB5_1: # %if.end
182 ; CHECK-NEXT: movl $1, %eax
183 ; CHECK-NEXT: cmoveq %rsi, %rax
184 ; CHECK-NEXT: imulq %rdi, %rax
187 %cmp = icmp sgt i64 %a, -2
188 br i1 %cmp, label %return, label %if.end
190 if.end: ; preds = %entry
191 %cmp1 = icmp eq i64 %a, -2
192 %mul = select i1 %cmp1, i64 %b, i64 1
193 %spec.select = mul nsw i64 %mul, %a
196 return: ; preds = %entry
200 define i64 @ll_a__1(i64 %a, i64 %b) {
201 ; CHECK-LABEL: ll_a__1:
202 ; CHECK: # %bb.0: # %entry
203 ; CHECK-NEXT: testq %rdi, %rdi
204 ; CHECK-NEXT: js .LBB6_1
205 ; CHECK-NEXT: # %bb.2: # %return
206 ; CHECK-NEXT: movq %rsi, %rax
208 ; CHECK-NEXT: .LBB6_1: # %if.end
209 ; CHECK-NEXT: cmpq $-1, %rdi
210 ; CHECK-NEXT: movl $1, %eax
211 ; CHECK-NEXT: cmoveq %rsi, %rax
212 ; CHECK-NEXT: imulq %rdi, %rax
215 %cmp = icmp sgt i64 %a, -1
216 br i1 %cmp, label %return, label %if.end
218 if.end: ; preds = %entry
219 %cmp1 = icmp eq i64 %a, -1
220 %mul = select i1 %cmp1, i64 %b, i64 1
221 %spec.select = mul nsw i64 %mul, %a
224 return: ; preds = %entry
228 define i64 @ll_a_0(i64 %a, i64 %b) {
229 ; CHECK-LABEL: ll_a_0:
230 ; CHECK: # %bb.0: # %entry
231 ; CHECK-NEXT: testq %rdi, %rdi
232 ; CHECK-NEXT: jle .LBB7_1
233 ; CHECK-NEXT: # %bb.2: # %return
234 ; CHECK-NEXT: movq %rsi, %rax
236 ; CHECK-NEXT: .LBB7_1: # %if.end
237 ; CHECK-NEXT: movl $1, %eax
238 ; CHECK-NEXT: cmoveq %rsi, %rax
239 ; CHECK-NEXT: imulq %rdi, %rax
242 %cmp = icmp sgt i64 %a, 0
243 br i1 %cmp, label %return, label %if.end
245 if.end: ; preds = %entry
246 %cmp1 = icmp eq i64 %a, 0
247 %mul = select i1 %cmp1, i64 %b, i64 1
248 %spec.select = mul nsw i64 %mul, %a
251 return: ; preds = %entry
255 define i64 @ll_a_1(i64 %a, i64 %b) {
256 ; CHECK-LABEL: ll_a_1:
257 ; CHECK: # %bb.0: # %entry
258 ; CHECK-NEXT: cmpq $1, %rdi
259 ; CHECK-NEXT: jle .LBB8_1
260 ; CHECK-NEXT: # %bb.2: # %return
261 ; CHECK-NEXT: movq %rsi, %rax
263 ; CHECK-NEXT: .LBB8_1: # %if.end
264 ; CHECK-NEXT: movl $1, %eax
265 ; CHECK-NEXT: cmoveq %rsi, %rax
266 ; CHECK-NEXT: imulq %rdi, %rax
269 %cmp = icmp sgt i64 %a, 1
270 br i1 %cmp, label %return, label %if.end
272 if.end: ; preds = %entry
273 %cmp1 = icmp eq i64 %a, 1
274 %mul = select i1 %cmp1, i64 %b, i64 1
275 %spec.select = mul nsw i64 %mul, %a
278 return: ; preds = %entry
282 define i64 @ll_a_2(i64 %a, i64 %b) {
283 ; CHECK-LABEL: ll_a_2:
284 ; CHECK: # %bb.0: # %entry
285 ; CHECK-NEXT: cmpq $2, %rdi
286 ; CHECK-NEXT: jle .LBB9_1
287 ; CHECK-NEXT: # %bb.2: # %return
288 ; CHECK-NEXT: movq %rsi, %rax
290 ; CHECK-NEXT: .LBB9_1: # %if.end
291 ; CHECK-NEXT: movl $1, %eax
292 ; CHECK-NEXT: cmoveq %rsi, %rax
293 ; CHECK-NEXT: imulq %rdi, %rax
296 %cmp = icmp sgt i64 %a, 2
297 br i1 %cmp, label %return, label %if.end
299 if.end: ; preds = %entry
300 %cmp1 = icmp eq i64 %a, 2
301 %mul = select i1 %cmp1, i64 %b, i64 1
302 %spec.select = mul nsw i64 %mul, %a
305 return: ; preds = %entry
309 define i64 @i_a_op_b__2(i32 signext %a, i32 signext %b) {
310 ; CHECK-LABEL: i_a_op_b__2:
311 ; CHECK: # %bb.0: # %entry
312 ; CHECK-NEXT: movl %esi, %ecx
313 ; CHECK-NEXT: movl %edi, %eax
314 ; CHECK-NEXT: shll %cl, %eax
315 ; CHECK-NEXT: cmpl $-2, %eax
316 ; CHECK-NEXT: jg .LBB10_2
317 ; CHECK-NEXT: # %bb.1: # %if.end
318 ; CHECK-NEXT: movl $1, %eax
319 ; CHECK-NEXT: cmovel %ecx, %eax
320 ; CHECK-NEXT: imull %edi, %eax
321 ; CHECK-NEXT: movl %eax, %ecx
322 ; CHECK-NEXT: .LBB10_2: # %return
323 ; CHECK-NEXT: movslq %ecx, %rax
326 %shl = shl i32 %a, %b
327 %cmp = icmp sgt i32 %shl, -2
328 br i1 %cmp, label %return, label %if.end
330 if.end: ; preds = %entry
331 %cmp2 = icmp eq i32 %shl, -2
332 %mul = select i1 %cmp2, i32 %b, i32 1
333 %spec.select = mul nsw i32 %mul, %a
336 return: ; preds = %if.end, %entry
337 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
338 %retval.0 = sext i32 %retval.0.in to i64
342 define i64 @i_a_op_b__1(i32 signext %a, i32 signext %b) {
343 ; CHECK-LABEL: i_a_op_b__1:
344 ; CHECK: # %bb.0: # %entry
345 ; CHECK-NEXT: movl %esi, %ecx
346 ; CHECK-NEXT: movl %edi, %eax
347 ; CHECK-NEXT: shll %cl, %eax
348 ; CHECK-NEXT: testl %eax, %eax
349 ; CHECK-NEXT: js .LBB11_1
350 ; CHECK-NEXT: # %bb.2: # %return
351 ; CHECK-NEXT: movslq %ecx, %rax
353 ; CHECK-NEXT: .LBB11_1: # %if.end
354 ; CHECK-NEXT: cmpl $-1, %eax
355 ; CHECK-NEXT: movl $1, %eax
356 ; CHECK-NEXT: cmovel %ecx, %eax
357 ; CHECK-NEXT: imull %edi, %eax
358 ; CHECK-NEXT: movl %eax, %ecx
359 ; CHECK-NEXT: movslq %ecx, %rax
362 %shl = shl i32 %a, %b
363 %cmp = icmp sgt i32 %shl, -1
364 br i1 %cmp, label %return, label %if.end
366 if.end: ; preds = %entry
367 %cmp2 = icmp eq i32 %shl, -1
368 %mul = select i1 %cmp2, i32 %b, i32 1
369 %spec.select = mul nsw i32 %mul, %a
372 return: ; preds = %if.end, %entry
373 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
374 %retval.0 = sext i32 %retval.0.in to i64
378 define i64 @i_a_op_b_0(i32 signext %a, i32 signext %b) {
379 ; CHECK-LABEL: i_a_op_b_0:
380 ; CHECK: # %bb.0: # %entry
381 ; CHECK-NEXT: movl %esi, %ecx
382 ; CHECK-NEXT: movl %edi, %eax
383 ; CHECK-NEXT: shll %cl, %eax
384 ; CHECK-NEXT: testl %eax, %eax
385 ; CHECK-NEXT: jle .LBB12_1
386 ; CHECK-NEXT: # %bb.2: # %return
387 ; CHECK-NEXT: movslq %ecx, %rax
389 ; CHECK-NEXT: .LBB12_1: # %if.end
390 ; CHECK-NEXT: movl $1, %eax
391 ; CHECK-NEXT: cmovel %ecx, %eax
392 ; CHECK-NEXT: imull %edi, %eax
393 ; CHECK-NEXT: movl %eax, %ecx
394 ; CHECK-NEXT: movslq %ecx, %rax
397 %shl = shl i32 %a, %b
398 %cmp = icmp sgt i32 %shl, 0
399 br i1 %cmp, label %return, label %if.end
401 if.end: ; preds = %entry
402 %cmp2 = icmp eq i32 %shl, 0
403 %mul = select i1 %cmp2, i32 %b, i32 1
404 %spec.select = mul nsw i32 %mul, %a
407 return: ; preds = %if.end, %entry
408 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
409 %retval.0 = sext i32 %retval.0.in to i64
413 define i64 @i_a_op_b_1(i32 signext %a, i32 signext %b) {
414 ; CHECK-LABEL: i_a_op_b_1:
415 ; CHECK: # %bb.0: # %entry
416 ; CHECK-NEXT: movl %esi, %ecx
417 ; CHECK-NEXT: movl %edi, %eax
418 ; CHECK-NEXT: shll %cl, %eax
419 ; CHECK-NEXT: cmpl $1, %eax
420 ; CHECK-NEXT: jg .LBB13_2
421 ; CHECK-NEXT: # %bb.1: # %if.end
422 ; CHECK-NEXT: movl $1, %eax
423 ; CHECK-NEXT: cmovel %ecx, %eax
424 ; CHECK-NEXT: imull %edi, %eax
425 ; CHECK-NEXT: movl %eax, %ecx
426 ; CHECK-NEXT: .LBB13_2: # %return
427 ; CHECK-NEXT: movslq %ecx, %rax
430 %shl = shl i32 %a, %b
431 %cmp = icmp sgt i32 %shl, 1
432 br i1 %cmp, label %return, label %if.end
434 if.end: ; preds = %entry
435 %cmp2 = icmp eq i32 %shl, 1
436 %mul = select i1 %cmp2, i32 %b, i32 1
437 %spec.select = mul nsw i32 %mul, %a
440 return: ; preds = %if.end, %entry
441 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
442 %retval.0 = sext i32 %retval.0.in to i64
446 define i64 @i_a_op_b_2(i32 signext %a, i32 signext %b) {
447 ; CHECK-LABEL: i_a_op_b_2:
448 ; CHECK: # %bb.0: # %entry
449 ; CHECK-NEXT: movl %esi, %ecx
450 ; CHECK-NEXT: movl %edi, %eax
451 ; CHECK-NEXT: shll %cl, %eax
452 ; CHECK-NEXT: cmpl $2, %eax
453 ; CHECK-NEXT: jg .LBB14_2
454 ; CHECK-NEXT: # %bb.1: # %if.end
455 ; CHECK-NEXT: movl $1, %eax
456 ; CHECK-NEXT: cmovel %ecx, %eax
457 ; CHECK-NEXT: imull %edi, %eax
458 ; CHECK-NEXT: movl %eax, %ecx
459 ; CHECK-NEXT: .LBB14_2: # %return
460 ; CHECK-NEXT: movslq %ecx, %rax
463 %shl = shl i32 %a, %b
464 %cmp = icmp sgt i32 %shl, 2
465 br i1 %cmp, label %return, label %if.end
467 if.end: ; preds = %entry
468 %cmp2 = icmp eq i32 %shl, 2
469 %mul = select i1 %cmp2, i32 %b, i32 1
470 %spec.select = mul nsw i32 %mul, %a
473 return: ; preds = %if.end, %entry
474 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
475 %retval.0 = sext i32 %retval.0.in to i64
479 define i64 @i_a__2(i32 signext %a, i32 signext %b) {
480 ; CHECK-LABEL: i_a__2:
481 ; CHECK: # %bb.0: # %entry
482 ; CHECK-NEXT: cmpl $-2, %edi
483 ; CHECK-NEXT: jg .LBB15_2
484 ; CHECK-NEXT: # %bb.1: # %if.end
485 ; CHECK-NEXT: movl $1, %eax
486 ; CHECK-NEXT: cmovel %esi, %eax
487 ; CHECK-NEXT: imull %edi, %eax
488 ; CHECK-NEXT: movl %eax, %esi
489 ; CHECK-NEXT: .LBB15_2: # %return
490 ; CHECK-NEXT: movslq %esi, %rax
493 %cmp = icmp sgt i32 %a, -2
494 br i1 %cmp, label %return, label %if.end
496 if.end: ; preds = %entry
497 %cmp1 = icmp eq i32 %a, -2
498 %mul = select i1 %cmp1, i32 %b, i32 1
499 %spec.select = mul nsw i32 %mul, %a
502 return: ; preds = %if.end, %entry
503 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
504 %retval.0 = sext i32 %retval.0.in to i64
508 define i64 @i_a__1(i32 signext %a, i32 signext %b) {
509 ; CHECK-LABEL: i_a__1:
510 ; CHECK: # %bb.0: # %entry
511 ; CHECK-NEXT: testl %edi, %edi
512 ; CHECK-NEXT: js .LBB16_1
513 ; CHECK-NEXT: # %bb.2: # %return
514 ; CHECK-NEXT: movslq %esi, %rax
516 ; CHECK-NEXT: .LBB16_1: # %if.end
517 ; CHECK-NEXT: cmpl $-1, %edi
518 ; CHECK-NEXT: movl $1, %eax
519 ; CHECK-NEXT: cmovel %esi, %eax
520 ; CHECK-NEXT: imull %edi, %eax
521 ; CHECK-NEXT: movl %eax, %esi
522 ; CHECK-NEXT: movslq %esi, %rax
525 %cmp = icmp sgt i32 %a, -1
526 br i1 %cmp, label %return, label %if.end
528 if.end: ; preds = %entry
529 %cmp1 = icmp eq i32 %a, -1
530 %mul = select i1 %cmp1, i32 %b, i32 1
531 %spec.select = mul nsw i32 %mul, %a
534 return: ; preds = %if.end, %entry
535 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
536 %retval.0 = sext i32 %retval.0.in to i64
540 define i64 @i_a_0(i32 signext %a, i32 signext %b) {
541 ; CHECK-LABEL: i_a_0:
542 ; CHECK: # %bb.0: # %entry
543 ; CHECK-NEXT: testl %edi, %edi
544 ; CHECK-NEXT: jle .LBB17_1
545 ; CHECK-NEXT: # %bb.2: # %return
546 ; CHECK-NEXT: movslq %esi, %rax
548 ; CHECK-NEXT: .LBB17_1: # %if.end
549 ; CHECK-NEXT: movl $1, %eax
550 ; CHECK-NEXT: cmovel %esi, %eax
551 ; CHECK-NEXT: imull %edi, %eax
552 ; CHECK-NEXT: movl %eax, %esi
553 ; CHECK-NEXT: movslq %esi, %rax
556 %cmp = icmp sgt i32 %a, 0
557 br i1 %cmp, label %return, label %if.end
559 if.end: ; preds = %entry
560 %cmp1 = icmp eq i32 %a, 0
561 %mul = select i1 %cmp1, i32 %b, i32 1
562 %spec.select = mul nsw i32 %mul, %a
565 return: ; preds = %if.end, %entry
566 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
567 %retval.0 = sext i32 %retval.0.in to i64
571 define i64 @i_a_1(i32 signext %a, i32 signext %b) {
572 ; CHECK-LABEL: i_a_1:
573 ; CHECK: # %bb.0: # %entry
574 ; CHECK-NEXT: cmpl $1, %edi
575 ; CHECK-NEXT: jg .LBB18_2
576 ; CHECK-NEXT: # %bb.1: # %if.end
577 ; CHECK-NEXT: movl $1, %eax
578 ; CHECK-NEXT: cmovel %esi, %eax
579 ; CHECK-NEXT: imull %edi, %eax
580 ; CHECK-NEXT: movl %eax, %esi
581 ; CHECK-NEXT: .LBB18_2: # %return
582 ; CHECK-NEXT: movslq %esi, %rax
585 %cmp = icmp sgt i32 %a, 1
586 br i1 %cmp, label %return, label %if.end
588 if.end: ; preds = %entry
589 %cmp1 = icmp eq i32 %a, 1
590 %mul = select i1 %cmp1, i32 %b, i32 1
591 %spec.select = mul nsw i32 %mul, %a
594 return: ; preds = %if.end, %entry
595 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
596 %retval.0 = sext i32 %retval.0.in to i64
600 define i64 @i_a_2(i32 signext %a, i32 signext %b) {
601 ; CHECK-LABEL: i_a_2:
602 ; CHECK: # %bb.0: # %entry
603 ; CHECK-NEXT: cmpl $2, %edi
604 ; CHECK-NEXT: jg .LBB19_2
605 ; CHECK-NEXT: # %bb.1: # %if.end
606 ; CHECK-NEXT: movl $1, %eax
607 ; CHECK-NEXT: cmovel %esi, %eax
608 ; CHECK-NEXT: imull %edi, %eax
609 ; CHECK-NEXT: movl %eax, %esi
610 ; CHECK-NEXT: .LBB19_2: # %return
611 ; CHECK-NEXT: movslq %esi, %rax
614 %cmp = icmp sgt i32 %a, 2
615 br i1 %cmp, label %return, label %if.end
617 if.end: ; preds = %entry
618 %cmp1 = icmp eq i32 %a, 2
619 %mul = select i1 %cmp1, i32 %b, i32 1
620 %spec.select = mul nsw i32 %mul, %a
623 return: ; preds = %if.end, %entry
624 %retval.0.in = phi i32 [ %b, %entry ], [ %spec.select, %if.end ]
625 %retval.0 = sext i32 %retval.0.in to i64