1 ; Test rounding functions for z10.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
6 declare float @llvm.rint.f32(float %f)
7 define float @f1(float %f) {
9 ; CHECK: fiebr %f0, 0, %f0
11 %res = call float @llvm.rint.f32(float %f)
16 declare double @llvm.rint.f64(double %f)
17 define double @f2(double %f) {
19 ; CHECK: fidbr %f0, 0, %f0
21 %res = call double @llvm.rint.f64(double %f)
26 declare fp128 @llvm.rint.f128(fp128 %f)
27 define void @f3(fp128 *%ptr) {
29 ; CHECK: fixbr %f0, 0, %f0
31 %src = load fp128, fp128 *%ptr
32 %res = call fp128 @llvm.rint.f128(fp128 %src)
33 store fp128 %res, fp128 *%ptr
37 ; Test nearbyint for f32.
38 declare float @llvm.nearbyint.f32(float %f)
39 define float @f4(float %f) {
41 ; CHECK: brasl %r14, nearbyintf@PLT
43 %res = call float @llvm.nearbyint.f32(float %f)
47 ; Test nearbyint for f64.
48 declare double @llvm.nearbyint.f64(double %f)
49 define double @f5(double %f) {
51 ; CHECK: brasl %r14, nearbyint@PLT
53 %res = call double @llvm.nearbyint.f64(double %f)
57 ; Test nearbyint for f128.
58 declare fp128 @llvm.nearbyint.f128(fp128 %f)
59 define void @f6(fp128 *%ptr) {
61 ; CHECK: brasl %r14, nearbyintl@PLT
63 %src = load fp128, fp128 *%ptr
64 %res = call fp128 @llvm.nearbyint.f128(fp128 %src)
65 store fp128 %res, fp128 *%ptr
70 declare float @llvm.floor.f32(float %f)
71 define float @f7(float %f) {
73 ; CHECK: brasl %r14, floorf@PLT
75 %res = call float @llvm.floor.f32(float %f)
80 declare double @llvm.floor.f64(double %f)
81 define double @f8(double %f) {
83 ; CHECK: brasl %r14, floor@PLT
85 %res = call double @llvm.floor.f64(double %f)
89 ; Test floor for f128.
90 declare fp128 @llvm.floor.f128(fp128 %f)
91 define void @f9(fp128 *%ptr) {
93 ; CHECK: brasl %r14, floorl@PLT
95 %src = load fp128, fp128 *%ptr
96 %res = call fp128 @llvm.floor.f128(fp128 %src)
97 store fp128 %res, fp128 *%ptr
102 declare float @llvm.ceil.f32(float %f)
103 define float @f10(float %f) {
105 ; CHECK: brasl %r14, ceilf@PLT
107 %res = call float @llvm.ceil.f32(float %f)
112 declare double @llvm.ceil.f64(double %f)
113 define double @f11(double %f) {
115 ; CHECK: brasl %r14, ceil@PLT
117 %res = call double @llvm.ceil.f64(double %f)
121 ; Test ceil for f128.
122 declare fp128 @llvm.ceil.f128(fp128 %f)
123 define void @f12(fp128 *%ptr) {
125 ; CHECK: brasl %r14, ceill@PLT
127 %src = load fp128, fp128 *%ptr
128 %res = call fp128 @llvm.ceil.f128(fp128 %src)
129 store fp128 %res, fp128 *%ptr
133 ; Test trunc for f32.
134 declare float @llvm.trunc.f32(float %f)
135 define float @f13(float %f) {
137 ; CHECK: brasl %r14, truncf@PLT
139 %res = call float @llvm.trunc.f32(float %f)
143 ; Test trunc for f64.
144 declare double @llvm.trunc.f64(double %f)
145 define double @f14(double %f) {
147 ; CHECK: brasl %r14, trunc@PLT
149 %res = call double @llvm.trunc.f64(double %f)
153 ; Test trunc for f128.
154 declare fp128 @llvm.trunc.f128(fp128 %f)
155 define void @f15(fp128 *%ptr) {
157 ; CHECK: brasl %r14, truncl@PLT
159 %src = load fp128, fp128 *%ptr
160 %res = call fp128 @llvm.trunc.f128(fp128 %src)
161 store fp128 %res, fp128 *%ptr
165 ; Test round for f32.
166 declare float @llvm.round.f32(float %f)
167 define float @f16(float %f) {
169 ; CHECK: brasl %r14, roundf@PLT
171 %res = call float @llvm.round.f32(float %f)
175 ; Test round for f64.
176 declare double @llvm.round.f64(double %f)
177 define double @f17(double %f) {
179 ; CHECK: brasl %r14, round@PLT
181 %res = call double @llvm.round.f64(double %f)
185 ; Test round for f128.
186 declare fp128 @llvm.round.f128(fp128 %f)
187 define void @f18(fp128 *%ptr) {
189 ; CHECK: brasl %r14, roundl@PLT
191 %src = load fp128, fp128 *%ptr
192 %res = call fp128 @llvm.round.f128(fp128 %src)
193 store fp128 %res, fp128 *%ptr