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(ptr %ptr) #0 {
39 ; CHECK: fixbr %f0, 0, %f0
41 %src = load fp128, ptr %ptr
42 %res = call fp128 @llvm.experimental.constrained.rint.f128(
44 metadata !"round.dynamic",
45 metadata !"fpexcept.strict") #0
46 store fp128 %res, ptr %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(ptr %ptr) #0 {
80 ; CHECK: fixbra %f0, 0, %f0, 4
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: fixbra %f0, 7, %f0, 4
121 %src = load fp128, ptr %ptr
122 %res = call fp128 @llvm.experimental.constrained.floor.f128(
124 metadata !"fpexcept.strict") #0
125 store fp128 %res, ptr %ptr
130 declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
131 define float @f10(float %f) #0 {
133 ; CHECK: fiebra %f0, 6, %f0, 4
135 %res = call float @llvm.experimental.constrained.ceil.f32(
137 metadata !"fpexcept.strict") #0
142 declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
143 define double @f11(double %f) #0 {
145 ; CHECK: fidbra %f0, 6, %f0, 4
147 %res = call double @llvm.experimental.constrained.ceil.f64(
149 metadata !"fpexcept.strict") #0
153 ; Test ceil for f128.
154 declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata)
155 define void @f12(ptr %ptr) #0 {
157 ; CHECK: fixbra %f0, 6, %f0, 4
159 %src = load fp128, ptr %ptr
160 %res = call fp128 @llvm.experimental.constrained.ceil.f128(
162 metadata !"fpexcept.strict") #0
163 store fp128 %res, ptr %ptr
167 ; Test trunc for f32.
168 declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
169 define float @f13(float %f) #0 {
171 ; CHECK: fiebra %f0, 5, %f0, 4
173 %res = call float @llvm.experimental.constrained.trunc.f32(
175 metadata !"fpexcept.strict") #0
179 ; Test trunc for f64.
180 declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
181 define double @f14(double %f) #0 {
183 ; CHECK: fidbra %f0, 5, %f0, 4
185 %res = call double @llvm.experimental.constrained.trunc.f64(
187 metadata !"fpexcept.strict") #0
191 ; Test trunc for f128.
192 declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata)
193 define void @f15(ptr %ptr) #0 {
195 ; CHECK: fixbra %f0, 5, %f0, 4
197 %src = load fp128, ptr %ptr
198 %res = call fp128 @llvm.experimental.constrained.trunc.f128(
200 metadata !"fpexcept.strict") #0
201 store fp128 %res, ptr %ptr
205 ; Test round for f32.
206 declare float @llvm.experimental.constrained.round.f32(float, metadata)
207 define float @f16(float %f) #0 {
209 ; CHECK: fiebra %f0, 1, %f0, 4
211 %res = call float @llvm.experimental.constrained.round.f32(
213 metadata !"fpexcept.strict") #0
217 ; Test round for f64.
218 declare double @llvm.experimental.constrained.round.f64(double, metadata)
219 define double @f17(double %f) #0 {
221 ; CHECK: fidbra %f0, 1, %f0, 4
223 %res = call double @llvm.experimental.constrained.round.f64(
225 metadata !"fpexcept.strict") #0
229 ; Test round for f128.
230 declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata)
231 define void @f18(ptr %ptr) #0 {
233 ; CHECK: fixbra %f0, 1, %f0, 4
235 %src = load fp128, ptr %ptr
236 %res = call fp128 @llvm.experimental.constrained.round.f128(
238 metadata !"fpexcept.strict") #0
239 store fp128 %res, ptr %ptr
243 attributes #0 = { strictfp }