[PATCH] D80941: [PowerPC][Power10] Implement Count Leading/Trailing Zeroes Builtins under bit Mask in LLVM/Clang

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 04:50:39 PDT 2020


nemanjai added a comment.

Amy, I am really sorry. I initially did not read the description of the instructions in the ISA carefully. The semantics of these instructions are not actually `(op (and a, b))`. The mask is used to determine if a leading/trailing zero is counted or skipped.
Take for example the following two binary values:

  Mask:  1001111
  Value: 0010011

the result of `cntlzdm Value, Mask` should be `3` whereas the result of `(ctlz (and Value, Mask))` would be `5`. Namely, the instruction will count the first leading zero, ignore the next two bits and then count the next two zeros.

So you will need to revert back to the initial implementation. I am so sorry about going back and forth like this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80941





More information about the cfe-commits mailing list