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(ptr %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, ptr %ptr
40 %res = call fp128 @llvm.experimental.constrained.rint.f128(
42 metadata !"round.dynamic",
43 metadata !"fpexcept.strict") #0
44 store fp128 %res, ptr %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(ptr %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, ptr %ptr
83 %res = call fp128 @llvm.experimental.constrained.nearbyint.f128(
85 metadata !"round.dynamic",
86 metadata !"fpexcept.strict") #0
87 store fp128 %res, ptr %ptr
92 declare float @llvm.experimental.constrained.floor.f32(float, 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 !"fpexcept.strict") #0
103 ; Test floor for f64.
104 declare double @llvm.experimental.constrained.floor.f64(double, metadata)
105 define double @f8(double %f) #0 {
107 ; CHECK: fidbra %f0, 7, %f0, 4
109 %res = call double @llvm.experimental.constrained.floor.f64(
111 metadata !"fpexcept.strict") #0
115 ; Test floor for f128.
116 declare fp128 @llvm.experimental.constrained.floor.f128(fp128, metadata)
117 define void @f9(ptr %ptr) #0 {
119 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
120 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 7
121 ; CHECK: vst [[RES]], 0(%r2)
123 %src = load fp128, ptr %ptr
124 %res = call fp128 @llvm.experimental.constrained.floor.f128(
126 metadata !"fpexcept.strict") #0
127 store fp128 %res, ptr %ptr
132 declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
133 define float @f10(float %f) #0 {
135 ; CHECK: fiebra %f0, 6, %f0, 4
137 %res = call float @llvm.experimental.constrained.ceil.f32(
139 metadata !"fpexcept.strict") #0
144 declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
145 define double @f11(double %f) #0 {
147 ; CHECK: fidbra %f0, 6, %f0, 4
149 %res = call double @llvm.experimental.constrained.ceil.f64(
151 metadata !"fpexcept.strict") #0
155 ; Test ceil for f128.
156 declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata)
157 define void @f12(ptr %ptr) #0 {
159 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
160 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 6
161 ; CHECK: vst [[RES]], 0(%r2)
163 %src = load fp128, ptr %ptr
164 %res = call fp128 @llvm.experimental.constrained.ceil.f128(
166 metadata !"fpexcept.strict") #0
167 store fp128 %res, ptr %ptr
171 ; Test trunc for f32.
172 declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
173 define float @f13(float %f) #0 {
175 ; CHECK: fiebra %f0, 5, %f0, 4
177 %res = call float @llvm.experimental.constrained.trunc.f32(
179 metadata !"fpexcept.strict") #0
183 ; Test trunc for f64.
184 declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
185 define double @f14(double %f) #0 {
187 ; CHECK: fidbra %f0, 5, %f0, 4
189 %res = call double @llvm.experimental.constrained.trunc.f64(
191 metadata !"fpexcept.strict") #0
195 ; Test trunc for f128.
196 declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata)
197 define void @f15(ptr %ptr) #0 {
199 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
200 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 5
201 ; CHECK: vst [[RES]], 0(%r2)
203 %src = load fp128, ptr %ptr
204 %res = call fp128 @llvm.experimental.constrained.trunc.f128(
206 metadata !"fpexcept.strict") #0
207 store fp128 %res, ptr %ptr
211 ; Test round for f32.
212 declare float @llvm.experimental.constrained.round.f32(float, metadata)
213 define float @f16(float %f) #0 {
215 ; CHECK: fiebra %f0, 1, %f0, 4
217 %res = call float @llvm.experimental.constrained.round.f32(
219 metadata !"fpexcept.strict") #0
223 ; Test round for f64.
224 declare double @llvm.experimental.constrained.round.f64(double, metadata)
225 define double @f17(double %f) #0 {
227 ; CHECK: fidbra %f0, 1, %f0, 4
229 %res = call double @llvm.experimental.constrained.round.f64(
231 metadata !"fpexcept.strict") #0
235 ; Test round for f128.
236 declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata)
237 define void @f18(ptr %ptr) #0 {
239 ; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
240 ; CHECK: wfixb [[RES:%v[0-9]+]], [[REG]], 4, 1
241 ; CHECK: vst [[RES]], 0(%r2)
243 %src = load fp128, ptr %ptr
244 %res = call fp128 @llvm.experimental.constrained.round.f128(
246 metadata !"fpexcept.strict") #0
247 store fp128 %res, ptr %ptr
251 attributes #0 = { strictfp }