1 ; Test strict rounding functions for z196 and above.
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
9 declare float @llvm.experimental.constrained.rint.f32(float, metadata, metadata)
10 define float @f1(float %f) #0 {
12 ; CHECK: fiebr %f0, 0, %f0
14 %res = call float @llvm.experimental.constrained.rint.f32(
16 metadata !"round.dynamic",
17 metadata !"fpexcept.strict") #0
22 declare double @llvm.experimental.constrained.rint.f64(double, metadata, metadata)
23 define double @f2(double %f) #0 {
25 ; CHECK-SCALAR: fidbr %f0, 0, %f0
26 ; CHECK-VECTOR: fidbra %f0, 0, %f0, 0
28 %res = call double @llvm.experimental.constrained.rint.f64(
30 metadata !"round.dynamic",
31 metadata !"fpexcept.strict") #0
36 declare fp128 @llvm.experimental.constrained.rint.f128(fp128, metadata, metadata)
37 define void @f3(fp128 *%ptr) #0 {
39 ; CHECK: fixbr %f0, 0, %f0
41 %src = load fp128, fp128 *%ptr
42 %res = call fp128 @llvm.experimental.constrained.rint.f128(
44 metadata !"round.dynamic",
45 metadata !"fpexcept.strict") #0
46 store fp128 %res, fp128 *%ptr
50 ; Test nearbyint for f32.
51 declare float @llvm.experimental.constrained.nearbyint.f32(float, metadata, metadata)
52 define float @f4(float %f) #0 {
54 ; CHECK: fiebra %f0, 0, %f0, 4
56 %res = call float @llvm.experimental.constrained.nearbyint.f32(
58 metadata !"round.dynamic",
59 metadata !"fpexcept.strict") #0
63 ; Test nearbyint for f64.
64 declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
65 define double @f5(double %f) #0 {
67 ; CHECK: fidbra %f0, 0, %f0, 4
69 %res = call double @llvm.experimental.constrained.nearbyint.f64(
71 metadata !"round.dynamic",
72 metadata !"fpexcept.strict") #0
76 ; Test nearbyint for f128.
77 declare fp128 @llvm.experimental.constrained.nearbyint.f128(fp128, metadata, metadata)
78 define void @f6(fp128 *%ptr) #0 {
80 ; CHECK: fixbra %f0, 0, %f0, 4
82 %src = load fp128, fp128 *%ptr
83 %res = call fp128 @llvm.experimental.constrained.nearbyint.f128(
85 metadata !"round.dynamic",
86 metadata !"fpexcept.strict") #0
87 store fp128 %res, fp128 *%ptr
92 declare float @llvm.experimental.constrained.floor.f32(float, metadata, metadata)
93 define float @f7(float %f) #0 {
95 ; CHECK: fiebra %f0, 7, %f0, 4
97 %res = call float @llvm.experimental.constrained.floor.f32(
99 metadata !"round.dynamic",
100 metadata !"fpexcept.strict") #0
104 ; Test floor for f64.
105 declare double @llvm.experimental.constrained.floor.f64(double, metadata, metadata)
106 define double @f8(double %f) #0 {
108 ; CHECK: fidbra %f0, 7, %f0, 4
110 %res = call double @llvm.experimental.constrained.floor.f64(
112 metadata !"round.dynamic",
113 metadata !"fpexcept.strict") #0
117 ; Test floor for f128.
118 declare fp128 @llvm.experimental.constrained.floor.f128(fp128, metadata, metadata)
119 define void @f9(fp128 *%ptr) #0 {
121 ; CHECK: fixbra %f0, 7, %f0, 4
123 %src = load fp128, fp128 *%ptr
124 %res = call fp128 @llvm.experimental.constrained.floor.f128(
126 metadata !"round.dynamic",
127 metadata !"fpexcept.strict") #0
128 store fp128 %res, fp128 *%ptr
133 declare float @llvm.experimental.constrained.ceil.f32(float, metadata, metadata)
134 define float @f10(float %f) #0 {
136 ; CHECK: fiebra %f0, 6, %f0, 4
138 %res = call float @llvm.experimental.constrained.ceil.f32(
140 metadata !"round.dynamic",
141 metadata !"fpexcept.strict") #0
146 declare double @llvm.experimental.constrained.ceil.f64(double, metadata, metadata)
147 define double @f11(double %f) #0 {
149 ; CHECK: fidbra %f0, 6, %f0, 4
151 %res = call double @llvm.experimental.constrained.ceil.f64(
153 metadata !"round.dynamic",
154 metadata !"fpexcept.strict") #0
158 ; Test ceil for f128.
159 declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata, metadata)
160 define void @f12(fp128 *%ptr) #0 {
162 ; CHECK: fixbra %f0, 6, %f0, 4
164 %src = load fp128, fp128 *%ptr
165 %res = call fp128 @llvm.experimental.constrained.ceil.f128(
167 metadata !"round.dynamic",
168 metadata !"fpexcept.strict") #0
169 store fp128 %res, fp128 *%ptr
173 ; Test trunc for f32.
174 declare float @llvm.experimental.constrained.trunc.f32(float, metadata, metadata)
175 define float @f13(float %f) #0 {
177 ; CHECK: fiebra %f0, 5, %f0, 4
179 %res = call float @llvm.experimental.constrained.trunc.f32(
181 metadata !"round.dynamic",
182 metadata !"fpexcept.strict") #0
186 ; Test trunc for f64.
187 declare double @llvm.experimental.constrained.trunc.f64(double, metadata, metadata)
188 define double @f14(double %f) #0 {
190 ; CHECK: fidbra %f0, 5, %f0, 4
192 %res = call double @llvm.experimental.constrained.trunc.f64(
194 metadata !"round.dynamic",
195 metadata !"fpexcept.strict") #0
199 ; Test trunc for f128.
200 declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata, metadata)
201 define void @f15(fp128 *%ptr) #0 {
203 ; CHECK: fixbra %f0, 5, %f0, 4
205 %src = load fp128, fp128 *%ptr
206 %res = call fp128 @llvm.experimental.constrained.trunc.f128(
208 metadata !"round.dynamic",
209 metadata !"fpexcept.strict") #0
210 store fp128 %res, fp128 *%ptr
214 ; Test round for f32.
215 declare float @llvm.experimental.constrained.round.f32(float, metadata, metadata)
216 define float @f16(float %f) #0 {
218 ; CHECK: fiebra %f0, 1, %f0, 4
220 %res = call float @llvm.experimental.constrained.round.f32(
222 metadata !"round.dynamic",
223 metadata !"fpexcept.strict") #0
227 ; Test round for f64.
228 declare double @llvm.experimental.constrained.round.f64(double, metadata, metadata)
229 define double @f17(double %f) #0 {
231 ; CHECK: fidbra %f0, 1, %f0, 4
233 %res = call double @llvm.experimental.constrained.round.f64(
235 metadata !"round.dynamic",
236 metadata !"fpexcept.strict") #0
240 ; Test round for f128.
241 declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata, metadata)
242 define void @f18(fp128 *%ptr) #0 {
244 ; CHECK: fixbra %f0, 1, %f0, 4
246 %src = load fp128, fp128 *%ptr
247 %res = call fp128 @llvm.experimental.constrained.round.f128(
249 metadata !"round.dynamic",
250 metadata !"fpexcept.strict") #0
251 store fp128 %res, fp128 *%ptr
255 attributes #0 = { strictfp }