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