summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-26 17:12:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-26 17:12:06 +0000
commit8f820e94954d2120055a4c7bfafb3c913fa0295a (patch)
tree6b6f69239e8b325111a53ab7001ae98ed03c29b1 /lib/Target/README.txt
parent27d12f3e6e2079c9d9d69caae267ed0320109ffa (diff)
InstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0
Anding and comparing with zero can be done in a single instruction on most archs so this is a bit cheaper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt38
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 52a334a6174..282d9234c1a 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -1844,44 +1844,6 @@ we remove checking in code like
//===---------------------------------------------------------------------===//
-This code (from Benchmarks/Dhrystone/dry.c):
-
-define i32 @Func1(i32, i32) nounwind readnone optsize ssp {
-entry:
- %sext = shl i32 %0, 24
- %conv = ashr i32 %sext, 24
- %sext6 = shl i32 %1, 24
- %conv4 = ashr i32 %sext6, 24
- %cmp = icmp eq i32 %conv, %conv4
- %. = select i1 %cmp, i32 10000, i32 0
- ret i32 %.
-}
-
-Should be simplified into something like:
-
-define i32 @Func1(i32, i32) nounwind readnone optsize ssp {
-entry:
- %sext = shl i32 %0, 24
- %conv = and i32 %sext, 0xFF000000
- %sext6 = shl i32 %1, 24
- %conv4 = and i32 %sext6, 0xFF000000
- %cmp = icmp eq i32 %conv, %conv4
- %. = select i1 %cmp, i32 10000, i32 0
- ret i32 %.
-}
-
-and then to:
-
-define i32 @Func1(i32, i32) nounwind readnone optsize ssp {
-entry:
- %conv = and i32 %0, 0xFF
- %conv4 = and i32 %1, 0xFF
- %cmp = icmp eq i32 %conv, %conv4
- %. = select i1 %cmp, i32 10000, i32 0
- ret i32 %.
-}
-//===---------------------------------------------------------------------===//
-
clang -O3 currently compiles this code
int g(unsigned int a) {