rdar://12100355 (part 1)
authorShuxin Yang <shuxin.llvm@gmail.com>
Thu, 29 Nov 2012 19:38:54 +0000 (19:38 +0000)
committerShuxin Yang <shuxin.llvm@gmail.com>
Thu, 29 Nov 2012 19:38:54 +0000 (19:38 +0000)
commitabcc370423170abd4d6cc62d5e431cf1d7db2f71
tree8c86b529c8195e1472cb81e9765739bc81a9882d
parenta4a77edf2e27dc8a24ac3323c48a2c7201fccbda
rdar://12100355 (part 1)

This revision attempts to recognize following population-count pattern:

 while(a) { c++; ... ; a &= a - 1; ... },
  where <c> and <a>could be used multiple times in the loop body.

 TODO: On X8664 and ARM, __buildin_ctpop() are not expanded to a efficent
instruction sequence, which need to be improved in the following commits.

Reviewed by Nadav, really appreciate!

llvm-svn: 168931
llvm/include/llvm/Target/TargetTransformImpl.h
llvm/include/llvm/TargetTransformInfo.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/lib/Target/X86/X86TargetMachine.h
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/test/Transforms/LoopIdiom/popcnt.ll [new file with mode: 0644]