• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5
6define float @test1(float %x) nounwind  {
7; CHECK-SSE-LABEL: test1:
8; CHECK-SSE:       ## %bb.0:
9; CHECK-SSE-NEXT:    roundss $9, %xmm0, %xmm0
10; CHECK-SSE-NEXT:    retq
11;
12; CHECK-AVX-LABEL: test1:
13; CHECK-AVX:       ## %bb.0:
14; CHECK-AVX-NEXT:    vroundss $9, %xmm0, %xmm0, %xmm0
15; CHECK-AVX-NEXT:    retq
16;
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
22  ret float %call
23}
24
25declare float @floorf(float) nounwind readnone
26
27define 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
32;
33; CHECK-AVX-LABEL: test2:
34; CHECK-AVX:       ## %bb.0:
35; CHECK-AVX-NEXT:    vroundsd $9, %xmm0, %xmm0, %xmm0
36; CHECK-AVX-NEXT:    retq
37;
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
43  ret double %call
44}
45
46declare double @floor(double) nounwind readnone
47
48define 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
53;
54; CHECK-AVX-LABEL: test3:
55; CHECK-AVX:       ## %bb.0:
56; CHECK-AVX-NEXT:    vroundss $12, %xmm0, %xmm0, %xmm0
57; CHECK-AVX-NEXT:    retq
58;
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
64  ret float %call
65}
66
67declare float @nearbyintf(float) nounwind readnone
68
69define 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
74;
75; CHECK-AVX-LABEL: test4:
76; CHECK-AVX:       ## %bb.0:
77; CHECK-AVX-NEXT:    vroundsd $12, %xmm0, %xmm0, %xmm0
78; CHECK-AVX-NEXT:    retq
79;
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
85  ret double %call
86}
87
88declare double @nearbyint(double) nounwind readnone
89
90define 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
95;
96; CHECK-AVX-LABEL: test5:
97; CHECK-AVX:       ## %bb.0:
98; CHECK-AVX-NEXT:    vroundss $10, %xmm0, %xmm0, %xmm0
99; CHECK-AVX-NEXT:    retq
100;
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
106  ret float %call
107}
108
109declare float @ceilf(float) nounwind readnone
110
111define 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
116;
117; CHECK-AVX-LABEL: test6:
118; CHECK-AVX:       ## %bb.0:
119; CHECK-AVX-NEXT:    vroundsd $10, %xmm0, %xmm0, %xmm0
120; CHECK-AVX-NEXT:    retq
121;
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
127  ret double %call
128}
129
130declare double @ceil(double) nounwind readnone
131
132define 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
137;
138; CHECK-AVX-LABEL: test7:
139; CHECK-AVX:       ## %bb.0:
140; CHECK-AVX-NEXT:    vroundss $4, %xmm0, %xmm0, %xmm0
141; CHECK-AVX-NEXT:    retq
142;
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
148  ret float %call
149}
150
151declare float @rintf(float) nounwind readnone
152
153define 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
158;
159; CHECK-AVX-LABEL: test8:
160; CHECK-AVX:       ## %bb.0:
161; CHECK-AVX-NEXT:    vroundsd $4, %xmm0, %xmm0, %xmm0
162; CHECK-AVX-NEXT:    retq
163;
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
169  ret double %call
170}
171
172declare double @rint(double) nounwind readnone
173
174define 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
179;
180; CHECK-AVX-LABEL: test9:
181; CHECK-AVX:       ## %bb.0:
182; CHECK-AVX-NEXT:    vroundss $11, %xmm0, %xmm0, %xmm0
183; CHECK-AVX-NEXT:    retq
184;
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
190  ret float %call
191}
192
193declare float @truncf(float) nounwind readnone
194
195define 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
200;
201; CHECK-AVX-LABEL: test10:
202; CHECK-AVX:       ## %bb.0:
203; CHECK-AVX-NEXT:    vroundsd $11, %xmm0, %xmm0, %xmm0
204; CHECK-AVX-NEXT:    retq
205;
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
211  ret double %call
212}
213
214declare double @trunc(double) nounwind readnone
215
216define float @test11(float* %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
221;
222; CHECK-AVX-LABEL: test11:
223; CHECK-AVX:       ## %bb.0:
224; CHECK-AVX-NEXT:    vroundss $11, (%rdi), %xmm0, %xmm0
225; CHECK-AVX-NEXT:    retq
226;
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, float* %xptr
232  %call = tail call float @truncf(float %x) nounwind readnone
233  ret float %call
234}
235
236define double @test12(double* %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
241;
242; CHECK-AVX-LABEL: test12:
243; CHECK-AVX:       ## %bb.0:
244; CHECK-AVX-NEXT:    vroundsd $11, (%rdi), %xmm0, %xmm0
245; CHECK-AVX-NEXT:    retq
246;
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, double* %xptr
252  %call = tail call double @trunc(double %x) nounwind readnone
253  ret double %call
254}
255
256define float @test11_pgso(float* %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
261;
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
266;
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, float* %xptr
272  %call = tail call float @truncf(float %x) nounwind readnone
273  ret float %call
274}
275
276define double @test12_pgso(double* %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
281;
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
286;
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, double* %xptr
292  %call = tail call double @trunc(double %x) nounwind readnone
293  ret double %call
294}
295
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}
312