forked from OSchip/llvm-project
[InstCombine][InstSimplify] add tests for sign of maxnum; NFC
More coverage for D83601.
This commit is contained in:
parent
84a1bc7f2c
commit
9cc669d22d
|
@ -3,6 +3,7 @@
|
|||
|
||||
declare float @llvm.fabs.f32(float)
|
||||
declare float @llvm.copysign.f32(float, float)
|
||||
declare float @llvm.maxnum.f32(float, float)
|
||||
declare <3 x double> @llvm.copysign.v3f64(<3 x double>, <3 x double>)
|
||||
|
||||
define float @positive_sign_arg(float %x) {
|
||||
|
@ -63,6 +64,18 @@ define <3 x double> @known_positive_sign_arg_vec(<3 x double> %x, <3 x i32> %y)
|
|||
ret <3 x double> %r
|
||||
}
|
||||
|
||||
; FIXME: maxnum(-0.0, 0.0) can return -0.0.
|
||||
|
||||
define float @not_known_positive_sign_arg(float %x, float %y) {
|
||||
; CHECK-LABEL: @not_known_positive_sign_arg(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call ninf float @llvm.fabs.f32(float [[Y:%.*]])
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%max = call float @llvm.maxnum.f32(float %x, float 0.0)
|
||||
%r = call ninf float @llvm.copysign.f32(float %y, float %max)
|
||||
ret float %r
|
||||
}
|
||||
|
||||
; The magnitude operand of the 1st copysign is irrelevant.
|
||||
; copysign(x, copysign(y, z)) --> copysign(x, z)
|
||||
|
||||
|
|
|
@ -1383,3 +1383,13 @@ define float @maxnum_with_negzero_op_commute(float %a) {
|
|||
%fabs = call float @llvm.fabs.f32(float %max)
|
||||
ret float %fabs
|
||||
}
|
||||
|
||||
define float @maxnum_with_pos_one_op(float %a) {
|
||||
; CHECK-LABEL: @maxnum_with_pos_one_op(
|
||||
; CHECK-NEXT: [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[A:%.*]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[MAX]]
|
||||
;
|
||||
%max = call float @llvm.maxnum.f32(float %a, float 1.0)
|
||||
%fabs = call float @llvm.fabs.f32(float %max)
|
||||
ret float %fabs
|
||||
}
|
||||
|
|
|
@ -212,6 +212,15 @@ define i1 @orderedLessZero_fdiv(float %x) {
|
|||
ret i1 %uge
|
||||
}
|
||||
|
||||
define i1 @orderedLessZero_maxnum(float %x) {
|
||||
; CHECK-LABEL: @orderedLessZero_maxnum(
|
||||
; CHECK-NEXT: ret i1 true
|
||||
;
|
||||
%d = call float @llvm.maxnum.f32(float %x, float 0.0)
|
||||
%uge = fcmp uge float %d, 0.0
|
||||
ret i1 %uge
|
||||
}
|
||||
|
||||
define i1 @orderedLessZeroExpExt(float) {
|
||||
; CHECK-LABEL: @orderedLessZeroExpExt(
|
||||
; CHECK-NEXT: ret i1 true
|
||||
|
|
Loading…
Reference in New Issue