[PATCH] D68189: [InstCombine] recognize popcount implemented in hacker's delight.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 07:53:53 PDT 2019


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:269-271
+  bool IsType32 = I.getType()->isIntegerTy(32);
+  uint16_t FinalShiftConst = IsType32 ? 24 : 56;
+  uint64_t MulConst = IsType32 ? 0x01010101 : 0x0101010101010101;
----------------
This might actually be easier to read if generalized for more bitwidths. Can we use APInt and handle power-of-2 sizes from 8- to 128-bit?
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68189/new/

https://reviews.llvm.org/D68189





More information about the llvm-commits mailing list