From a5d45872962435d7e541666ef10c3e3f4c4b10e9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 May 2006 21:29:15 +0000 Subject: [PATCH] Add a note llvm-svn: 28572 --- llvm/lib/Target/README.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt index 807768002b52..650eabf2d4d1 100644 --- a/llvm/lib/Target/README.txt +++ b/llvm/lib/Target/README.txt @@ -251,3 +251,22 @@ void %test(uint* %P) { ret void } +//===---------------------------------------------------------------------===// + +dag/inst combine "clz(x)>>5 -> x==0" for 32-bit x. + +Compile: + +int bar(int x) +{ + int t = __builtin_clz(x); + return -(t>>5); +} + +to: + +_bar: addic r3,r3,-1 + subfe r3,r3,r3 + blr + +