[PATCH] D111998: [ADT] Add APInt::isNegatedPowerOf2() helper
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 07:52:46 PDT 2021
RKSimon created this revision.
RKSimon added reviewers: spatel, nikic, dmgreen.
Herald added subscribers: dexonsmith, ecnelises, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.
Inspired by D111968 <https://reviews.llvm.org/D111968>, provide a isNegatedPowerOf2() wrapper instead of obfuscating code with (-Value).isPowerOf2() patterns, which I'm sure are likely avenues for typos.....
The actual implementation might be improved upon (iirc we're effectively looking for a shifted mask in the top bits).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111998
Files:
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/IR/PatternMatch.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
llvm/unittests/ADT/APIntTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111998.380397.patch
Type: text/x-patch
Size: 4408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211018/e3b7362d/attachment.bin>
More information about the llvm-commits
mailing list