1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/SystemZ/fp-strict-round-02.ll
Ulrich Weigand 527a7ef69a [FPEnv] Remove unnecessary rounding mode argument for constrained intrinsics
The following intrinsics currently carry a rounding mode metadata argument:

    llvm.experimental.constrained.minnum
    llvm.experimental.constrained.maxnum
    llvm.experimental.constrained.ceil
    llvm.experimental.constrained.floor
    llvm.experimental.constrained.round
    llvm.experimental.constrained.trunc

This is not useful since the semantics of those intrinsics do not in any way
depend on the rounding mode. In similar cases, other constrained intrinsics
do not have the rounding mode argument. Remove it here as well.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D71218
2019-12-17 21:10:36 +01:00

244 lines
7.6 KiB
LLVM

; Test strict rounding functions for z196 and above.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 \
; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 \
; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-VECTOR %s
; Test rint for f32.
declare float @llvm.experimental.constrained.rint.f32(float, metadata, metadata)
define float @f1(float %f) #0 {
; CHECK-LABEL: f1:
; CHECK: fiebr %f0, 0, %f0
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.rint.f32(
float %f,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret float %res
}
; Test rint for f64.
declare double @llvm.experimental.constrained.rint.f64(double, metadata, metadata)
define double @f2(double %f) #0 {
; CHECK-LABEL: f2:
; CHECK-SCALAR: fidbr %f0, 0, %f0
; CHECK-VECTOR: fidbra %f0, 0, %f0, 0
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.rint.f64(
double %f,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret double %res
}
; Test rint for f128.
declare fp128 @llvm.experimental.constrained.rint.f128(fp128, metadata, metadata)
define void @f3(fp128 *%ptr) #0 {
; CHECK-LABEL: f3:
; CHECK: fixbr %f0, 0, %f0
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.rint.f128(
fp128 %src,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
; Test nearbyint for f32.
declare float @llvm.experimental.constrained.nearbyint.f32(float, metadata, metadata)
define float @f4(float %f) #0 {
; CHECK-LABEL: f4:
; CHECK: fiebra %f0, 0, %f0, 4
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.nearbyint.f32(
float %f,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret float %res
}
; Test nearbyint for f64.
declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
define double @f5(double %f) #0 {
; CHECK-LABEL: f5:
; CHECK: fidbra %f0, 0, %f0, 4
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.nearbyint.f64(
double %f,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret double %res
}
; Test nearbyint for f128.
declare fp128 @llvm.experimental.constrained.nearbyint.f128(fp128, metadata, metadata)
define void @f6(fp128 *%ptr) #0 {
; CHECK-LABEL: f6:
; CHECK: fixbra %f0, 0, %f0, 4
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.nearbyint.f128(
fp128 %src,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
; Test floor for f32.
declare float @llvm.experimental.constrained.floor.f32(float, metadata)
define float @f7(float %f) #0 {
; CHECK-LABEL: f7:
; CHECK: fiebra %f0, 7, %f0, 4
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.floor.f32(
float %f,
metadata !"fpexcept.strict") #0
ret float %res
}
; Test floor for f64.
declare double @llvm.experimental.constrained.floor.f64(double, metadata)
define double @f8(double %f) #0 {
; CHECK-LABEL: f8:
; CHECK: fidbra %f0, 7, %f0, 4
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.floor.f64(
double %f,
metadata !"fpexcept.strict") #0
ret double %res
}
; Test floor for f128.
declare fp128 @llvm.experimental.constrained.floor.f128(fp128, metadata)
define void @f9(fp128 *%ptr) #0 {
; CHECK-LABEL: f9:
; CHECK: fixbra %f0, 7, %f0, 4
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.floor.f128(
fp128 %src,
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
; Test ceil for f32.
declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
define float @f10(float %f) #0 {
; CHECK-LABEL: f10:
; CHECK: fiebra %f0, 6, %f0, 4
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.ceil.f32(
float %f,
metadata !"fpexcept.strict") #0
ret float %res
}
; Test ceil for f64.
declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
define double @f11(double %f) #0 {
; CHECK-LABEL: f11:
; CHECK: fidbra %f0, 6, %f0, 4
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.ceil.f64(
double %f,
metadata !"fpexcept.strict") #0
ret double %res
}
; Test ceil for f128.
declare fp128 @llvm.experimental.constrained.ceil.f128(fp128, metadata)
define void @f12(fp128 *%ptr) #0 {
; CHECK-LABEL: f12:
; CHECK: fixbra %f0, 6, %f0, 4
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.ceil.f128(
fp128 %src,
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
; Test trunc for f32.
declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
define float @f13(float %f) #0 {
; CHECK-LABEL: f13:
; CHECK: fiebra %f0, 5, %f0, 4
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.trunc.f32(
float %f,
metadata !"fpexcept.strict") #0
ret float %res
}
; Test trunc for f64.
declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
define double @f14(double %f) #0 {
; CHECK-LABEL: f14:
; CHECK: fidbra %f0, 5, %f0, 4
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.trunc.f64(
double %f,
metadata !"fpexcept.strict") #0
ret double %res
}
; Test trunc for f128.
declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata)
define void @f15(fp128 *%ptr) #0 {
; CHECK-LABEL: f15:
; CHECK: fixbra %f0, 5, %f0, 4
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.trunc.f128(
fp128 %src,
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
; Test round for f32.
declare float @llvm.experimental.constrained.round.f32(float, metadata)
define float @f16(float %f) #0 {
; CHECK-LABEL: f16:
; CHECK: fiebra %f0, 1, %f0, 4
; CHECK: br %r14
%res = call float @llvm.experimental.constrained.round.f32(
float %f,
metadata !"fpexcept.strict") #0
ret float %res
}
; Test round for f64.
declare double @llvm.experimental.constrained.round.f64(double, metadata)
define double @f17(double %f) #0 {
; CHECK-LABEL: f17:
; CHECK: fidbra %f0, 1, %f0, 4
; CHECK: br %r14
%res = call double @llvm.experimental.constrained.round.f64(
double %f,
metadata !"fpexcept.strict") #0
ret double %res
}
; Test round for f128.
declare fp128 @llvm.experimental.constrained.round.f128(fp128, metadata)
define void @f18(fp128 *%ptr) #0 {
; CHECK-LABEL: f18:
; CHECK: fixbra %f0, 1, %f0, 4
; CHECK: br %r14
%src = load fp128, fp128 *%ptr
%res = call fp128 @llvm.experimental.constrained.round.f128(
fp128 %src,
metadata !"fpexcept.strict") #0
store fp128 %res, fp128 *%ptr
ret void
}
attributes #0 = { strictfp }