[PATCH] D66308: [InstCombine] Fold select with ctlz to cttz

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 11:27:42 PDT 2019


xbolva00 created this revision.
xbolva00 added reviewers: spatel, nikic, lebedev.ri.
Herald added subscribers: llvm-commits, kristof.beyls, javed.absar.
Herald added a project: LLVM.

Handle pattern [0]:

int ctz(unsigned int a)
{

  int c = __clz(a & -a);
  return a ? 31 - c : c;

}

[0] https://community.arm.com/community-help/f/discussions/2114/count-trailing-zeros


Repository:
  rL LLVM

https://reviews.llvm.org/D66308

Files:
  lib/Transforms/InstCombine/InstCombineSelect.cpp
  test/Transforms/InstCombine/select-ctlz-to-cttz.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66308.215447.patch
Type: text/x-patch
Size: 6928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/5d7a46b2/attachment.bin>


More information about the llvm-commits mailing list