diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-11-27 16:08:34 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-11-27 16:08:34 +0000 |
| commit | 178b70a3de315e49d94c843aca92d55024ab3fb5 (patch) | |
| tree | 386b3ff985facfe9d744cb2626c3b72d069588b9 /llvm/test | |
| parent | 31ef2b43fd9683990a597cf13867e6df5cebdc89 (diff) | |
| download | bcm5719-llvm-178b70a3de315e49d94c843aca92d55024ab3fb5.tar.gz bcm5719-llvm-178b70a3de315e49d94c843aca92d55024ab3fb5.zip | |
[InstSimplify] add fcmp with negative constant tests; NFC
This is a superset of the tests proposed with D40012 to show another potential improvement.
llvm-svn: 319041
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/floating-point-compare.ll | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll index c46e8a9ed1c..5241e32615d 100644 --- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll +++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll @@ -170,6 +170,8 @@ define i1 @one_with_self(double %arg) { ; without combinatorial explosion. declare float @llvm.fabs.f32(float) +declare double @llvm.fabs.f64(double) +declare <2 x double> @llvm.fabs.v2f64(<2 x double>) declare float @llvm.sqrt.f32(float) declare double @llvm.powi.f64(double,i32) declare float @llvm.exp.f32(float) @@ -272,6 +274,50 @@ define i1 @orderedLessZeroMaxNum(float, float) { ret i1 %uge } +define i1 @known_positive_olt_with_negative_constant(double %a) { +; CHECK-LABEL: @known_positive_olt_with_negative_constant( +; CHECK-NEXT: [[CALL:%.*]] = call double @llvm.fabs.f64(double %a) +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt double [[CALL]], -1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %call = call double @llvm.fabs.f64(double %a) + %cmp = fcmp olt double %call, -1.0 + ret i1 %cmp +} + +define <2 x i1> @known_positive_ole_with_negative_constant_splat_vec(<2 x double> %a) { +; CHECK-LABEL: @known_positive_ole_with_negative_constant_splat_vec( +; CHECK-NEXT: [[CALL:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> %a) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ole <2 x double> [[CALL]], <double -2.000000e+00, double -2.000000e+00> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %call = call <2 x double> @llvm.fabs.v2f64(<2 x double> %a) + %cmp = fcmp ole <2 x double> %call, <double -2.0, double -2.0> + ret <2 x i1> %cmp +} + +define i1 @known_positive_ugt_with_negative_constant(double %a) { +; CHECK-LABEL: @known_positive_ugt_with_negative_constant( +; CHECK-NEXT: [[CALL:%.*]] = call double @llvm.fabs.f64(double %a) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt double [[CALL]], -3.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %call = call double @llvm.fabs.f64(double %a) + %cmp = fcmp ugt double %call, -3.0 + ret i1 %cmp +} + +define <2 x i1> @known_positive_uge_with_negative_constant_splat_vec(<2 x double> %a) { +; CHECK-LABEL: @known_positive_uge_with_negative_constant_splat_vec( +; CHECK-NEXT: [[CALL:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> %a) +; CHECK-NEXT: [[CMP:%.*]] = fcmp uge <2 x double> [[CALL]], <double -4.000000e+00, double -4.000000e+00> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %call = call <2 x double> @llvm.fabs.v2f64(<2 x double> %a) + %cmp = fcmp uge <2 x double> %call, <double -4.0, double -4.0> + ret <2 x i1> %cmp +} + define i1 @nonans1(double %in1, double %in2) { ; CHECK-LABEL: @nonans1( ; CHECK-NEXT: ret i1 false |

