2013-08-21 17:04:20 +08:00
|
|
|
; Test rounding functions for z10.
|
2013-05-07 00:17:29 +08:00
|
|
|
;
|
2013-08-21 17:04:20 +08:00
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
|
2013-05-07 00:17:29 +08:00
|
|
|
|
2013-08-21 17:04:20 +08:00
|
|
|
; Test rint for f32.
|
2013-05-07 00:17:29 +08:00
|
|
|
declare float @llvm.rint.f32(float %f)
|
|
|
|
define float @f1(float %f) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: fiebr %f0, 0, %f0
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.rint.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:04:20 +08:00
|
|
|
; Test rint for f64.
|
2013-05-07 00:17:29 +08:00
|
|
|
declare double @llvm.rint.f64(double %f)
|
|
|
|
define double @f2(double %f) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: fidbr %f0, 0, %f0
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.rint.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:04:20 +08:00
|
|
|
; Test rint for f128.
|
2013-05-07 00:17:29 +08:00
|
|
|
declare fp128 @llvm.rint.f128(fp128 %f)
|
|
|
|
define void @f3(fp128 *%ptr) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: fixbr %f0, 0, %f0
|
|
|
|
; CHECK: br %r14
|
2018-07-20 20:12:10 +08:00
|
|
|
%src = load fp128, fp128 *%ptr
|
2013-05-07 00:17:29 +08:00
|
|
|
%res = call fp128 @llvm.rint.f128(fp128 %src)
|
|
|
|
store fp128 %res, fp128 *%ptr
|
|
|
|
ret void
|
|
|
|
}
|
2013-08-21 17:04:20 +08:00
|
|
|
|
|
|
|
; Test nearbyint for f32.
|
|
|
|
declare float @llvm.nearbyint.f32(float %f)
|
|
|
|
define float @f4(float %f) {
|
|
|
|
; CHECK-LABEL: f4:
|
|
|
|
; CHECK: brasl %r14, nearbyintf@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.nearbyint.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test nearbyint for f64.
|
|
|
|
declare double @llvm.nearbyint.f64(double %f)
|
|
|
|
define double @f5(double %f) {
|
|
|
|
; CHECK-LABEL: f5:
|
|
|
|
; CHECK: brasl %r14, nearbyint@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.nearbyint.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test nearbyint for f128: omitted for now because we cannot handle
|
|
|
|
; indirect arguments.
|
|
|
|
|
|
|
|
; Test floor for f32.
|
|
|
|
declare float @llvm.floor.f32(float %f)
|
|
|
|
define float @f7(float %f) {
|
|
|
|
; CHECK-LABEL: f7:
|
|
|
|
; CHECK: brasl %r14, floorf@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.floor.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test floor for f64.
|
|
|
|
declare double @llvm.floor.f64(double %f)
|
|
|
|
define double @f8(double %f) {
|
|
|
|
; CHECK-LABEL: f8:
|
|
|
|
; CHECK: brasl %r14, floor@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.floor.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test floor for f128: omitted for now because we cannot handle
|
|
|
|
; indirect arguments.
|
|
|
|
|
|
|
|
; Test ceil for f32.
|
|
|
|
declare float @llvm.ceil.f32(float %f)
|
|
|
|
define float @f10(float %f) {
|
|
|
|
; CHECK-LABEL: f10:
|
|
|
|
; CHECK: brasl %r14, ceilf@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.ceil.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test ceil for f64.
|
|
|
|
declare double @llvm.ceil.f64(double %f)
|
|
|
|
define double @f11(double %f) {
|
|
|
|
; CHECK-LABEL: f11:
|
|
|
|
; CHECK: brasl %r14, ceil@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.ceil.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test ceil for f128: omitted for now because we cannot handle
|
|
|
|
; indirect arguments.
|
|
|
|
|
|
|
|
; Test trunc for f32.
|
|
|
|
declare float @llvm.trunc.f32(float %f)
|
|
|
|
define float @f13(float %f) {
|
|
|
|
; CHECK-LABEL: f13:
|
|
|
|
; CHECK: brasl %r14, truncf@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.trunc.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test trunc for f64.
|
|
|
|
declare double @llvm.trunc.f64(double %f)
|
|
|
|
define double @f14(double %f) {
|
|
|
|
; CHECK-LABEL: f14:
|
|
|
|
; CHECK: brasl %r14, trunc@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.trunc.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test trunc for f128: omitted for now because we cannot handle
|
|
|
|
; indirect arguments.
|
|
|
|
|
|
|
|
; Test round for f32.
|
|
|
|
declare float @llvm.round.f32(float %f)
|
|
|
|
define float @f16(float %f) {
|
|
|
|
; CHECK-LABEL: f16:
|
|
|
|
; CHECK: brasl %r14, roundf@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call float @llvm.round.f32(float %f)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test round for f64.
|
|
|
|
declare double @llvm.round.f64(double %f)
|
|
|
|
define double @f17(double %f) {
|
|
|
|
; CHECK-LABEL: f17:
|
|
|
|
; CHECK: brasl %r14, round@PLT
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = call double @llvm.round.f64(double %f)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test round for f128: omitted for now because we cannot handle
|
|
|
|
; indirect arguments.
|