forked from OSchip/llvm-project
[InstSimplify] add tests for fcmp and known positive; NFC
llvm-svn: 345722
This commit is contained in:
parent
d0080c3a5f
commit
1cd9917edf
|
@ -234,44 +234,84 @@ define i1 @orderedLessZeroPowi(double,double) {
|
|||
ret i1 %olt
|
||||
}
|
||||
|
||||
define i1 @orderedLessZeroUIToFP(i32 %x) {
|
||||
; CHECK-LABEL: @orderedLessZeroUIToFP(
|
||||
define i1 @UIToFP_is_nan_or_positive_or_zero(i32 %x) {
|
||||
; CHECK-LABEL: @UIToFP_is_nan_or_positive_or_zero(
|
||||
; CHECK-NEXT: ret i1 true
|
||||
;
|
||||
%a = uitofp i32 %x to float
|
||||
%uge = fcmp uge float %a, 0.000000e+00
|
||||
ret i1 %uge
|
||||
%r = fcmp uge float %a, 0.000000e+00
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define <2 x i1> @orderedLessZeroUIToFP_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @orderedLessZeroUIToFP_vec(
|
||||
define <2 x i1> @UIToFP_is_nan_or_positive_or_zero_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @UIToFP_is_nan_or_positive_or_zero_vec(
|
||||
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
|
||||
;
|
||||
%a = uitofp <2 x i32> %x to <2 x float>
|
||||
%uge = fcmp uge <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %uge
|
||||
%r = fcmp uge <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %r
|
||||
}
|
||||
|
||||
define i1 @orderedLessZeroUIToFP_nnan(i32 %x) {
|
||||
; CHECK-LABEL: @orderedLessZeroUIToFP_nnan(
|
||||
define i1 @UIToFP_nnan_is_positive_or_zero(i32 %x) {
|
||||
; CHECK-LABEL: @UIToFP_nnan_is_positive_or_zero(
|
||||
; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
|
||||
; CHECK-NEXT: [[UGE:%.*]] = fcmp nnan oge float [[A]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[UGE]]
|
||||
; CHECK-NEXT: [[R:%.*]] = fcmp nnan oge float [[A]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%a = uitofp i32 %x to float
|
||||
%uge = fcmp nnan oge float %a, 0.000000e+00
|
||||
ret i1 %uge
|
||||
%r = fcmp nnan oge float %a, 0.000000e+00
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define <2 x i1> @orderedLessZeroUIToFP_nnan_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @orderedLessZeroUIToFP_nnan_vec(
|
||||
define <2 x i1> @UIToFP_nnan_is_positive_or_zero_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @UIToFP_nnan_is_positive_or_zero_vec(
|
||||
; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
|
||||
; CHECK-NEXT: [[UGE:%.*]] = fcmp nnan oge <2 x float> [[A]], zeroinitializer
|
||||
; CHECK-NEXT: ret <2 x i1> [[UGE]]
|
||||
; CHECK-NEXT: [[R:%.*]] = fcmp nnan oge <2 x float> [[A]], zeroinitializer
|
||||
; CHECK-NEXT: ret <2 x i1> [[R]]
|
||||
;
|
||||
%a = uitofp <2 x i32> %x to <2 x float>
|
||||
%uge = fcmp nnan oge <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %uge
|
||||
%r = fcmp nnan oge <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %r
|
||||
}
|
||||
|
||||
define i1 @UIToFP_is_not_negative(i32 %x) {
|
||||
; CHECK-LABEL: @UIToFP_is_not_negative(
|
||||
; CHECK-NEXT: ret i1 false
|
||||
;
|
||||
%a = uitofp i32 %x to float
|
||||
%r = fcmp olt float %a, 0.000000e+00
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define <2 x i1> @UIToFP_is_not_negative_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @UIToFP_is_not_negative_vec(
|
||||
; CHECK-NEXT: ret <2 x i1> zeroinitializer
|
||||
;
|
||||
%a = uitofp <2 x i32> %x to <2 x float>
|
||||
%r = fcmp olt <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %r
|
||||
}
|
||||
|
||||
define i1 @UIToFP_nnan_is_not_negative(i32 %x) {
|
||||
; CHECK-LABEL: @UIToFP_nnan_is_not_negative(
|
||||
; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
|
||||
; CHECK-NEXT: [[R:%.*]] = fcmp nnan ult float [[A]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%a = uitofp i32 %x to float
|
||||
%r = fcmp nnan ult float %a, 0.000000e+00
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define <2 x i1> @UIToFP_nnan_is_not_negative_vec(<2 x i32> %x) {
|
||||
; CHECK-LABEL: @UIToFP_nnan_is_not_negative_vec(
|
||||
; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
|
||||
; CHECK-NEXT: [[R:%.*]] = fcmp nnan ult <2 x float> [[A]], zeroinitializer
|
||||
; CHECK-NEXT: ret <2 x i1> [[R]]
|
||||
;
|
||||
%a = uitofp <2 x i32> %x to <2 x float>
|
||||
%r = fcmp nnan ult <2 x float> %a, zeroinitializer
|
||||
ret <2 x i1> %r
|
||||
}
|
||||
|
||||
define i1 @fabs_is_nan_or_positive_or_zero(double %x) {
|
||||
|
@ -314,6 +354,46 @@ define <2 x i1> @fabs_nnan_is_positive_or_zero_vec(<2 x double> %x) {
|
|||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define i1 @fabs_is_not_negative(double %x) {
|
||||
; CHECK-LABEL: @fabs_is_not_negative(
|
||||
; CHECK-NEXT: ret i1 false
|
||||
;
|
||||
%fabs = tail call double @llvm.fabs.f64(double %x)
|
||||
%cmp = fcmp olt double %fabs, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
define <2 x i1> @fabs_is_not_negative_vec(<2 x double> %x) {
|
||||
; CHECK-LABEL: @fabs_is_not_negative_vec(
|
||||
; CHECK-NEXT: ret <2 x i1> zeroinitializer
|
||||
;
|
||||
%fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
|
||||
%cmp = fcmp olt <2 x double> %fabs, zeroinitializer
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define i1 @fabs_nnan_is_not_negative(double %x) {
|
||||
; CHECK-LABEL: @fabs_nnan_is_not_negative(
|
||||
; CHECK-NEXT: [[FABS:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ult double [[FABS]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%fabs = tail call double @llvm.fabs.f64(double %x)
|
||||
%cmp = fcmp nnan ult double %fabs, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
define <2 x i1> @fabs_nnan_is_not_negative_vec(<2 x double> %x) {
|
||||
; CHECK-LABEL: @fabs_nnan_is_not_negative_vec(
|
||||
; CHECK-NEXT: [[FABS:%.*]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> [[X:%.*]])
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ult <2 x double> [[FABS]], zeroinitializer
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
|
||||
%cmp = fcmp nnan ult <2 x double> %fabs, zeroinitializer
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define i1 @orderedLessZeroSelect(float, float) {
|
||||
; CHECK-LABEL: @orderedLessZeroSelect(
|
||||
; CHECK-NEXT: ret i1 true
|
||||
|
|
Loading…
Reference in New Issue