1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
4 ; LSR previously eliminated the sitofp by introducing an induction
5 ; variable which stepped by a bogus ((double)UINT32_C(-1)). It's theoretically
6 ; possible to eliminate the sitofp using a proper -1.0 step though; this
7 ; test should be changed if that is done.
9 define void @foo(i32 %N) nounwind {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: testl %edi, %edi
13 ; CHECK-NEXT: js .LBB0_1
14 ; CHECK-NEXT: # %bb.4: # %return
16 ; CHECK-NEXT: .LBB0_1: # %bb.preheader
17 ; CHECK-NEXT: pushq %rbp
18 ; CHECK-NEXT: pushq %rbx
19 ; CHECK-NEXT: pushq %rax
20 ; CHECK-NEXT: movl %edi, %ebx
21 ; CHECK-NEXT: xorl %ebp, %ebp
22 ; CHECK-NEXT: .p2align 4
23 ; CHECK-NEXT: .LBB0_2: # %bb
24 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
25 ; CHECK-NEXT: xorps %xmm0, %xmm0
26 ; CHECK-NEXT: cvtsi2sd %ebp, %xmm0
27 ; CHECK-NEXT: callq bar@PLT
28 ; CHECK-NEXT: decl %ebp
29 ; CHECK-NEXT: cmpl %ebp, %ebx
30 ; CHECK-NEXT: jne .LBB0_2
31 ; CHECK-NEXT: # %bb.3:
32 ; CHECK-NEXT: addq $8, %rsp
33 ; CHECK-NEXT: popq %rbx
34 ; CHECK-NEXT: popq %rbp
37 %0 = icmp slt i32 %N, 0 ; <i1> [#uses=1]
38 br i1 %0, label %bb, label %return
40 bb: ; preds = %bb, %entry
41 %i.03 = phi i32 [ 0, %entry ], [ %2, %bb ] ; <i32> [#uses=2]
42 %1 = sitofp i32 %i.03 to double ; <double> [#uses=1]
43 tail call void @bar(double %1) nounwind
44 %2 = add nsw i32 %i.03, -1 ; <i32> [#uses=2]
45 %exitcond = icmp eq i32 %2, %N ; <i1> [#uses=1]
46 br i1 %exitcond, label %return, label %bb
48 return: ; preds = %bb, %entry
52 declare void @bar(double)