1; RUN: llc -mcpu=a2 < %s | FileCheck %s -check-prefix=FPCVT
2; RUN: llc -mcpu=ppc64 < %s | FileCheck %s -check-prefix=PPC64
3target datalayout = "E-m:e-i64:64-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6; Function Attrs: nounwind readnone
7define float @fool(float %X) #0 {
8entry:
9  %conv = fptosi float %X to i64
10  %conv1 = sitofp i64 %conv to float
11  ret float %conv1
12
13; FPCVT-LABEL: @fool
14; FPCVT: fctidz [[REG1:[0-9]+]], 1
15; FPCVT: fcfids 1, [[REG1]]
16; FPCVT: blr
17
18; PPC64-LABEL: @fool
19; PPC64: fctidz [[REG1:[0-9]+]], 1
20; PPC64: fcfid [[REG2:[0-9]+]], [[REG1]]
21; PPC64: frsp 1, [[REG2]]
22; PPC64: blr
23}
24
25; Function Attrs: nounwind readnone
26define double @foodl(double %X) #0 {
27entry:
28  %conv = fptosi double %X to i64
29  %conv1 = sitofp i64 %conv to double
30  ret double %conv1
31
32; FPCVT-LABEL: @foodl
33; FPCVT: fctidz [[REG1:[0-9]+]], 1
34; FPCVT: fcfid 1, [[REG1]]
35; FPCVT: blr
36
37; PPC64-LABEL: @foodl
38; PPC64: fctidz [[REG1:[0-9]+]], 1
39; PPC64: fcfid 1, [[REG1]]
40; PPC64: blr
41}
42
43; Function Attrs: nounwind readnone
44define float @fooul(float %X) #0 {
45entry:
46  %conv = fptoui float %X to i64
47  %conv1 = uitofp i64 %conv to float
48  ret float %conv1
49
50; FPCVT-LABEL: @fooul
51; FPCVT: fctiduz [[REG1:[0-9]+]], 1
52; FPCVT: fcfidus 1, [[REG1]]
53; FPCVT: blr
54}
55
56; Function Attrs: nounwind readnone
57define double @fooudl(double %X) #0 {
58entry:
59  %conv = fptoui double %X to i64
60  %conv1 = uitofp i64 %conv to double
61  ret double %conv1
62
63; FPCVT-LABEL: @fooudl
64; FPCVT: fctiduz [[REG1:[0-9]+]], 1
65; FPCVT: fcfidu 1, [[REG1]]
66; FPCVT: blr
67}
68
69attributes #0 = { nounwind readnone }
70
71