[InstSimplify] add vector tests for fcmp+fabs; NFC

llvm-svn: 354404
This commit is contained in:
Sanjay Patel 2019-02-19 23:58:02 +00:00
parent 952d234d00
commit 9cf04addf3
1 changed files with 63 additions and 0 deletions

View File

@ -173,6 +173,7 @@ declare half @llvm.fabs.f16(half)
declare float @llvm.fabs.f32(float)
declare double @llvm.fabs.f64(double)
declare <2 x float> @llvm.fabs.v2f32(<2 x float>)
declare <3 x float> @llvm.fabs.v3f32(<3 x float>)
declare <2 x double> @llvm.fabs.v2f64(<2 x double>)
declare float @llvm.sqrt.f32(float)
declare double @llvm.powi.f64(double,i32)
@ -378,6 +379,68 @@ define <2 x i1> @fabs_nnan_is_not_negative_vec(<2 x double> %x) {
ret <2 x i1> %cmp
}
define <2 x i1> @fabs_is_not_negative_negzero(<2 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_negzero(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
;
%abs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %V)
%cmp = fcmp olt <2 x float> %abs, <float -0.0, float -0.0>
ret <2 x i1> %cmp
}
define <2 x i1> @fabs_is_not_negative_poszero(<2 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_poszero(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
;
%abs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %V)
%cmp = fcmp olt <2 x float> %abs, <float 0.0, float 0.0>
ret <2 x i1> %cmp
}
define <2 x i1> @fabs_is_not_negative_anyzero(<2 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_anyzero(
; CHECK-NEXT: [[ABS:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[V:%.*]])
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[ABS]], <float 0.000000e+00, float -0.000000e+00>
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%abs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %V)
%cmp = fcmp olt <2 x float> %abs, <float 0.0, float -0.0>
ret <2 x i1> %cmp
}
define <3 x i1> @fabs_is_not_negative_negzero_undef(<3 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_negzero_undef(
; CHECK-NEXT: [[ABS:%.*]] = call <3 x float> @llvm.fabs.v3f32(<3 x float> [[V:%.*]])
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <3 x float> [[ABS]], <float -0.000000e+00, float -0.000000e+00, float undef>
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%abs = call <3 x float> @llvm.fabs.v3f32(<3 x float> %V)
%cmp = fcmp olt <3 x float> %abs, <float -0.0, float -0.0, float undef>
ret <3 x i1> %cmp
}
define <3 x i1> @fabs_is_not_negative_poszero_undef(<3 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_poszero_undef(
; CHECK-NEXT: [[ABS:%.*]] = call <3 x float> @llvm.fabs.v3f32(<3 x float> [[V:%.*]])
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <3 x float> [[ABS]], <float 0.000000e+00, float 0.000000e+00, float undef>
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%abs = call <3 x float> @llvm.fabs.v3f32(<3 x float> %V)
%cmp = fcmp olt <3 x float> %abs, <float 0.0, float 0.0, float undef>
ret <3 x i1> %cmp
}
define <3 x i1> @fabs_is_not_negative_anyzero_undef(<3 x float> %V) {
; CHECK-LABEL: @fabs_is_not_negative_anyzero_undef(
; CHECK-NEXT: [[ABS:%.*]] = call <3 x float> @llvm.fabs.v3f32(<3 x float> [[V:%.*]])
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <3 x float> [[ABS]], <float 0.000000e+00, float -0.000000e+00, float undef>
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%abs = call <3 x float> @llvm.fabs.v3f32(<3 x float> %V)
%cmp = fcmp olt <3 x float> %abs, <float 0.0, float -0.0, float undef>
ret <3 x i1> %cmp
}
define i1 @orderedLessZeroSelect(float, float) {
; CHECK-LABEL: @orderedLessZeroSelect(
; CHECK-NEXT: ret i1 true