1 ; Test strict rounding functions for z14 and above.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
6 declare float @llvm.experimental.constrained.rint.f32(float, metadata, metadata)
7 define float @f1(float %f) #0 {
9 ; CHECK: fiebra %f0, 0, %f0, 0
11 %res = call float @llvm.experimental.constrained.rint.f32(
13 metadata !"round.dynamic",
14 metadata !"fpexcept.strict") #0
19 declare double @llvm.experimental.constrained.rint.f64(double, metadata, metadata)
20 define double @f2(double %f) #0 {
22 ; CHECK: fidbra %f0, 0, %f0, 0
24 %res = call double @llvm.experimental.constrained.rint.f64(
26 metadata !"round.dynamic",
27 metadata !"fpexcept.strict") #0
32 declare fp128 @llvm.experimental.constrained.rint.f128(fp128, metadata, metadata)
33 define void @f3(fp128 *%ptr) #0 {
35 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
36 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 0, 0
37 ; CHECK: vst [[RES]], 0(%r2)
39 %src = load fp128, fp128 *%ptr
40 %res = call fp128 @llvm.experimental.constrained.rint.f128(
42 metadata !"round.dynamic",
43 metadata !"fpexcept.strict") #0
44 store fp128 %res, fp128 *%ptr
48 ; Test nearbyint for f32.
49 declare float @llvm.experimental.constrained.nearbyint.f32(float, metadata, metadata)
50 define float @f4(float %f) #0 {
52 ; CHECK: fiebra %f0, 0, %f0, 4
54 %res = call float @llvm.experimental.constrained.nearbyint.f32(
56 metadata !"round.dynamic",
57 metadata !"fpexcept.strict") #0
61 ; Test nearbyint for f64.
62 declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
63 define double @f5(double %f) #0 {
65 ; CHECK: fidbra %f0, 0, %f0, 4
67 %res = call double @llvm.experimental.constrained.nearbyint.f64(
69 metadata !"round.dynamic",
70 metadata !"fpexcept.strict") #0
74 ; Test nearbyint for f128.
75 declare fp128 @llvm.experimental.constrained.nearbyint.f128(fp128, metadata, metadata)
76 define void @f6(fp128 *%ptr) #0 {
78 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
79 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 0
80 ; CHECK: vst [[RES]], 0(%r2)
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: vl [[REG:%v[0-9]+]], 0(%r2)
122 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 7
123 ; CHECK: vst [[RES]], 0(%r2)
125 %src = load fp128, fp128 *%ptr
126 %res = call fp128 @llvm.experimental.constrained.floor.f128(
128 metadata !"round.dynamic",
129 metadata !"fpexcept.strict") #0
130 store fp128 %res, fp128 *%ptr
135 declare float @llvm.experimental.constrained.ceil.f32(float, metadata, metadata)
136 define float @f10(float %f) #0 {
138 ; CHECK: fiebra %f0, 6, %f0, 4
140 %res = call float @llvm.experimental.constrained.ceil.f32(
142 metadata !"round.dynamic",
143 metadata !"fpexcept.strict") #0
148 declare double @llvm.experimental.constrained.ceil.f64(double, metadata, metadata)
149 define double @f11(double %f) #0 {
151 ; CHECK: fidbra %f0, 6, %f0, 4
153 %res = call double @llvm.experimental.constrained.ceil.f64(
155 metadata !"round.dynamic",
156 metadata !"fpexcept.strict") #0
160 ; Test ceil for f128.
161 declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata, metadata)
162 define void @f12(fp128 *%ptr) #0 {
164 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
165 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 6
166 ; CHECK: vst [[RES]], 0(%r2)
168 %src = load fp128, fp128 *%ptr
169 %res = call fp128 @llvm.experimental.constrained.ceil.f128(
171 metadata !"round.dynamic",
172 metadata !"fpexcept.strict") #0
173 store fp128 %res, fp128 *%ptr
177 ; Test trunc for f32.
178 declare float @llvm.experimental.constrained.trunc.f32(float, metadata, metadata)
179 define float @f13(float %f) #0 {
181 ; CHECK: fiebra %f0, 5, %f0, 4
183 %res = call float @llvm.experimental.constrained.trunc.f32(
185 metadata !"round.dynamic",
186 metadata !"fpexcept.strict") #0
190 ; Test trunc for f64.
191 declare double @llvm.experimental.constrained.trunc.f64(double, metadata, metadata)
192 define double @f14(double %f) #0 {
194 ; CHECK: fidbra %f0, 5, %f0, 4
196 %res = call double @llvm.experimental.constrained.trunc.f64(
198 metadata !"round.dynamic",
199 metadata !"fpexcept.strict") #0
203 ; Test trunc for f128.
204 declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata, metadata)
205 define void @f15(fp128 *%ptr) #0 {
207 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
208 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 5
209 ; CHECK: vst [[RES]], 0(%r2)
211 %src = load fp128, fp128 *%ptr
212 %res = call fp128 @llvm.experimental.constrained.trunc.f128(
214 metadata !"round.dynamic",
215 metadata !"fpexcept.strict") #0
216 store fp128 %res, fp128 *%ptr
220 ; Test round for f32.
221 declare float @llvm.experimental.constrained.round.f32(float, metadata, metadata)
222 define float @f16(float %f) #0 {
224 ; CHECK: fiebra %f0, 1, %f0, 4
226 %res = call float @llvm.experimental.constrained.round.f32(
228 metadata !"round.dynamic",
229 metadata !"fpexcept.strict") #0
233 ; Test round for f64.
234 declare double @llvm.experimental.constrained.round.f64(double, metadata, metadata)
235 define double @f17(double %f) #0 {
237 ; CHECK: fidbra %f0, 1, %f0, 4
239 %res = call double @llvm.experimental.constrained.round.f64(
241 metadata !"round.dynamic",
242 metadata !"fpexcept.strict") #0
246 ; Test round for f128.
247 declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata, metadata)
248 define void @f18(fp128 *%ptr) #0 {
250 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
251 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 1
252 ; CHECK: vst [[RES]], 0(%r2)
254 %src = load fp128, fp128 *%ptr
255 %res = call fp128 @llvm.experimental.constrained.round.f128(
257 metadata !"round.dynamic",
258 metadata !"fpexcept.strict") #0
259 store fp128 %res, fp128 *%ptr
263 attributes #0 = { strictfp }