Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / rounding-ops.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+sse4.1 | FileCheck -check-prefix=CHECK-SSE %s
2 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck -check-prefix=CHECK-AVX %s
3
4 define float @test1(float %x) nounwind  {
5   %call = tail call float @floorf(float %x) nounwind readnone
6   ret float %call
7
8 ; CHECK-SSE-LABEL: test1:
9 ; CHECK-SSE: roundss $1
10
11 ; CHECK-AVX-LABEL: test1:
12 ; CHECK-AVX: vroundss $1
13 }
14
15 declare float @floorf(float) nounwind readnone
16
17 define double @test2(double %x) nounwind  {
18   %call = tail call double @floor(double %x) nounwind readnone
19   ret double %call
20
21 ; CHECK-SSE-LABEL: test2:
22 ; CHECK-SSE: roundsd $1
23
24 ; CHECK-AVX-LABEL: test2:
25 ; CHECK-AVX: vroundsd $1
26 }
27
28 declare double @floor(double) nounwind readnone
29
30 define float @test3(float %x) nounwind  {
31   %call = tail call float @nearbyintf(float %x) nounwind readnone
32   ret float %call
33
34 ; CHECK-SSE-LABEL: test3:
35 ; CHECK-SSE: roundss $12
36
37 ; CHECK-AVX-LABEL: test3:
38 ; CHECK-AVX: vroundss $12
39 }
40
41 declare float @nearbyintf(float) nounwind readnone
42
43 define double @test4(double %x) nounwind  {
44   %call = tail call double @nearbyint(double %x) nounwind readnone
45   ret double %call
46
47 ; CHECK-SSE-LABEL: test4:
48 ; CHECK-SSE: roundsd $12
49
50 ; CHECK-AVX-LABEL: test4:
51 ; CHECK-AVX: vroundsd $12
52 }
53
54 declare double @nearbyint(double) nounwind readnone
55
56 define float @test5(float %x) nounwind  {
57   %call = tail call float @ceilf(float %x) nounwind readnone
58   ret float %call
59
60 ; CHECK-SSE-LABEL: test5:
61 ; CHECK-SSE: roundss $2
62
63 ; CHECK-AVX-LABEL: test5:
64 ; CHECK-AVX: vroundss $2
65 }
66
67 declare float @ceilf(float) nounwind readnone
68
69 define double @test6(double %x) nounwind  {
70   %call = tail call double @ceil(double %x) nounwind readnone
71   ret double %call
72
73 ; CHECK-SSE-LABEL: test6:
74 ; CHECK-SSE: roundsd $2
75
76 ; CHECK-AVX-LABEL: test6:
77 ; CHECK-AVX: vroundsd $2
78 }
79
80 declare double @ceil(double) nounwind readnone
81
82 define float @test7(float %x) nounwind  {
83   %call = tail call float @rintf(float %x) nounwind readnone
84   ret float %call
85
86 ; CHECK-SSE-LABEL: test7:
87 ; CHECK-SSE: roundss $4
88
89 ; CHECK-AVX-LABEL: test7:
90 ; CHECK-AVX: vroundss $4
91 }
92
93 declare float @rintf(float) nounwind readnone
94
95 define double @test8(double %x) nounwind  {
96   %call = tail call double @rint(double %x) nounwind readnone
97   ret double %call
98
99 ; CHECK-SSE-LABEL: test8:
100 ; CHECK-SSE: roundsd $4
101
102 ; CHECK-AVX-LABEL: test8:
103 ; CHECK-AVX: vroundsd $4
104 }
105
106 declare double @rint(double) nounwind readnone
107
108 define float @test9(float %x) nounwind  {
109   %call = tail call float @truncf(float %x) nounwind readnone
110   ret float %call
111
112 ; CHECK-SSE-LABEL: test9:
113 ; CHECK-SSE: roundss $3
114
115 ; CHECK-AVX-LABEL: test9:
116 ; CHECK-AVX: vroundss $3
117 }
118
119 declare float @truncf(float) nounwind readnone
120
121 define double @test10(double %x) nounwind  {
122   %call = tail call double @trunc(double %x) nounwind readnone
123   ret double %call
124
125 ; CHECK-SSE-LABEL: test10:
126 ; CHECK-SSE: roundsd $3
127
128 ; CHECK-AVX-LABEL: test10:
129 ; CHECK-AVX: vroundsd $3
130 }
131
132 declare double @trunc(double) nounwind readnone