Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / CodeGen / PowerPC / save-cr-ppc32svr4.ll
blobc5f4bf369fecbea11ee0476a4f98279e7ae5a4db
1 ; RUN: llc -relocation-model pic < %s | FileCheck %s
3 ; Make sure that the CR register is saved correctly on PPC32/SVR4.
5 ; CHECK-LABEL: fred:
6 ; CHECK: stwu 1, -32(1)
7 ; CHECK: stw 31, 28(1)
8 ; CHECK: mr 31, 1
9 ; CHECK: stw 30, 24(1)
10 ; CHECK: mfcr [[CR:[0-9]+]]
11 ; CHECK: stw [[CR]], 20(31)
13 target datalayout = "E-m:e-p:32:32-i64:64-n32"
14 target triple = "powerpc-unknown-freebsd"
16 ; Function Attrs: norecurse nounwind readnone sspstrong
17 define i64 @fred(double %a0) local_unnamed_addr #0 {
18 b1:
19   %v2 = fcmp olt double %a0, 0x43E0000000000000
20   br i1 %v2, label %b3, label %b7
22 b3:                                               ; preds = %b1
23   %v4 = fcmp olt double %a0, 0xC3E0000000000000
24   %v5 = fptosi double %a0 to i64
25   %v6 = select i1 %v4, i64 -9223372036854775808, i64 %v5
26   br label %b14
28 b7:                                               ; preds = %b1
29   %v8 = fcmp olt double %a0, 0x43F0000000000000
30   br i1 %v8, label %b9, label %b11
32 b9:                                               ; preds = %b7
33   %v10 = fptoui double %a0 to i64
34   br label %b14
36 b11:                                              ; preds = %b7
37   %v12 = fcmp ogt double %a0, 0.000000e+00
38   %v13 = sext i1 %v12 to i64
39   br label %b14
41 b14:                                              ; preds = %b11, %b9, %b3
42   %v15 = phi i64 [ %v6, %b3 ], [ %v10, %b9 ], [ %v13, %b11 ]
43   ret i64 %v15
46 attributes #0 = { norecurse nounwind readnone sspstrong "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "stack-protector-buffer-size"="8" "target-cpu"="ppc" }