1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse2 | FileCheck %s
5 define float @foo(ptr %x, ptr %y, i32 %c) nounwind {
7 ; CHECK: ## %bb.0: ## %entry
8 ; CHECK-NEXT: pushl %esi
9 ; CHECK-NEXT: pushl %eax
10 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
11 ; CHECK-NEXT: testl %eax, %eax
12 ; CHECK-NEXT: je LBB0_1
13 ; CHECK-NEXT: ## %bb.2: ## %bb.preheader
14 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
15 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %edx
16 ; CHECK-NEXT: xorps %xmm0, %xmm0
17 ; CHECK-NEXT: xorl %esi, %esi
18 ; CHECK-NEXT: .p2align 4, 0x90
19 ; CHECK-NEXT: LBB0_3: ## %bb
20 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
21 ; CHECK-NEXT: xorps %xmm1, %xmm1
22 ; CHECK-NEXT: cvtsi2ssl (%edx,%esi,4), %xmm1
23 ; CHECK-NEXT: mulss (%ecx,%esi,4), %xmm1
24 ; CHECK-NEXT: addss %xmm1, %xmm0
25 ; CHECK-NEXT: incl %esi
26 ; CHECK-NEXT: cmpl %eax, %esi
27 ; CHECK-NEXT: jb LBB0_3
28 ; CHECK-NEXT: jmp LBB0_4
30 ; CHECK-NEXT: xorps %xmm0, %xmm0
31 ; CHECK-NEXT: LBB0_4: ## %bb23
32 ; CHECK-NEXT: movss %xmm0, (%esp)
33 ; CHECK-NEXT: flds (%esp)
34 ; CHECK-NEXT: addl $4, %esp
35 ; CHECK-NEXT: popl %esi
38 %tmp2132 = icmp eq i32 %c, 0 ; <i1> [#uses=2]
39 br i1 %tmp2132, label %bb23, label %bb.preheader
41 bb.preheader: ; preds = %entry
42 %umax = select i1 %tmp2132, i32 1, i32 %c ; <i32> [#uses=1]
45 bb: ; preds = %bb, %bb.preheader
46 %i.0.reg2mem.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; <i32> [#uses=3]
47 %res.0.reg2mem.0 = phi float [ 0.000000e+00, %bb.preheader ], [ %tmp14, %bb ] ; <float> [#uses=1]
48 %tmp3 = getelementptr i32, ptr %x, i32 %i.0.reg2mem.0 ; <ptr> [#uses=1]
49 %tmp4 = load i32, ptr %tmp3, align 4 ; <i32> [#uses=1]
50 %tmp45 = sitofp i32 %tmp4 to float ; <float> [#uses=1]
51 %tmp8 = getelementptr float, ptr %y, i32 %i.0.reg2mem.0 ; <ptr> [#uses=1]
52 %tmp9 = load float, ptr %tmp8, align 4 ; <float> [#uses=1]
53 %tmp11 = fmul float %tmp9, %tmp45 ; <float> [#uses=1]
54 %tmp14 = fadd float %tmp11, %res.0.reg2mem.0 ; <float> [#uses=2]
55 %indvar.next = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
56 %exitcond = icmp eq i32 %indvar.next, %umax ; <i1> [#uses=1]
57 br i1 %exitcond, label %bb23, label %bb
59 bb23: ; preds = %bb, %entry
60 %res.0.reg2mem.1 = phi float [ 0.000000e+00, %entry ], [ %tmp14, %bb ] ; <float> [#uses=1]
61 ret float %res.0.reg2mem.1