blob: d487aabccc4f11defccbe72d88cc78f75bc687ae [file] [log] [blame]
Stephen Canon8216d882015-09-22 11:43:17 +00001; RUN: llc -O3 < %s -mtriple=arm64 | FileCheck %s
Tim Northover00ed9962014-03-29 10:18:08 +00002
Stephen Canon8216d882015-09-22 11:43:17 +00003; CHECK-LABEL: test1:
4; CHECK: frintm
5; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +00006define float @test1(float %a) #0 {
7entry:
8 %call = tail call float @floorf(float %a) nounwind readnone
9 ret float %call
10}
11
12declare float @floorf(float) nounwind readnone
13
Stephen Canon8216d882015-09-22 11:43:17 +000014; CHECK-LABEL: test2:
15; CHECK: frintm
16; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000017define double @test2(double %a) #0 {
18entry:
19 %call = tail call double @floor(double %a) nounwind readnone
20 ret double %call
21}
22
23declare double @floor(double) nounwind readnone
24
Stephen Canon8216d882015-09-22 11:43:17 +000025; CHECK-LABEL: test3:
26; CHECK: frinti
Tim Northover00ed9962014-03-29 10:18:08 +000027define float @test3(float %a) #0 {
28entry:
29 %call = tail call float @nearbyintf(float %a) nounwind readnone
30 ret float %call
31}
32
33declare float @nearbyintf(float) nounwind readnone
34
Stephen Canon8216d882015-09-22 11:43:17 +000035; CHECK-LABEL: test4:
36; CHECK: frinti
Tim Northover00ed9962014-03-29 10:18:08 +000037define double @test4(double %a) #0 {
38entry:
39 %call = tail call double @nearbyint(double %a) nounwind readnone
40 ret double %call
41}
42
43declare double @nearbyint(double) nounwind readnone
44
Stephen Canon8216d882015-09-22 11:43:17 +000045; CHECK-LABEL: test5:
46; CHECK: frintp
47; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000048define float @test5(float %a) #0 {
49entry:
50 %call = tail call float @ceilf(float %a) nounwind readnone
51 ret float %call
52}
53
54declare float @ceilf(float) nounwind readnone
55
Stephen Canon8216d882015-09-22 11:43:17 +000056; CHECK-LABEL: test6:
57; CHECK: frintp
58; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000059define double @test6(double %a) #0 {
60entry:
61 %call = tail call double @ceil(double %a) nounwind readnone
62 ret double %call
63}
64
65declare double @ceil(double) nounwind readnone
66
Stephen Canon8216d882015-09-22 11:43:17 +000067; CHECK-LABEL: test7:
68; CHECK: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000069define float @test7(float %a) #0 {
70entry:
71 %call = tail call float @rintf(float %a) nounwind readnone
72 ret float %call
73}
74
75declare float @rintf(float) nounwind readnone
76
Stephen Canon8216d882015-09-22 11:43:17 +000077; CHECK-LABEL: test8:
78; CHECK: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000079define double @test8(double %a) #0 {
80entry:
81 %call = tail call double @rint(double %a) nounwind readnone
82 ret double %call
83}
84
85declare double @rint(double) nounwind readnone
86
Stephen Canon8216d882015-09-22 11:43:17 +000087; CHECK-LABEL: test9:
88; CHECK: frintz
89; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +000090define float @test9(float %a) #0 {
91entry:
92 %call = tail call float @truncf(float %a) nounwind readnone
93 ret float %call
94}
95
96declare float @truncf(float) nounwind readnone
97
Stephen Canon8216d882015-09-22 11:43:17 +000098; CHECK-LABEL: test10:
99; CHECK: frintz
100; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +0000101define double @test10(double %a) #0 {
102entry:
103 %call = tail call double @trunc(double %a) nounwind readnone
104 ret double %call
105}
106
107declare double @trunc(double) nounwind readnone
108
Stephen Canon8216d882015-09-22 11:43:17 +0000109; CHECK-LABEL: test11:
110; CHECK: frinta
111; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +0000112define float @test11(float %a) #0 {
113entry:
114 %call = tail call float @roundf(float %a) nounwind readnone
115 ret float %call
116}
117
118declare float @roundf(float %a) nounwind readnone
119
Stephen Canon8216d882015-09-22 11:43:17 +0000120; CHECK-LABEL: test12:
121; CHECK: frinta
122; CHECK-NOT: frintx
Tim Northover00ed9962014-03-29 10:18:08 +0000123define double @test12(double %a) #0 {
124entry:
125 %call = tail call double @round(double %a) nounwind readnone
126 ret double %call
127}
128
129declare double @round(double %a) nounwind readnone
130
Stephen Canon8216d882015-09-22 11:43:17 +0000131; CHECK-LABEL: test13:
132; CHECK-NOT: frintx
133; CHECK: frintm
Tim Northover00ed9962014-03-29 10:18:08 +0000134define float @test13(float %a) #1 {
135entry:
136 %call = tail call float @floorf(float %a) nounwind readnone
137 ret float %call
138}
139
Stephen Canon8216d882015-09-22 11:43:17 +0000140; CHECK-LABEL: test14:
141; CHECK-NOT: frintx
142; CHECK: frintm
Tim Northover00ed9962014-03-29 10:18:08 +0000143define double @test14(double %a) #1 {
144entry:
145 %call = tail call double @floor(double %a) nounwind readnone
146 ret double %call
147}
148
Stephen Canon8216d882015-09-22 11:43:17 +0000149; CHECK-LABEL: test15:
150; CHECK-NOT: frintx
151; CHECK: frintp
Tim Northover00ed9962014-03-29 10:18:08 +0000152define float @test15(float %a) #1 {
153entry:
154 %call = tail call float @ceilf(float %a) nounwind readnone
155 ret float %call
156}
157
Stephen Canon8216d882015-09-22 11:43:17 +0000158; CHECK-LABEL: test16:
159; CHECK-NOT: frintx
160; CHECK: frintp
Tim Northover00ed9962014-03-29 10:18:08 +0000161define double @test16(double %a) #1 {
162entry:
163 %call = tail call double @ceil(double %a) nounwind readnone
164 ret double %call
165}
166
Stephen Canon8216d882015-09-22 11:43:17 +0000167; CHECK-LABEL: test17:
168; CHECK-NOT: frintx
169; CHECK: frintz
Tim Northover00ed9962014-03-29 10:18:08 +0000170define float @test17(float %a) #1 {
171entry:
172 %call = tail call float @truncf(float %a) nounwind readnone
173 ret float %call
174}
175
Stephen Canon8216d882015-09-22 11:43:17 +0000176; CHECK-LABEL: test18:
177; CHECK-NOT: frintx
178; CHECK: frintz
Tim Northover00ed9962014-03-29 10:18:08 +0000179define double @test18(double %a) #1 {
180entry:
181 %call = tail call double @trunc(double %a) nounwind readnone
182 ret double %call
183}
184
Stephen Canon8216d882015-09-22 11:43:17 +0000185; CHECK-LABEL: test19:
186; CHECK-NOT: frintx
187; CHECK: frinta
Tim Northover00ed9962014-03-29 10:18:08 +0000188define float @test19(float %a) #1 {
189entry:
190 %call = tail call float @roundf(float %a) nounwind readnone
191 ret float %call
192}
193
Stephen Canon8216d882015-09-22 11:43:17 +0000194; CHECK-LABEL: test20:
195; CHECK-NOT: frintx
196; CHECK: frinta
Tim Northover00ed9962014-03-29 10:18:08 +0000197define double @test20(double %a) #1 {
198entry:
199 %call = tail call double @round(double %a) nounwind readnone
200 ret double %call
201}
202
Tim Northover00ed9962014-03-29 10:18:08 +0000203attributes #0 = { nounwind }
204attributes #1 = { nounwind "unsafe-fp-math"="true" }