diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-13 08:07:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-13 08:07:21 +0000 |
commit | bb75d337c4d544692cd250acba8e3507aacb7b75 (patch) | |
tree | 214eeec33beaf8a6dd54ac889987f7b4addf11fe /test | |
parent | 16e036fa8f1d1da02deeaf9a77951f4dc711faa1 (diff) | |
download | external_llvm-bb75d337c4d544692cd250acba8e3507aacb7b75.zip external_llvm-bb75d337c4d544692cd250acba8e3507aacb7b75.tar.gz external_llvm-bb75d337c4d544692cd250acba8e3507aacb7b75.tar.bz2 |
implement instcombine folding for things like (x >> c) < 42.
We were previously simplifying divisions, but not right shifts!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/exact.ll | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/exact.ll b/test/Transforms/InstCombine/exact.ll index 666bcb8..255bf7b 100644 --- a/test/Transforms/InstCombine/exact.ll +++ b/test/Transforms/InstCombine/exact.ll @@ -77,15 +77,24 @@ define i64 @ashr1(i64 %X) nounwind { ret i64 %B } -; CHECK: @ashr_icmp +; CHECK: @ashr_icmp1 ; CHECK: %B = icmp eq i64 %X, 0 ; CHECK: ret i1 %B -define i1 @ashr_icmp(i64 %X) nounwind { +define i1 @ashr_icmp1(i64 %X) nounwind { %A = ashr exact i64 %X, 2 ; X/4 %B = icmp eq i64 %A, 0 ret i1 %B } +; CHECK: @ashr_icmp2 +; CHECK: %Z = icmp slt i64 %X, 16 +; CHECK: ret i1 %Z +define i1 @ashr_icmp2(i64 %X) nounwind { + %Y = ashr exact i64 %X, 2 ; x / 4 + %Z = icmp slt i64 %Y, 4 ; x < 16 + ret i1 %Z +} + ; CHECK: @udiv_icmp1 ; CHECK: icmp ne i64 %X, 0 define i1 @udiv_icmp1(i64 %X) nounwind { |