[PATCH] D55745: [InstCombine] Simplify cttz/ctlz + icmp eq/ne into mask check

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 16 11:28:39 PST 2018


nikic created this revision.
nikic added reviewers: spatel, RKSimon.
Herald added subscribers: llvm-commits, JDevlieghere.

Related to https://bugs.llvm.org/show_bug.cgi?id=28668.

Checking whether a number has a certain number of trailing / leading zeros means checking whether it is of the form 0001XXXX or XXXX1000, which can be done with an and+icmp.

This is the first step, handling only eq/ne predicates, as that's what the existing code does. I'd like to extend this to handle all predicate types in the next step, which would resolve https://github.com/rust-lang/rust/issues/43024.


Repository:
  rL LLVM

https://reviews.llvm.org/D55745

Files:
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  test/Transforms/InstCombine/cmp-intrinsic.ll
  test/Transforms/InstCombine/intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55745.178404.patch
Type: text/x-patch
Size: 9406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181216/f8aeb34f/attachment.bin>


More information about the llvm-commits mailing list