diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-05-08 17:53:18 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-05-08 17:53:18 +0000 |
commit | b64c48597fe9f69859d5ff8873a5eafc76142ffd (patch) | |
tree | 258d92767c7e3d86505af018e8b56f5d2c5000f6 | |
parent | 8186e390826902cfe93a9f6c98fd3c8010a1a2a1 (diff) | |
download | bcm5719-llvm-b64c48597fe9f69859d5ff8873a5eafc76142ffd.tar.gz bcm5719-llvm-b64c48597fe9f69859d5ff8873a5eafc76142ffd.zip |
[InstSimplify] add tests for fcmp+minnum; NFC
llvm-svn: 360275
-rw-r--r-- | llvm/test/Transforms/InstSimplify/floating-point-compare.ll | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll index 1a1afbe9133..982ff7b0bb1 100644 --- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll +++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll @@ -179,6 +179,7 @@ declare float @llvm.sqrt.f32(float) declare double @llvm.powi.f64(double,i32) declare float @llvm.exp.f32(float) declare float @llvm.minnum.f32(float, float) +declare <2 x float> @llvm.minnum.v2f32(<2 x float>, <2 x float>) declare float @llvm.maxnum.f32(float, float) declare float @llvm.maximum.f32(float, float) declare double @llvm.exp2.f64(double) @@ -503,6 +504,162 @@ define i1 @maxnum_non_nan(float %x) { ret i1 %cmp } +; min(x, 0.5) == 1.0 --> false + +define i1 @minnum_oeq_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_oeq_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp oeq float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) > 1.0 --> false + +define i1 @minnum_ogt_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ogt_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ogt float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) >= 1.0 --> false + +define i1 @minnum_oge_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_oge_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp oge float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp oge float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) == 1.0 --> false + +define i1 @minnum_ueq_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ueq_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ueq float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ueq float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) > 1.0 --> false + +define i1 @minnum_ugt_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ugt_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ugt float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) >= 1.0 --> false + +define <2 x i1> @minnum_uge_small_min_constant(<2 x float> %x) { +; CHECK-LABEL: @minnum_uge_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call <2 x float> @llvm.minnum.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 5.000000e-01, float 5.000000e-01>) +; CHECK-NEXT: [[CMP:%.*]] = fcmp uge <2 x float> [[MIN]], <float 1.000000e+00, float 1.000000e+00> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %min = call <2 x float> @llvm.minnum.v2f32(<2 x float> %x, <2 x float> <float 0.5, float 0.5>) + %cmp = fcmp uge <2 x float> %min, <float 1.0, float 1.0> + ret <2 x i1> %cmp +} + +; min(x, 0.5) < 1.0 --> true + +define <2 x i1> @minnum_olt_small_min_constant(<2 x float> %x) { +; CHECK-LABEL: @minnum_olt_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call <2 x float> @llvm.minnum.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 5.000000e-01, float 5.000000e-01>) +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[MIN]], <float 1.000000e+00, float 1.000000e+00> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %min = call <2 x float> @llvm.minnum.v2f32(<2 x float> %x, <2 x float> <float 0.5, float 0.5>) + %cmp = fcmp olt <2 x float> %min, <float 1.0, float 1.0> + ret <2 x i1> %cmp +} + +; min(x, 0.5) <= 1.0 --> true + +define i1 @minnum_ole_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ole_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ole float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ole float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) != 1.0 --> true + +define i1 @minnum_one_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_one_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp one float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp one float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) < 1.0 --> true + +define i1 @minnum_ult_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ult_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ult float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ult float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) <= 1.0 --> true + +define i1 @minnum_ule_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_ule_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp ule float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp ule float %min, 1.0 + ret i1 %cmp +} + +; min(x, 0.5) != 1.0 --> true + +define i1 @minnum_une_small_min_constant(float %x) { +; CHECK-LABEL: @minnum_une_small_min_constant( +; CHECK-NEXT: [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 5.000000e-01) +; CHECK-NEXT: [[CMP:%.*]] = fcmp une float [[MIN]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP]] +; + %min = call float @llvm.minnum.f32(float %x, float 0.5) + %cmp = fcmp une float %min, 1.0 + ret i1 %cmp +} + define i1 @known_positive_olt_with_negative_constant(double %a) { ; CHECK-LABEL: @known_positive_olt_with_negative_constant( ; CHECK-NEXT: ret i1 false |