diff options
author | Duncan Sands <baldrick@free.fr> | 2011-05-04 16:05:05 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-05-04 16:05:05 +0000 |
commit | 8140ad32ce45281ed2bc4f6ca388a6ed9f806550 (patch) | |
tree | ba5f006912d3eb6495a33fae19bea52a8e57070f /test | |
parent | 269687fa350c1aa044bc063c64362a04ecabaa33 (diff) | |
download | external_llvm-8140ad32ce45281ed2bc4f6ca388a6ed9f806550.zip external_llvm-8140ad32ce45281ed2bc4f6ca388a6ed9f806550.tar.gz external_llvm-8140ad32ce45281ed2bc4f6ca388a6ed9f806550.tar.bz2 |
Add variations on: max(x,y) >= min(x,z) folds to true. This isn't that common,
but according to my super-optimizer there are only two missed simplifications
of -instsimplify kind when compiling bzip2, and this is one of them. It amuses
me to have bzip2 be perfectly optimized as far as instsimplify goes!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstSimplify/maxmin.ll | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/maxmin.ll b/test/Transforms/InstSimplify/maxmin.ll index 6d92259..707422c 100644 --- a/test/Transforms/InstSimplify/maxmin.ll +++ b/test/Transforms/InstSimplify/maxmin.ll @@ -143,3 +143,91 @@ define i1 @min8(i32 %x, i32 %y) { ret i1 %r ; CHECK: ret i1 true } + +define i1 @maxmin1(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin1 + %c1 = icmp sge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp sge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp sge i32 %max, %min + ret i1 %c +; CHECK: ret i1 true +} + +define i1 @maxmin2(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin2 + %c1 = icmp sge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp sge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp sgt i32 %min, %max + ret i1 %c +; CHECK: ret i1 false +} + +define i1 @maxmin3(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin3 + %c1 = icmp sge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp sge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp sle i32 %min, %max + ret i1 %c +; CHECK: ret i1 true +} + +define i1 @maxmin4(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin4 + %c1 = icmp sge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp sge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp slt i32 %max, %min + ret i1 %c +; CHECK: ret i1 false +} + +define i1 @maxmin5(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin5 + %c1 = icmp uge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp uge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp uge i32 %max, %min + ret i1 %c +; CHECK: ret i1 true +} + +define i1 @maxmin6(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin6 + %c1 = icmp uge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp uge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp ugt i32 %min, %max + ret i1 %c +; CHECK: ret i1 false +} + +define i1 @maxmin7(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin7 + %c1 = icmp uge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp uge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp ule i32 %min, %max + ret i1 %c +; CHECK: ret i1 true +} + +define i1 @maxmin8(i32 %x, i32 %y, i32 %z) { +; CHECK: @maxmin8 + %c1 = icmp uge i32 %x, %y + %max = select i1 %c1, i32 %x, i32 %y + %c2 = icmp uge i32 %x, %z + %min = select i1 %c2, i32 %z, i32 %x + %c = icmp ult i32 %max, %min + ret i1 %c +; CHECK: ret i1 false +} |