blob: b210a6bda8bf809fd3085faf7364805c651289f5 [file] [log] [blame]
Hal Finkelf5d5c432013-03-29 08:57:48 +00001; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
2; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-unsafe-fp-math | FileCheck -check-prefix=CHECK-FM %s
3target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6define float @test1(float %x) nounwind {
7 %call = tail call float @floorf(float %x) nounwind readnone
8 ret float %call
9
10; CHECK: test1:
11; CHECK: frim 1, 1
12
13; CHECK-FM: test1:
14; CHECK-FM: frim 1, 1
15}
16
17declare float @floorf(float) nounwind readnone
18
19define double @test2(double %x) nounwind {
20 %call = tail call double @floor(double %x) nounwind readnone
21 ret double %call
22
23; CHECK: test2:
24; CHECK: frim 1, 1
25
26; CHECK-FM: test2:
27; CHECK-FM: frim 1, 1
28}
29
30declare double @floor(double) nounwind readnone
31
32define float @test3(float %x) nounwind {
33 %call = tail call float @nearbyintf(float %x) nounwind readnone
34 ret float %call
35
36; CHECK: test3:
37; CHECK-NOT: frin
38
39; CHECK-FM: test3:
40; CHECK-FM: frin 1, 1
41}
42
43declare float @nearbyintf(float) nounwind readnone
44
45define double @test4(double %x) nounwind {
46 %call = tail call double @nearbyint(double %x) nounwind readnone
47 ret double %call
48
49; CHECK: test4:
50; CHECK-NOT: frin
51
52; CHECK-FM: test4:
53; CHECK-FM: frin 1, 1
54}
55
56declare double @nearbyint(double) nounwind readnone
57
58define float @test5(float %x) nounwind {
59 %call = tail call float @ceilf(float %x) nounwind readnone
60 ret float %call
61
62; CHECK: test5:
63; CHECK: frip 1, 1
64
65; CHECK-FM: test5:
66; CHECK-FM: frip 1, 1
67}
68
69declare float @ceilf(float) nounwind readnone
70
71define double @test6(double %x) nounwind {
72 %call = tail call double @ceil(double %x) nounwind readnone
73 ret double %call
74
75; CHECK: test6:
76; CHECK: frip 1, 1
77
78; CHECK-FM: test6:
79; CHECK-FM: frip 1, 1
80}
81
82declare double @ceil(double) nounwind readnone
83
84define float @test9(float %x) nounwind {
85 %call = tail call float @truncf(float %x) nounwind readnone
86 ret float %call
87
88; CHECK: test9:
89; CHECK: friz 1, 1
90
91; CHECK-FM: test9:
92; CHECK-FM: friz 1, 1
93}
94
95declare float @truncf(float) nounwind readnone
96
97define double @test10(double %x) nounwind {
98 %call = tail call double @trunc(double %x) nounwind readnone
99 ret double %call
100
101; CHECK: test10:
102; CHECK: friz 1, 1
103
104; CHECK-FM: test10:
105; CHECK-FM: friz 1, 1
106}
107
108declare double @trunc(double) nounwind readnone
Hal Finkel0882fd62013-03-29 19:41:55 +0000109
110define float @test11(float %x) nounwind {
111 %call = tail call float @rintf(float %x) nounwind readnone
112 ret float %call
113
114; CHECK: test11:
115; CHECK-NOT: frin
116
117; CHECK-FM: test11:
118; CHECK-FM: frin [[R2:[0-9]+]], [[R1:[0-9]+]]
119; CHECK-FM: fcmpu [[CR:[0-9]+]], [[R2]], [[R1]]
120; CHECK-FM: beq [[CR]], .LBB[[BB:[0-9]+]]_2
121; CHECK-FM: mtfsb1 6
122; CHECK-FM: .LBB[[BB]]_2:
123; CHECK-FM: blr
124}
125
126declare float @rintf(float) nounwind readnone
127
128define double @test12(double %x) nounwind {
129 %call = tail call double @rint(double %x) nounwind readnone
130 ret double %call
131
132; CHECK: test12:
133; CHECK-NOT: frin
134
135; CHECK-FM: test12:
136; CHECK-FM: frin [[R2:[0-9]+]], [[R1:[0-9]+]]
137; CHECK-FM: fcmpu [[CR:[0-9]+]], [[R2]], [[R1]]
138; CHECK-FM: beq [[CR]], .LBB[[BB:[0-9]+]]_2
139; CHECK-FM: mtfsb1 6
140; CHECK-FM: .LBB[[BB]]_2:
141; CHECK-FM: blr
142}
143
144declare double @rint(double) nounwind readnone
145