blob: 69f4bfb9f47de5faaa642fc41737b57761fc613f [file] [log] [blame]
Rafael Espindolaae6000e2013-08-23 20:39:19 +00001; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+sse4.1 | FileCheck -check-prefix=CHECK-SSE %s
Bob Wilson4c65c502012-08-08 20:31:37 +00002; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck -check-prefix=CHECK-AVX %s
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +00003
4define float @test1(float %x) nounwind {
5 %call = tail call float @floorf(float %x) nounwind readnone
6 ret float %call
7
Stephen Lind24ab202013-07-14 06:24:09 +00008; CHECK-SSE-LABEL: test1:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +00009; CHECK-SSE: roundss $1
10
Stephen Lind24ab202013-07-14 06:24:09 +000011; CHECK-AVX-LABEL: test1:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000012; CHECK-AVX: vroundss $1
13}
14
15declare float @floorf(float) nounwind readnone
16
17define double @test2(double %x) nounwind {
18 %call = tail call double @floor(double %x) nounwind readnone
19 ret double %call
20
Stephen Lind24ab202013-07-14 06:24:09 +000021; CHECK-SSE-LABEL: test2:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000022; CHECK-SSE: roundsd $1
23
Stephen Lind24ab202013-07-14 06:24:09 +000024; CHECK-AVX-LABEL: test2:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000025; CHECK-AVX: vroundsd $1
26}
27
28declare double @floor(double) nounwind readnone
29
30define float @test3(float %x) nounwind {
31 %call = tail call float @nearbyintf(float %x) nounwind readnone
32 ret float %call
33
Stephen Lind24ab202013-07-14 06:24:09 +000034; CHECK-SSE-LABEL: test3:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000035; CHECK-SSE: roundss $12
36
Stephen Lind24ab202013-07-14 06:24:09 +000037; CHECK-AVX-LABEL: test3:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000038; CHECK-AVX: vroundss $12
39}
40
41declare float @nearbyintf(float) nounwind readnone
42
43define double @test4(double %x) nounwind {
44 %call = tail call double @nearbyint(double %x) nounwind readnone
45 ret double %call
46
Stephen Lind24ab202013-07-14 06:24:09 +000047; CHECK-SSE-LABEL: test4:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000048; CHECK-SSE: roundsd $12
49
Stephen Lind24ab202013-07-14 06:24:09 +000050; CHECK-AVX-LABEL: test4:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000051; CHECK-AVX: vroundsd $12
52}
53
54declare double @nearbyint(double) nounwind readnone
55
56define float @test5(float %x) nounwind {
57 %call = tail call float @ceilf(float %x) nounwind readnone
58 ret float %call
59
Stephen Lind24ab202013-07-14 06:24:09 +000060; CHECK-SSE-LABEL: test5:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000061; CHECK-SSE: roundss $2
62
Stephen Lind24ab202013-07-14 06:24:09 +000063; CHECK-AVX-LABEL: test5:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000064; CHECK-AVX: vroundss $2
65}
66
67declare float @ceilf(float) nounwind readnone
68
69define double @test6(double %x) nounwind {
70 %call = tail call double @ceil(double %x) nounwind readnone
71 ret double %call
72
Stephen Lind24ab202013-07-14 06:24:09 +000073; CHECK-SSE-LABEL: test6:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000074; CHECK-SSE: roundsd $2
75
Stephen Lind24ab202013-07-14 06:24:09 +000076; CHECK-AVX-LABEL: test6:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000077; CHECK-AVX: vroundsd $2
78}
79
80declare double @ceil(double) nounwind readnone
81
82define float @test7(float %x) nounwind {
83 %call = tail call float @rintf(float %x) nounwind readnone
84 ret float %call
85
Stephen Lind24ab202013-07-14 06:24:09 +000086; CHECK-SSE-LABEL: test7:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000087; CHECK-SSE: roundss $4
88
Stephen Lind24ab202013-07-14 06:24:09 +000089; CHECK-AVX-LABEL: test7:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +000090; CHECK-AVX: vroundss $4
91}
92
93declare float @rintf(float) nounwind readnone
94
95define double @test8(double %x) nounwind {
96 %call = tail call double @rint(double %x) nounwind readnone
97 ret double %call
98
Stephen Lind24ab202013-07-14 06:24:09 +000099; CHECK-SSE-LABEL: test8:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000100; CHECK-SSE: roundsd $4
101
Stephen Lind24ab202013-07-14 06:24:09 +0000102; CHECK-AVX-LABEL: test8:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000103; CHECK-AVX: vroundsd $4
104}
105
106declare double @rint(double) nounwind readnone
107
108define float @test9(float %x) nounwind {
109 %call = tail call float @truncf(float %x) nounwind readnone
110 ret float %call
111
Stephen Lind24ab202013-07-14 06:24:09 +0000112; CHECK-SSE-LABEL: test9:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000113; CHECK-SSE: roundss $3
114
Stephen Lind24ab202013-07-14 06:24:09 +0000115; CHECK-AVX-LABEL: test9:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000116; CHECK-AVX: vroundss $3
117}
118
119declare float @truncf(float) nounwind readnone
120
121define double @test10(double %x) nounwind {
122 %call = tail call double @trunc(double %x) nounwind readnone
123 ret double %call
124
Stephen Lind24ab202013-07-14 06:24:09 +0000125; CHECK-SSE-LABEL: test10:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000126; CHECK-SSE: roundsd $3
127
Stephen Lind24ab202013-07-14 06:24:09 +0000128; CHECK-AVX-LABEL: test10:
Benjamin Kramer16bbfbe2011-12-09 15:44:03 +0000129; CHECK-AVX: vroundsd $3
130}
131
132declare double @trunc(double) nounwind readnone