aboutsummaryrefslogtreecommitdiff
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
commitaf510f16ecf54a01003f06d5a1a3e05c8b576a47 (patch)
treea9261100d3e22951eef4c1a726f846381b93cd2f
parent2ff9e83a826c1c2ee0f1c6072d3d97d5b10678ee (diff)
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118806 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/README.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index b27d99e18b..d1e4bfb075 100644
--- a/lib/Target/README.txt
+++ b/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
+
+//===---------------------------------------------------------------------===//
+