blob: a739a02105fdce7d436cbe0186ea63e6da3d0c99 [file] [log] [blame]
Matthias Braune2d2ce92017-08-01 22:20:41 +00001; RUN: llc -relocation-model pic < %s | FileCheck %s
Krzysztof Parzyszek2b053312017-05-17 13:25:09 +00002;
3; Make sure that the CR register is saved correctly on PPC32/SVR4.
4
5; CHECK-LABEL: fred:
Stefan Pintilie0c122d52018-07-19 19:34:18 +00006; CHECK: stwu 1, -48(1)
7; CHECK: stw 31, 36(1)
Krzysztof Parzyszek2b053312017-05-17 13:25:09 +00008; CHECK: mr 31, 1
Stefan Pintilie0c122d52018-07-19 19:34:18 +00009; CHECK-DAG: stw 30, 32(1)
Stefan Pintiliecb4f0c52018-07-04 18:54:25 +000010; CHECK-DAG: mfcr [[CR:[0-9]+]]
Stefan Pintilie0c122d52018-07-19 19:34:18 +000011; CHECK: stw [[CR]], 28(31)
Krzysztof Parzyszek2b053312017-05-17 13:25:09 +000012
13target datalayout = "E-m:e-p:32:32-i64:64-n32"
14target triple = "powerpc-unknown-freebsd"
15
16; Function Attrs: norecurse nounwind readnone sspstrong
17define i64 @fred(double %a0) local_unnamed_addr #0 {
18b1:
Stefan Pintilie0c122d52018-07-19 19:34:18 +000019 %a1 = tail call double asm "fadd $0, $1, $2", "=f,f,f,~{cr2}"(double %a0, double %a0)
20 %v2 = fcmp olt double %a1, 0x43E0000000000000
Krzysztof Parzyszek2b053312017-05-17 13:25:09 +000021 br i1 %v2, label %b3, label %b7
22
23b3: ; preds = %b1
24 %v4 = fcmp olt double %a0, 0xC3E0000000000000
25 %v5 = fptosi double %a0 to i64
26 %v6 = select i1 %v4, i64 -9223372036854775808, i64 %v5
27 br label %b14
28
29b7: ; preds = %b1
30 %v8 = fcmp olt double %a0, 0x43F0000000000000
31 br i1 %v8, label %b9, label %b11
32
33b9: ; preds = %b7
34 %v10 = fptoui double %a0 to i64
35 br label %b14
36
37b11: ; preds = %b7
38 %v12 = fcmp ogt double %a0, 0.000000e+00
39 %v13 = sext i1 %v12 to i64
40 br label %b14
41
42b14: ; preds = %b11, %b9, %b3
43 %v15 = phi i64 [ %v6, %b3 ], [ %v10, %b9 ], [ %v13, %b11 ]
44 ret i64 %v15
45}
46
47attributes #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" }