summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-05-07 16:56:49 +0000
committerDuncan Sands <baldrick@free.fr>2011-05-07 16:56:49 +0000
commitaf32728a57e2092de84cad8c9479795a97a2b33c (patch)
tree155a0b6ff6fd5330031cd361f9dc70e84180105d /llvm/test
parent1e3db02bda30bc8529f3ceda63c2238cbce6cbae (diff)
downloadbcm5719-llvm-af32728a57e2092de84cad8c9479795a97a2b33c.tar.gz
bcm5719-llvm-af32728a57e2092de84cad8c9479795a97a2b33c.zip
The comparision "max(x,y)==x" is equivalent to "x>=y". Since the max is
often expressed as "x >= y ? x : y", there is a good chance we can extract the existing "x >= y" from it and use that as a replacement for "max(x,y)==x". llvm-svn: 131049
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstSimplify/maxmin.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/maxmin.ll b/llvm/test/Transforms/InstSimplify/maxmin.ll
index 707422cc01b..e921214e0f0 100644
--- a/llvm/test/Transforms/InstSimplify/maxmin.ll
+++ b/llvm/test/Transforms/InstSimplify/maxmin.ll
@@ -231,3 +231,39 @@ define i1 @maxmin8(i32 %x, i32 %y, i32 %z) {
ret i1 %c
; CHECK: ret i1 false
}
+
+define i1 @eqcmp1(i32 %x, i32 %y) {
+; CHECK: @eqcmp1
+ %c = icmp sge i32 %x, %y
+ %max = select i1 %c, i32 %x, i32 %y
+ %r = icmp eq i32 %max, %x
+ ret i1 %r
+; CHECK: ret i1 %c
+}
+
+define i1 @eqcmp2(i32 %x, i32 %y) {
+; CHECK: @eqcmp2
+ %c = icmp sge i32 %x, %y
+ %max = select i1 %c, i32 %x, i32 %y
+ %r = icmp eq i32 %x, %max
+ ret i1 %r
+; CHECK: ret i1 %c
+}
+
+define i1 @eqcmp3(i32 %x, i32 %y) {
+; CHECK: @eqcmp3
+ %c = icmp uge i32 %x, %y
+ %max = select i1 %c, i32 %x, i32 %y
+ %r = icmp eq i32 %max, %x
+ ret i1 %r
+; CHECK: ret i1 %c
+}
+
+define i1 @eqcmp4(i32 %x, i32 %y) {
+; CHECK: @eqcmp4
+ %c = icmp uge i32 %x, %y
+ %max = select i1 %c, i32 %x, i32 %y
+ %r = icmp eq i32 %x, %max
+ ret i1 %r
+; CHECK: ret i1 %c
+}
OpenPOWER on IntegriCloud