1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-macosx -mattr=+sse4.1 | FileCheck -check-prefix=CHECK-SSE %s
3 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck -check-prefix=CHECK-AVX %s
4 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-macosx -mattr=+avx512f | FileCheck -check-prefix=CHECK-AVX512 %s
6 define float @test1(float %x) nounwind {
7 ; CHECK-SSE-LABEL: test1:
9 ; CHECK-SSE-NEXT: roundss $9, %xmm0, %xmm0
10 ; CHECK-SSE-NEXT: retq
12 ; CHECK-AVX-LABEL: test1:
13 ; CHECK-AVX: ## %bb.0:
14 ; CHECK-AVX-NEXT: vroundss $9, %xmm0, %xmm0, %xmm0
15 ; CHECK-AVX-NEXT: retq
17 ; CHECK-AVX512-LABEL: test1:
18 ; CHECK-AVX512: ## %bb.0:
19 ; CHECK-AVX512-NEXT: vroundss $9, %xmm0, %xmm0, %xmm0
20 ; CHECK-AVX512-NEXT: retq
21 %call = tail call float @floorf(float %x) nounwind readnone
25 declare float @floorf(float) nounwind readnone
27 define double @test2(double %x) nounwind {
28 ; CHECK-SSE-LABEL: test2:
29 ; CHECK-SSE: ## %bb.0:
30 ; CHECK-SSE-NEXT: roundsd $9, %xmm0, %xmm0
31 ; CHECK-SSE-NEXT: retq
33 ; CHECK-AVX-LABEL: test2:
34 ; CHECK-AVX: ## %bb.0:
35 ; CHECK-AVX-NEXT: vroundsd $9, %xmm0, %xmm0, %xmm0
36 ; CHECK-AVX-NEXT: retq
38 ; CHECK-AVX512-LABEL: test2:
39 ; CHECK-AVX512: ## %bb.0:
40 ; CHECK-AVX512-NEXT: vroundsd $9, %xmm0, %xmm0, %xmm0
41 ; CHECK-AVX512-NEXT: retq
42 %call = tail call double @floor(double %x) nounwind readnone
46 declare double @floor(double) nounwind readnone
48 define float @test3(float %x) nounwind {
49 ; CHECK-SSE-LABEL: test3:
50 ; CHECK-SSE: ## %bb.0:
51 ; CHECK-SSE-NEXT: roundss $12, %xmm0, %xmm0
52 ; CHECK-SSE-NEXT: retq
54 ; CHECK-AVX-LABEL: test3:
55 ; CHECK-AVX: ## %bb.0:
56 ; CHECK-AVX-NEXT: vroundss $12, %xmm0, %xmm0, %xmm0
57 ; CHECK-AVX-NEXT: retq
59 ; CHECK-AVX512-LABEL: test3:
60 ; CHECK-AVX512: ## %bb.0:
61 ; CHECK-AVX512-NEXT: vroundss $12, %xmm0, %xmm0, %xmm0
62 ; CHECK-AVX512-NEXT: retq
63 %call = tail call float @nearbyintf(float %x) nounwind readnone
67 declare float @nearbyintf(float) nounwind readnone
69 define double @test4(double %x) nounwind {
70 ; CHECK-SSE-LABEL: test4:
71 ; CHECK-SSE: ## %bb.0:
72 ; CHECK-SSE-NEXT: roundsd $12, %xmm0, %xmm0
73 ; CHECK-SSE-NEXT: retq
75 ; CHECK-AVX-LABEL: test4:
76 ; CHECK-AVX: ## %bb.0:
77 ; CHECK-AVX-NEXT: vroundsd $12, %xmm0, %xmm0, %xmm0
78 ; CHECK-AVX-NEXT: retq
80 ; CHECK-AVX512-LABEL: test4:
81 ; CHECK-AVX512: ## %bb.0:
82 ; CHECK-AVX512-NEXT: vroundsd $12, %xmm0, %xmm0, %xmm0
83 ; CHECK-AVX512-NEXT: retq
84 %call = tail call double @nearbyint(double %x) nounwind readnone
88 declare double @nearbyint(double) nounwind readnone
90 define float @test5(float %x) nounwind {
91 ; CHECK-SSE-LABEL: test5:
92 ; CHECK-SSE: ## %bb.0:
93 ; CHECK-SSE-NEXT: roundss $10, %xmm0, %xmm0
94 ; CHECK-SSE-NEXT: retq
96 ; CHECK-AVX-LABEL: test5:
97 ; CHECK-AVX: ## %bb.0:
98 ; CHECK-AVX-NEXT: vroundss $10, %xmm0, %xmm0, %xmm0
99 ; CHECK-AVX-NEXT: retq
101 ; CHECK-AVX512-LABEL: test5:
102 ; CHECK-AVX512: ## %bb.0:
103 ; CHECK-AVX512-NEXT: vroundss $10, %xmm0, %xmm0, %xmm0
104 ; CHECK-AVX512-NEXT: retq
105 %call = tail call float @ceilf(float %x) nounwind readnone
109 declare float @ceilf(float) nounwind readnone
111 define double @test6(double %x) nounwind {
112 ; CHECK-SSE-LABEL: test6:
113 ; CHECK-SSE: ## %bb.0:
114 ; CHECK-SSE-NEXT: roundsd $10, %xmm0, %xmm0
115 ; CHECK-SSE-NEXT: retq
117 ; CHECK-AVX-LABEL: test6:
118 ; CHECK-AVX: ## %bb.0:
119 ; CHECK-AVX-NEXT: vroundsd $10, %xmm0, %xmm0, %xmm0
120 ; CHECK-AVX-NEXT: retq
122 ; CHECK-AVX512-LABEL: test6:
123 ; CHECK-AVX512: ## %bb.0:
124 ; CHECK-AVX512-NEXT: vroundsd $10, %xmm0, %xmm0, %xmm0
125 ; CHECK-AVX512-NEXT: retq
126 %call = tail call double @ceil(double %x) nounwind readnone
130 declare double @ceil(double) nounwind readnone
132 define float @test7(float %x) nounwind {
133 ; CHECK-SSE-LABEL: test7:
134 ; CHECK-SSE: ## %bb.0:
135 ; CHECK-SSE-NEXT: roundss $4, %xmm0, %xmm0
136 ; CHECK-SSE-NEXT: retq
138 ; CHECK-AVX-LABEL: test7:
139 ; CHECK-AVX: ## %bb.0:
140 ; CHECK-AVX-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0
141 ; CHECK-AVX-NEXT: retq
143 ; CHECK-AVX512-LABEL: test7:
144 ; CHECK-AVX512: ## %bb.0:
145 ; CHECK-AVX512-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0
146 ; CHECK-AVX512-NEXT: retq
147 %call = tail call float @rintf(float %x) nounwind readnone
151 declare float @rintf(float) nounwind readnone
153 define double @test8(double %x) nounwind {
154 ; CHECK-SSE-LABEL: test8:
155 ; CHECK-SSE: ## %bb.0:
156 ; CHECK-SSE-NEXT: roundsd $4, %xmm0, %xmm0
157 ; CHECK-SSE-NEXT: retq
159 ; CHECK-AVX-LABEL: test8:
160 ; CHECK-AVX: ## %bb.0:
161 ; CHECK-AVX-NEXT: vroundsd $4, %xmm0, %xmm0, %xmm0
162 ; CHECK-AVX-NEXT: retq
164 ; CHECK-AVX512-LABEL: test8:
165 ; CHECK-AVX512: ## %bb.0:
166 ; CHECK-AVX512-NEXT: vroundsd $4, %xmm0, %xmm0, %xmm0
167 ; CHECK-AVX512-NEXT: retq
168 %call = tail call double @rint(double %x) nounwind readnone
172 declare double @rint(double) nounwind readnone
174 define float @test9(float %x) nounwind {
175 ; CHECK-SSE-LABEL: test9:
176 ; CHECK-SSE: ## %bb.0:
177 ; CHECK-SSE-NEXT: roundss $11, %xmm0, %xmm0
178 ; CHECK-SSE-NEXT: retq
180 ; CHECK-AVX-LABEL: test9:
181 ; CHECK-AVX: ## %bb.0:
182 ; CHECK-AVX-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0
183 ; CHECK-AVX-NEXT: retq
185 ; CHECK-AVX512-LABEL: test9:
186 ; CHECK-AVX512: ## %bb.0:
187 ; CHECK-AVX512-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0
188 ; CHECK-AVX512-NEXT: retq
189 %call = tail call float @truncf(float %x) nounwind readnone
193 declare float @truncf(float) nounwind readnone
195 define double @test10(double %x) nounwind {
196 ; CHECK-SSE-LABEL: test10:
197 ; CHECK-SSE: ## %bb.0:
198 ; CHECK-SSE-NEXT: roundsd $11, %xmm0, %xmm0
199 ; CHECK-SSE-NEXT: retq
201 ; CHECK-AVX-LABEL: test10:
202 ; CHECK-AVX: ## %bb.0:
203 ; CHECK-AVX-NEXT: vroundsd $11, %xmm0, %xmm0, %xmm0
204 ; CHECK-AVX-NEXT: retq
206 ; CHECK-AVX512-LABEL: test10:
207 ; CHECK-AVX512: ## %bb.0:
208 ; CHECK-AVX512-NEXT: vroundsd $11, %xmm0, %xmm0, %xmm0
209 ; CHECK-AVX512-NEXT: retq
210 %call = tail call double @trunc(double %x) nounwind readnone
214 declare double @trunc(double) nounwind readnone
216 define float @test11(ptr %xptr) nounwind optsize {
217 ; CHECK-SSE-LABEL: test11:
218 ; CHECK-SSE: ## %bb.0:
219 ; CHECK-SSE-NEXT: roundss $11, (%rdi), %xmm0
220 ; CHECK-SSE-NEXT: retq
222 ; CHECK-AVX-LABEL: test11:
223 ; CHECK-AVX: ## %bb.0:
224 ; CHECK-AVX-NEXT: vroundss $11, (%rdi), %xmm0, %xmm0
225 ; CHECK-AVX-NEXT: retq
227 ; CHECK-AVX512-LABEL: test11:
228 ; CHECK-AVX512: ## %bb.0:
229 ; CHECK-AVX512-NEXT: vroundss $11, (%rdi), %xmm0, %xmm0
230 ; CHECK-AVX512-NEXT: retq
231 %x = load float, ptr %xptr
232 %call = tail call float @truncf(float %x) nounwind readnone
236 define double @test12(ptr %xptr) nounwind optsize {
237 ; CHECK-SSE-LABEL: test12:
238 ; CHECK-SSE: ## %bb.0:
239 ; CHECK-SSE-NEXT: roundsd $11, (%rdi), %xmm0
240 ; CHECK-SSE-NEXT: retq
242 ; CHECK-AVX-LABEL: test12:
243 ; CHECK-AVX: ## %bb.0:
244 ; CHECK-AVX-NEXT: vroundsd $11, (%rdi), %xmm0, %xmm0
245 ; CHECK-AVX-NEXT: retq
247 ; CHECK-AVX512-LABEL: test12:
248 ; CHECK-AVX512: ## %bb.0:
249 ; CHECK-AVX512-NEXT: vroundsd $11, (%rdi), %xmm0, %xmm0
250 ; CHECK-AVX512-NEXT: retq
251 %x = load double, ptr %xptr
252 %call = tail call double @trunc(double %x) nounwind readnone
256 define float @test11_pgso(ptr %xptr) nounwind !prof !14 {
257 ; CHECK-SSE-LABEL: test11_pgso:
258 ; CHECK-SSE: ## %bb.0:
259 ; CHECK-SSE-NEXT: roundss $11, (%rdi), %xmm0
260 ; CHECK-SSE-NEXT: retq
262 ; CHECK-AVX-LABEL: test11_pgso:
263 ; CHECK-AVX: ## %bb.0:
264 ; CHECK-AVX-NEXT: vroundss $11, (%rdi), %xmm0, %xmm0
265 ; CHECK-AVX-NEXT: retq
267 ; CHECK-AVX512-LABEL: test11_pgso:
268 ; CHECK-AVX512: ## %bb.0:
269 ; CHECK-AVX512-NEXT: vroundss $11, (%rdi), %xmm0, %xmm0
270 ; CHECK-AVX512-NEXT: retq
271 %x = load float, ptr %xptr
272 %call = tail call float @truncf(float %x) nounwind readnone
276 define double @test12_pgso(ptr %xptr) nounwind !prof !14 {
277 ; CHECK-SSE-LABEL: test12_pgso:
278 ; CHECK-SSE: ## %bb.0:
279 ; CHECK-SSE-NEXT: roundsd $11, (%rdi), %xmm0
280 ; CHECK-SSE-NEXT: retq
282 ; CHECK-AVX-LABEL: test12_pgso:
283 ; CHECK-AVX: ## %bb.0:
284 ; CHECK-AVX-NEXT: vroundsd $11, (%rdi), %xmm0, %xmm0
285 ; CHECK-AVX-NEXT: retq
287 ; CHECK-AVX512-LABEL: test12_pgso:
288 ; CHECK-AVX512: ## %bb.0:
289 ; CHECK-AVX512-NEXT: vroundsd $11, (%rdi), %xmm0, %xmm0
290 ; CHECK-AVX512-NEXT: retq
291 %x = load double, ptr %xptr
292 %call = tail call double @trunc(double %x) nounwind readnone
296 !llvm.module.flags = !{!0}
297 !0 = !{i32 1, !"ProfileSummary", !1}
298 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
299 !2 = !{!"ProfileFormat", !"InstrProf"}
300 !3 = !{!"TotalCount", i64 10000}
301 !4 = !{!"MaxCount", i64 10}
302 !5 = !{!"MaxInternalCount", i64 1}
303 !6 = !{!"MaxFunctionCount", i64 1000}
304 !7 = !{!"NumCounts", i64 3}
305 !8 = !{!"NumFunctions", i64 3}
306 !9 = !{!"DetailedSummary", !10}
307 !10 = !{!11, !12, !13}
308 !11 = !{i32 10000, i64 100, i32 1}
309 !12 = !{i32 999000, i64 100, i32 1}
310 !13 = !{i32 999999, i64 1, i32 2}
311 !14 = !{!"function_entry_count", i64 0}