1; RUN: llc < %s -mcpu=generic -march=x86 -mattr=+sse | FileCheck %s
2
3define float @chainfail1(i64* nocapture %a, i64* nocapture %b, i32 %x, i32 %y, float* nocapture %f) nounwind uwtable noinline ssp {
4entry:
5  %tmp1 = load i64* %a, align 8
6; Insure x87 ops are properly chained, order preserved.
7; CHECK: fildll
8  %conv = sitofp i64 %tmp1 to float
9; CHECK: fstps
10  store float %conv, float* %f, align 4
11; CHECK: idivl
12  %div = sdiv i32 %x, %y
13  %conv5 = sext i32 %div to i64
14  store i64 %conv5, i64* %b, align 8
15  ret float %conv
16}
17
18define float @chainfail2(i64* nocapture %a, i64* nocapture %b, i32 %x, i32 %y, float* nocapture %f) nounwind uwtable noinline ssp {
19entry:
20; CHECK: movl $0,
21  store i64 0, i64* %b, align 8
22  %mul = mul nsw i32 %y, %x
23  %sub = add nsw i32 %mul, -1
24  %idxprom = sext i32 %sub to i64
25  %arrayidx = getelementptr inbounds i64* %a, i64 %idxprom
26  %tmp4 = load i64* %arrayidx, align 8
27; CHECK: fildll
28  %conv = sitofp i64 %tmp4 to float
29  store float %conv, float* %f, align 4
30  ret float %conv
31}
32
33define void @PR17495() {
34entry:
35  br i1 undef, label %while.end, label %while.body
36
37while.body:                                       ; preds = %while.body, %entry
38  %x.1.copyload = load i24* undef, align 1
39  %conv = sitofp i24 %x.1.copyload to float
40  %div = fmul float %conv, 0x3E80000000000000
41  store float %div, float* undef, align 4
42  br i1 false, label %while.end, label %while.body
43
44while.end:                                        ; preds = %while.body, %entry
45  ret void
46
47; CHECK-LABEL: @PR17495
48; CHECK-NOT: fildll
49}
50