summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-11 18:23:57 +0000
committerChris Lattner <sabre@nondot.org>2010-11-11 18:23:57 +0000
commit932aab3cbf7ed5d0b6f08eb2426a2afa2db408c8 (patch)
treeb647f1e505c2057c2c9d0af620d6f0a23ed278d1 /llvm
parenta3e9a2298d2118c0e6fecab228e4640fe9d88ae3 (diff)
downloadbcm5719-llvm-932aab3cbf7ed5d0b6f08eb2426a2afa2db408c8.tar.gz
bcm5719-llvm-932aab3cbf7ed5d0b6f08eb2426a2afa2db408c8.zip
add a note
llvm-svn: 118806
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/README.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt
index b27d99e18b5..d1e4bfb075e 100644
--- a/llvm/lib/Target/README.txt
+++ b/llvm/lib/Target/README.txt
@@ -1984,3 +1984,31 @@ void check_c28 () {
}
//===---------------------------------------------------------------------===//
+
+We compile this:
+
+int foo(int a) { return (a & (~15)) / 16; }
+
+Into:
+
+define i32 @foo(i32 %a) nounwind readnone ssp {
+entry:
+ %and = and i32 %a, -16
+ %div = sdiv i32 %and, 16
+ ret i32 %div
+}
+
+but this code (X & -A)/A is X >> log2(A) when A is a power of 2, so this case
+should be instcombined into just "a >> 4".
+
+We do get this at the codegen level, so something knows about it, but
+instcombine should catch it earlier:
+
+_foo: ## @foo
+## BB#0: ## %entry
+ movl %edi, %eax
+ sarl $4, %eax
+ ret
+
+//===---------------------------------------------------------------------===//
+
OpenPOWER on IntegriCloud