blob: ba96ecfa776b86e1e361dc683cbae4ad5bdc8770 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s
declare float @llvm.tan.f32(float)
declare float @llvm.sinh.f32(float)
declare float @llvm.cosh.f32(float)
declare float @llvm.tanh.f32(float)
declare float @llvm.asin.f32(float)
declare float @llvm.acos.f32(float)
declare float @llvm.atan.f32(float)
declare float @llvm.atan2.f32(float, float)
; tan never returns Inf (tan(+-Inf) = NaN; tan(finite) = finite).
define float @ret_tan(float %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_tan
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1:[0-9]+]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.tan.f32(float [[ARG]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tan.f32(float %arg)
ret float %call
}
define float @ret_tan_noinf(float nofpclass(inf) %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_tan_noinf
; CHECK-SAME: (float nofpclass(inf) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.tan.f32(float nofpclass(inf) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tan.f32(float %arg)
ret float %call
}
define float @ret_tan_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_tan_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.tan.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tan.f32(float %arg)
ret float %call
}
; tan(x) is NaN-free if input is finite and non-NaN.
define float @ret_tan_nonan_noinf(float nofpclass(nan inf) %arg) {
; CHECK-LABEL: define nofpclass(nan inf) float @ret_tan_nonan_noinf
; CHECK-SAME: (float nofpclass(nan inf) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @llvm.tan.f32(float nofpclass(nan inf) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tan.f32(float %arg)
ret float %call
}
; sinh is sign-preserving: sinh(x) >= 0 if x >= 0.
define float @ret_sinh_nonneg(float nofpclass(ninf nzero nsub nnorm) %arg) {
; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_sinh_nonneg
; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.sinh.f32(float nofpclass(ninf nzero nsub nnorm) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sinh.f32(float %arg)
ret float %call
}
; cosh(x) >= 1 for all real x; cosh is always non-negative.
define float @ret_cosh(float %arg) {
; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_cosh
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.cosh.f32(float [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.cosh.f32(float %arg)
ret float %call
}
define float @ret_cosh_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_cosh_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.cosh.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.cosh.f32(float %arg)
ret float %call
}
; tanh is bounded to (-1, 1), never Inf.
define float @ret_tanh(float %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_tanh
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.tanh.f32(float [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tanh.f32(float %arg)
ret float %call
}
define float @ret_tanh_nonneg(float nofpclass(ninf nzero nsub nnorm) %arg) {
; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_tanh_nonneg
; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.tanh.f32(float nofpclass(ninf nzero nsub nnorm) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tanh.f32(float %arg)
ret float %call
}
define float @ret_tanh_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(nan inf) float @ret_tanh_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @llvm.tanh.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.tanh.f32(float %arg)
ret float %call
}
; asin is bounded to [-pi/2, pi/2], never Inf.
define float @ret_asin(float %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_asin
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.asin.f32(float [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.asin.f32(float %arg)
ret float %call
}
define float @ret_asin_nonneg(float nofpclass(ninf nzero nsub nnorm) %arg) {
; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_asin_nonneg
; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.asin.f32(float nofpclass(ninf nzero nsub nnorm) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.asin.f32(float %arg)
ret float %call
}
define float @ret_asin_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(nan inf) float @ret_asin_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @llvm.asin.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.asin.f32(float %arg)
ret float %call
}
; acos is bounded to [0, pi], never Inf or negative.
define float @ret_acos(float %arg) {
; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_acos
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.acos.f32(float [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.acos.f32(float %arg)
ret float %call
}
define float @ret_acos_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(nan inf nzero nsub nnorm) float @ret_acos_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf nzero nsub nnorm) float @llvm.acos.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.acos.f32(float %arg)
ret float %call
}
; atan is bounded to (-pi/2, pi/2), never Inf. atan(+-Inf) = +-pi/2 (finite).
define float @ret_atan(float %arg) {
; CHECK-LABEL: define nofpclass(inf) float @ret_atan
; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.atan.f32(float [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.atan.f32(float %arg)
ret float %call
}
define float @ret_atan_nonneg(float nofpclass(ninf nzero nsub nnorm) %arg) {
; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_atan_nonneg
; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.atan.f32(float nofpclass(ninf nzero nsub nnorm) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.atan.f32(float %arg)
ret float %call
}
define float @ret_atan_nonan(float nofpclass(nan) %arg) {
; CHECK-LABEL: define nofpclass(nan inf) float @ret_atan_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @llvm.atan.f32(float nofpclass(nan) [[ARG]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.atan.f32(float %arg)
ret float %call
}
; atan2 result is in (-pi, pi], never Inf.
define float @ret_atan2(float %arg0, float %arg1) {
; CHECK-LABEL: define nofpclass(inf) float @ret_atan2
; CHECK-SAME: (float [[ARG0:%.*]], float [[ARG1:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf) float @llvm.atan2.f32(float [[ARG0]], float [[ARG1]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.atan2.f32(float %arg0, float %arg1)
ret float %call
}
define float @ret_atan2_nonan(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) {
; CHECK-LABEL: define nofpclass(nan inf) float @ret_atan2_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf) float @llvm.atan2.f32(float nofpclass(nan) [[ARG0]], float nofpclass(nan) [[ARG1]]) #[[ATTR2]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.atan2.f32(float %arg0, float %arg1)
ret float %call
}