summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-06-09 13:30:14 +0000
committerSanjay Patel <spatel@rotateright.com>2019-06-09 13:30:14 +0000
commitde4d4d5049e50bf0947a775facc5e0ca221f69da (patch)
treed0bd0798ffdc7f994f19936f65dcf407b4897e4b /llvm
parent623d9ba068e6f11be992c5197a26f492573509ef (diff)
downloadbcm5719-llvm-de4d4d5049e50bf0947a775facc5e0ca221f69da.tar.gz
bcm5719-llvm-de4d4d5049e50bf0947a775facc5e0ca221f69da.zip
[InstSimplify] add tests for fcmp with known-never-nan operands; NFC
Opposite predicate for rL362742 / rL362879 / D62979 llvm-svn: 362902
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/Transforms/InstSimplify/floating-point-compare.ll50
1 files changed, 48 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index cefcff1dac7..b02248d3afc 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -309,6 +309,30 @@ define <2 x i1> @UIToFP_is_not_negative_vec(<2 x i32> %x) {
ret <2 x i1> %r
}
+; No FMF are required for this transform.
+
+define i1 @UIToFP_is_not_negative_or_nan(i32 %x) {
+; CHECK-LABEL: @UIToFP_is_not_negative_or_nan(
+; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
+; CHECK-NEXT: [[R:%.*]] = fcmp ult float [[A]], 0.000000e+00
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a = uitofp i32 %x to float
+ %r = fcmp ult float %a, 0.000000e+00
+ ret i1 %r
+}
+
+define <2 x i1> @UIToFP_is_not_negative_or_nan_vec(<2 x i32> %x) {
+; CHECK-LABEL: @UIToFP_is_not_negative_or_nan_vec(
+; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
+; CHECK-NEXT: [[R:%.*]] = fcmp 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 ult <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: ret i1 false
@@ -401,6 +425,28 @@ define <2 x i1> @fabs_is_not_negative_vec(<2 x double> %x) {
define i1 @fabs_nnan_is_not_negative(double %x) {
; CHECK-LABEL: @fabs_nnan_is_not_negative(
+; CHECK-NEXT: [[FABS:%.*]] = tail call nnan double @llvm.fabs.f64(double [[X:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ult double [[FABS]], 0.000000e+00
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %fabs = tail call nnan double @llvm.fabs.f64(double %x)
+ %cmp = fcmp 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 nnan <2 x double> @llvm.fabs.v2f64(<2 x double> [[X:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ult <2 x double> [[FABS]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %fabs = tail call nnan <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
+ %cmp = fcmp ult <2 x double> %fabs, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
+define i1 @fabs_fcmp-nnan_is_not_negative(double %x) {
+; CHECK-LABEL: @fabs_fcmp-nnan_is_not_negative(
; CHECK-NEXT: ret i1 false
;
%fabs = tail call double @llvm.fabs.f64(double %x)
@@ -408,8 +454,8 @@ define i1 @fabs_nnan_is_not_negative(double %x) {
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(
+define <2 x i1> @fabs_fcmp-nnan_is_not_negative_vec(<2 x double> %x) {
+; CHECK-LABEL: @fabs_fcmp-nnan_is_not_negative_vec(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
;
%fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
OpenPOWER on IntegriCloud