1; RUN: llc < %s -mcpu=generic -mtriple=x86_64-apple-macosx | FileCheck %s
2; PR10221
3
4;; The registers %x and %y must both spill across the finit call.
5;; Check that they are spilled early enough that not copies are needed for the
6;; fadd and fpext.
7
8; CHECK: pr10221
9; CHECK-NOT: movaps
10; CHECK:      movss
11; CHECK-NEXT: movss
12; CHECK-NEXT: addss
13; CHECK-NEXT: cvtss2sd
14; CHECK-NEXT: finit
15
16define i32 @pr10221(float %x, float %y, i8** nocapture %_retval) nounwind uwtable ssp {
17entry:
18  %add = fadd float %x, %y
19  %conv = fpext float %add to double
20  %call = tail call i32 @finit(double %conv) nounwind
21  %tobool = icmp eq i32 %call, 0
22  br i1 %tobool, label %return, label %if.end
23
24if.end:                                           ; preds = %entry
25  tail call void @foo(float %x, float %y) nounwind
26  br label %return
27
28return:                                           ; preds = %entry, %if.end
29  %retval.0 = phi i32 [ 0, %if.end ], [ 5, %entry ]
30  ret i32 %retval.0
31}
32
33declare i32 @finit(double)
34
35declare void @foo(float, float)
36