1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 define void @bar(i32 %0, i32 %1) nounwind {
7 ; CHECK-NEXT: testl %edi, %edi
8 ; CHECK-NEXT: je .LBB0_4
9 ; CHECK-NEXT: # %bb.1: # %.preheader
10 ; CHECK-NEXT: pushq %rbx
11 ; CHECK-NEXT: movl %edi, %ebx
12 ; CHECK-NEXT: decl %ebx
13 ; CHECK-NEXT: .p2align 4
14 ; CHECK-NEXT: .LBB0_2: # =>This Inner Loop Header: Depth=1
15 ; CHECK-NEXT: movl %ebx, %edi
16 ; CHECK-NEXT: callq foo@PLT
17 ; CHECK-NEXT: addl $-1, %ebx
18 ; CHECK-NEXT: jb .LBB0_2
19 ; CHECK-NEXT: # %bb.3:
20 ; CHECK-NEXT: popq %rbx
21 ; CHECK-NEXT: .LBB0_4:
23 %3 = icmp eq i32 %0, 0
24 br i1 %3, label %8, label %4
27 %5 = phi i32 [ %6, %4 ], [ %0, %2 ]
28 %6 = add nsw i32 %5, -1
29 tail call void @foo(i32 %6)
30 %7 = icmp eq i32 %6, 0
31 br i1 %7, label %8, label %4
37 define void @baz(i32 %0, i32 %1) nounwind {
40 ; CHECK-NEXT: testl %edi, %edi
41 ; CHECK-NEXT: je .LBB1_4
42 ; CHECK-NEXT: # %bb.1: # %.preheader
43 ; CHECK-NEXT: pushq %rbx
44 ; CHECK-NEXT: movl %edi, %ebx
45 ; CHECK-NEXT: decl %ebx
46 ; CHECK-NEXT: .p2align 4
47 ; CHECK-NEXT: .LBB1_2: # =>This Inner Loop Header: Depth=1
48 ; CHECK-NEXT: movl %ebx, %edi
49 ; CHECK-NEXT: callq foo@PLT
50 ; CHECK-NEXT: addl $-1, %ebx
51 ; CHECK-NEXT: jae .LBB1_2
52 ; CHECK-NEXT: # %bb.3:
53 ; CHECK-NEXT: popq %rbx
54 ; CHECK-NEXT: .LBB1_4:
56 %3 = icmp eq i32 %0, 0
57 br i1 %3, label %8, label %4
60 %5 = phi i32 [ %6, %4 ], [ %0, %2 ]
61 %6 = add nsw i32 %5, -1
62 tail call void @foo(i32 %6)
63 %7 = icmp ne i32 %6, 0
64 br i1 %7, label %8, label %4
70 declare void @foo(i32)