[PATCH] D32692: [SelectionDAG] Use known ones to provide a better bound for the known zeros for CTTZ/CTLZ operations.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 30 23:54:28 PDT 2017


craig.topper created this revision.

This is the SelectionDAG version of https://reviews.llvm.org/D32521. If know where at least one 1 is located in the input to these intrinsics we can place an upper bound on the number of bits needed to represent the count and thus increase the number of known zeros in the output.

I think we can also refine this further for CTTZ_UNDEF/CTLZ_UNDEF by assuming that the answer will never be BitWidth. I've left this out for now because it caused other test failures across multiple targets. Usually because of turning ADD into OR based on this new information.

I'll fix CTPOP in a future patch.


https://reviews.llvm.org/D32692

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  test/CodeGen/X86/clz.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32692.97260.patch
Type: text/x-patch
Size: 3376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170501/1a8ceaeb/attachment.bin>


More information about the llvm-commits mailing list