aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/and-fcmp.ll
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-09-03 15:35:10 +0000
committerSanjay Patel <spatel@rotateright.com>2017-09-03 15:35:10 +0000
commit74c232b75f3aa0b64ca287c5e0cb29dce1bd1ca8 (patch)
tree1b3f24d8b247640457f785237fe31e5aaf0a9835 /test/Transforms/InstCombine/and-fcmp.ll
parent1ee1fb604621025bd2b1a681a09ab54ff69623d1 (diff)
[InstCombine] add tests for fcmp ord/uno canonicalization; NFC
Currently, we canonicalize some cases to use 0.0, but we miss others. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/and-fcmp.ll')
-rw-r--r--test/Transforms/InstCombine/and-fcmp.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/and-fcmp.ll b/test/Transforms/InstCombine/and-fcmp.ll
index 553533392c1..7bf300d9a14 100644
--- a/test/Transforms/InstCombine/and-fcmp.ll
+++ b/test/Transforms/InstCombine/and-fcmp.ll
@@ -28,6 +28,30 @@ define <2 x i1> @t9(<2 x float> %a, <2 x double> %b) {
ret <2 x i1> %and
}
+define i1 @fcmp_ord_nonzero(float %x, float %y) {
+; CHECK-LABEL: @fcmp_ord_nonzero(
+; CHECK-NEXT: [[TMP1:%.*]] = fcmp ord float %x, %y
+; CHECK-NEXT: ret i1 [[TMP1]]
+;
+ %cmp1 = fcmp ord float %x, 1.0
+ %cmp2 = fcmp ord float %y, 2.0
+ %and = and i1 %cmp1, %cmp2
+ ret i1 %and
+}
+
+define <3 x i1> @fcmp_ord_nonzero_vec(<3 x float> %x, <3 x float> %y) {
+; CHECK-LABEL: @fcmp_ord_nonzero_vec(
+; CHECK-NEXT: [[CMP1:%.*]] = fcmp ord <3 x float> %x, <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>
+; CHECK-NEXT: [[CMP2:%.*]] = fcmp ord <3 x float> %y, <float 3.000000e+00, float 2.000000e+00, float 1.000000e+00>
+; CHECK-NEXT: [[AND:%.*]] = and <3 x i1> [[CMP1]], [[CMP2]]
+; CHECK-NEXT: ret <3 x i1> [[AND]]
+;
+ %cmp1 = fcmp ord <3 x float> %x, <float 1.0, float 2.0, float 3.0>
+ %cmp2 = fcmp ord <3 x float> %y, <float 3.0, float 2.0, float 1.0>
+ %and = and <3 x i1> %cmp1, %cmp2
+ ret <3 x i1> %and
+}
+
define i1 @auto_gen_0(double %a, double %b) {
; CHECK-LABEL: @auto_gen_0(
; CHECK-NEXT: ret i1 false