1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-w64-windows-gnu | FileCheck %s
4 @a = global i32 0, align 4
5 @b = global float 0.000000e+00, align 4
6 @d = global float 0.000000e+00, align 4
7 @f = global i32 0, align 4
8 @g = global float 0.000000e+00, align 4
9 @e = global i32 0, align 4
10 @c = global ptr null, align 4
12 ; The FP stack should be preserved across the call to __alloca.
13 define void @h(float %i) {
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: pushl %ebp
17 ; CHECK-NEXT: .cfi_def_cfa_offset 8
18 ; CHECK-NEXT: .cfi_offset %ebp, -8
19 ; CHECK-NEXT: movl %esp, %ebp
20 ; CHECK-NEXT: .cfi_def_cfa_register %ebp
21 ; CHECK-NEXT: pushl %esi
22 ; CHECK-NEXT: andl $-16, %esp
23 ; CHECK-NEXT: subl $32, %esp
24 ; CHECK-NEXT: movl %esp, %esi
25 ; CHECK-NEXT: .cfi_offset %esi, -12
26 ; CHECK-NEXT: flds 8(%ebp)
27 ; CHECK-NEXT: movl _a, %ecx
28 ; CHECK-NEXT: leal 3(%ecx), %eax
29 ; CHECK-NEXT: andl $-4, %eax
30 ; CHECK-NEXT: calll __alloca
31 ; CHECK-NEXT: movl %esp, %eax
32 ; CHECK-NEXT: andl $-16, %eax
33 ; CHECK-NEXT: movl %eax, %esp
34 ; CHECK-NEXT: fsts 8(%esi) # 4-byte Folded Spill
35 ; CHECK-NEXT: fadds _b
39 ; CHECK-NEXT: testl %ecx, %ecx
40 ; CHECK-NEXT: fld %st(0)
41 ; CHECK-NEXT: fld %st(2)
42 ; CHECK-NEXT: je LBB0_2
43 ; CHECK-NEXT: # %bb.1: # %for.body.preheader
44 ; CHECK-NEXT: fstp %st(1)
45 ; CHECK-NEXT: fstp %st(0)
46 ; CHECK-NEXT: movl _f, %ecx
47 ; CHECK-NEXT: flds (%eax,%ecx,4)
48 ; CHECK-NEXT: fld %st(3)
49 ; CHECK-NEXT: LBB0_2: # %for.cond1.preheader
50 ; CHECK-NEXT: movl _e, %ecx
51 ; CHECK-NEXT: movl %ecx, 12(%esi)
52 ; CHECK-NEXT: fildl 12(%esi)
53 ; CHECK-NEXT: movl _c, %edx
54 ; CHECK-NEXT: jmp LBB0_3
55 ; CHECK-NEXT: .p2align 4, 0x90
56 ; CHECK-NEXT: LBB0_5: # %for.inc
57 ; CHECK-NEXT: # in Loop: Header=BB0_3 Depth=1
58 ; CHECK-NEXT: fxch %st(5)
59 ; CHECK-NEXT: fadd %st(4), %st
60 ; CHECK-NEXT: fxch %st(5)
61 ; CHECK-NEXT: LBB0_3: # %for.cond1
62 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
63 ; CHECK-NEXT: fld %st(5)
64 ; CHECK-NEXT: fmul %st(4), %st
65 ; CHECK-NEXT: fdiv %st(2), %st
66 ; CHECK-NEXT: fadd %st(3), %st
68 ; CHECK-NEXT: fxch %st(1)
69 ; CHECK-NEXT: fucom %st(1)
70 ; CHECK-NEXT: fstp %st(1)
71 ; CHECK-NEXT: fnstsw %ax
72 ; CHECK-NEXT: # kill: def $ah killed $ah killed $ax
74 ; CHECK-NEXT: jbe LBB0_5
75 ; CHECK-NEXT: # %bb.4: # %if.then
76 ; CHECK-NEXT: # in Loop: Header=BB0_3 Depth=1
77 ; CHECK-NEXT: flds 8(%esi) # 4-byte Folded Reload
78 ; CHECK-NEXT: fstps (%edx,%ecx,4)
79 ; CHECK-NEXT: jmp LBB0_5
81 %0 = load i32, ptr @a, align 4
82 %1 = alloca i8, i32 %0, align 16
83 %2 = load float, ptr @b, align 4
84 %add = fadd float %2, %i
85 store float %add, ptr @d, align 4
86 %tobool.not = icmp eq i32 %0, 0
87 br i1 %tobool.not, label %for.cond1.preheader, label %for.body.preheader
89 for.body.preheader: ; preds = %entry
90 %3 = load i32, ptr @f, align 4
91 %arrayidx.le = getelementptr inbounds float, ptr %1, i32 %3
92 %4 = load float, ptr %arrayidx.le, align 4
93 br label %for.cond1.preheader
95 for.cond1.preheader: ; preds = %for.body.preheader, %entry
96 %k.0.lcssa = phi float [ %4, %for.body.preheader ], [ undef, %entry ]
97 %l.0.lcssa = phi float [ %add, %for.body.preheader ], [ 1.000000e+00, %entry ]
98 %5 = load i32, ptr @e, align 4
99 %conv = sitofp i32 %5 to float
100 %6 = load ptr, ptr @c, align 4
101 %arrayidx4 = getelementptr inbounds float, ptr %6, i32 %5
104 for.cond1: ; preds = %for.inc, %for.cond1.preheader
105 %m.0 = phi float [ %add5, %for.inc ], [ %add, %for.cond1.preheader ]
106 %mul = fmul float %m.0, 0.000000e+00
107 %div = fdiv float %mul, %l.0.lcssa
108 %add2 = fadd float %k.0.lcssa, %div
109 store float %add2, ptr @g, align 4
110 %cmp = fcmp olt float %add2, %conv
111 br i1 %cmp, label %if.then, label %for.inc
113 if.then: ; preds = %for.cond1
114 store float %i, ptr %arrayidx4, align 4
117 for.inc: ; preds = %if.then, %for.cond1
118 %add5 = fadd float %m.0, 1.000000e+00