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: pushq %rbx
8 ; CHECK-NEXT: testl %edi, %edi
9 ; CHECK-NEXT: je .LBB0_3
10 ; CHECK-NEXT: # %bb.1: # %.preheader
11 ; CHECK-NEXT: movl %edi, %ebx
12 ; CHECK-NEXT: decl %ebx
13 ; CHECK-NEXT: .p2align 4, 0x90
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: .LBB0_3:
20 ; CHECK-NEXT: popq %rbx
22 %3 = icmp eq i32 %0, 0
23 br i1 %3, label %8, label %4
26 %5 = phi i32 [ %6, %4 ], [ %0, %2 ]
27 %6 = add nsw i32 %5, -1
28 tail call void @foo(i32 %6)
29 %7 = icmp eq i32 %6, 0
30 br i1 %7, label %8, label %4
36 define void @baz(i32 %0, i32 %1) nounwind {
39 ; CHECK-NEXT: pushq %rbx
40 ; CHECK-NEXT: testl %edi, %edi
41 ; CHECK-NEXT: je .LBB1_3
42 ; CHECK-NEXT: # %bb.1: # %.preheader
43 ; CHECK-NEXT: movl %edi, %ebx
44 ; CHECK-NEXT: decl %ebx
45 ; CHECK-NEXT: .p2align 4, 0x90
46 ; CHECK-NEXT: .LBB1_2: # =>This Inner Loop Header: Depth=1
47 ; CHECK-NEXT: movl %ebx, %edi
48 ; CHECK-NEXT: callq foo@PLT
49 ; CHECK-NEXT: addl $-1, %ebx
50 ; CHECK-NEXT: jae .LBB1_2
51 ; CHECK-NEXT: .LBB1_3:
52 ; CHECK-NEXT: popq %rbx
54 %3 = icmp eq i32 %0, 0
55 br i1 %3, label %8, label %4
58 %5 = phi i32 [ %6, %4 ], [ %0, %2 ]
59 %6 = add nsw i32 %5, -1
60 tail call void @foo(i32 %6)
61 %7 = icmp ne i32 %6, 0
62 br i1 %7, label %8, label %4
68 declare void @foo(i32)