• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test strict rounding functions for z196 and above.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 \
4; RUN:   | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
5; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 \
6; RUN:   | FileCheck -check-prefix=CHECK -check-prefix=CHECK-VECTOR %s
7
8; Test rint for f32.
9declare float @llvm.experimental.constrained.rint.f32(float, metadata, metadata)
10define float @f1(float %f) #0 {
11; CHECK-LABEL: f1:
12; CHECK: fiebr %f0, 0, %f0
13; CHECK: br %r14
14  %res = call float @llvm.experimental.constrained.rint.f32(
15                        float %f,
16                        metadata !"round.dynamic",
17                        metadata !"fpexcept.strict") #0
18  ret float %res
19}
20
21; Test rint for f64.
22declare double @llvm.experimental.constrained.rint.f64(double, metadata, metadata)
23define double @f2(double %f) #0 {
24; CHECK-LABEL: f2:
25; CHECK-SCALAR: fidbr %f0, 0, %f0
26; CHECK-VECTOR: fidbra %f0, 0, %f0, 0
27; CHECK: br %r14
28  %res = call double @llvm.experimental.constrained.rint.f64(
29                        double %f,
30                        metadata !"round.dynamic",
31                        metadata !"fpexcept.strict") #0
32  ret double %res
33}
34
35; Test rint for f128.
36declare fp128 @llvm.experimental.constrained.rint.f128(fp128, metadata, metadata)
37define void @f3(fp128 *%ptr) #0 {
38; CHECK-LABEL: f3:
39; CHECK: fixbr %f0, 0, %f0
40; CHECK: br %r14
41  %src = load fp128, fp128 *%ptr
42  %res = call fp128 @llvm.experimental.constrained.rint.f128(
43                        fp128 %src,
44                        metadata !"round.dynamic",
45                        metadata !"fpexcept.strict") #0
46  store fp128 %res, fp128 *%ptr
47  ret void
48}
49
50; Test nearbyint for f32.
51declare float @llvm.experimental.constrained.nearbyint.f32(float, metadata, metadata)
52define float @f4(float %f) #0 {
53; CHECK-LABEL: f4:
54; CHECK: fiebra %f0, 0, %f0, 4
55; CHECK: br %r14
56  %res = call float @llvm.experimental.constrained.nearbyint.f32(
57                        float %f,
58                        metadata !"round.dynamic",
59                        metadata !"fpexcept.strict") #0
60  ret float %res
61}
62
63; Test nearbyint for f64.
64declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
65define double @f5(double %f) #0 {
66; CHECK-LABEL: f5:
67; CHECK: fidbra %f0, 0, %f0, 4
68; CHECK: br %r14
69  %res = call double @llvm.experimental.constrained.nearbyint.f64(
70                        double %f,
71                        metadata !"round.dynamic",
72                        metadata !"fpexcept.strict") #0
73  ret double %res
74}
75
76; Test nearbyint for f128.
77declare fp128 @llvm.experimental.constrained.nearbyint.f128(fp128, metadata, metadata)
78define void @f6(fp128 *%ptr) #0 {
79; CHECK-LABEL: f6:
80; CHECK: fixbra %f0, 0, %f0, 4
81; CHECK: br %r14
82  %src = load fp128, fp128 *%ptr
83  %res = call fp128 @llvm.experimental.constrained.nearbyint.f128(
84                        fp128 %src,
85                        metadata !"round.dynamic",
86                        metadata !"fpexcept.strict") #0
87  store fp128 %res, fp128 *%ptr
88  ret void
89}
90
91; Test floor for f32.
92declare float @llvm.experimental.constrained.floor.f32(float, metadata)
93define float @f7(float %f) #0 {
94; CHECK-LABEL: f7:
95; CHECK: fiebra %f0, 7, %f0, 4
96; CHECK: br %r14
97  %res = call float @llvm.experimental.constrained.floor.f32(
98                        float %f,
99                        metadata !"fpexcept.strict") #0
100  ret float %res
101}
102
103; Test floor for f64.
104declare double @llvm.experimental.constrained.floor.f64(double, metadata)
105define double @f8(double %f) #0 {
106; CHECK-LABEL: f8:
107; CHECK: fidbra %f0, 7, %f0, 4
108; CHECK: br %r14
109  %res = call double @llvm.experimental.constrained.floor.f64(
110                        double %f,
111                        metadata !"fpexcept.strict") #0
112  ret double %res
113}
114
115; Test floor for f128.
116declare fp128 @llvm.experimental.constrained.floor.f128(fp128, metadata)
117define void @f9(fp128 *%ptr) #0 {
118; CHECK-LABEL: f9:
119; CHECK: fixbra %f0, 7, %f0, 4
120; CHECK: br %r14
121  %src = load fp128, fp128 *%ptr
122  %res = call fp128 @llvm.experimental.constrained.floor.f128(
123                        fp128 %src,
124                        metadata !"fpexcept.strict") #0
125  store fp128 %res, fp128 *%ptr
126  ret void
127}
128
129; Test ceil for f32.
130declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
131define float @f10(float %f) #0 {
132; CHECK-LABEL: f10:
133; CHECK: fiebra %f0, 6, %f0, 4
134; CHECK: br %r14
135  %res = call float @llvm.experimental.constrained.ceil.f32(
136                        float %f,
137                        metadata !"fpexcept.strict") #0
138  ret float %res
139}
140
141; Test ceil for f64.
142declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
143define double @f11(double %f) #0 {
144; CHECK-LABEL: f11:
145; CHECK: fidbra %f0, 6, %f0, 4
146; CHECK: br %r14
147  %res = call double @llvm.experimental.constrained.ceil.f64(
148                        double %f,
149                        metadata !"fpexcept.strict") #0
150  ret double %res
151}
152
153; Test ceil for f128.
154declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata)
155define void @f12(fp128 *%ptr) #0 {
156; CHECK-LABEL: f12:
157; CHECK: fixbra %f0, 6, %f0, 4
158; CHECK: br %r14
159  %src = load fp128, fp128 *%ptr
160  %res = call fp128 @llvm.experimental.constrained.ceil.f128(
161                        fp128 %src,
162                        metadata !"fpexcept.strict") #0
163  store fp128 %res, fp128 *%ptr
164  ret void
165}
166
167; Test trunc for f32.
168declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
169define float @f13(float %f) #0 {
170; CHECK-LABEL: f13:
171; CHECK: fiebra %f0, 5, %f0, 4
172; CHECK: br %r14
173  %res = call float @llvm.experimental.constrained.trunc.f32(
174                        float %f,
175                        metadata !"fpexcept.strict") #0
176  ret float %res
177}
178
179; Test trunc for f64.
180declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
181define double @f14(double %f) #0 {
182; CHECK-LABEL: f14:
183; CHECK: fidbra %f0, 5, %f0, 4
184; CHECK: br %r14
185  %res = call double @llvm.experimental.constrained.trunc.f64(
186                        double %f,
187                        metadata !"fpexcept.strict") #0
188  ret double %res
189}
190
191; Test trunc for f128.
192declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata)
193define void @f15(fp128 *%ptr) #0 {
194; CHECK-LABEL: f15:
195; CHECK: fixbra %f0, 5, %f0, 4
196; CHECK: br %r14
197  %src = load fp128, fp128 *%ptr
198  %res = call fp128 @llvm.experimental.constrained.trunc.f128(
199                        fp128 %src,
200                        metadata !"fpexcept.strict") #0
201  store fp128 %res, fp128 *%ptr
202  ret void
203}
204
205; Test round for f32.
206declare float @llvm.experimental.constrained.round.f32(float, metadata)
207define float @f16(float %f) #0 {
208; CHECK-LABEL: f16:
209; CHECK: fiebra %f0, 1, %f0, 4
210; CHECK: br %r14
211  %res = call float @llvm.experimental.constrained.round.f32(
212                        float %f,
213                        metadata !"fpexcept.strict") #0
214  ret float %res
215}
216
217; Test round for f64.
218declare double @llvm.experimental.constrained.round.f64(double, metadata)
219define double @f17(double %f) #0 {
220; CHECK-LABEL: f17:
221; CHECK: fidbra %f0, 1, %f0, 4
222; CHECK: br %r14
223  %res = call double @llvm.experimental.constrained.round.f64(
224                        double %f,
225                        metadata !"fpexcept.strict") #0
226  ret double %res
227}
228
229; Test round for f128.
230declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata)
231define void @f18(fp128 *%ptr) #0 {
232; CHECK-LABEL: f18:
233; CHECK: fixbra %f0, 1, %f0, 4
234; CHECK: br %r14
235  %src = load fp128, fp128 *%ptr
236  %res = call fp128 @llvm.experimental.constrained.round.f128(
237                        fp128 %src,
238                        metadata !"fpexcept.strict") #0
239  store fp128 %res, fp128 *%ptr
240  ret void
241}
242
243attributes #0 = { strictfp }
244