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)
commit84fca61ca5fba5c33a799d9133750b6832ddef7e
tree59095a7c46e6337324c8b3f534bf514e375a3355
parent73601160486b14711e1c6fdd86481eda9c319e45
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168931 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetTransformImpl.h
include/llvm/TargetTransformInfo.h
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86TargetMachine.h
lib/Transforms/Scalar/LoopIdiomRecognize.cpp
test/Transforms/LoopIdiom/popcnt.ll [new file with mode: 0644]