[all-commits] [llvm/llvm-project] 7510b7: [SystemZ] Use llvm::countl_zero and llvm::countr_z...

kazutakahirata via All-commits all-commits at lists.llvm.org
Wed Jan 25 22:05:20 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7510b7ec4a662b050a41b399fcd3720e0e5afd82
      https://github.com/llvm/llvm-project/commit/7510b7ec4a662b050a41b399fcd3720e0e5afd82
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-01-25 (Wed, 25 Jan 2023)

  Changed paths:
    M llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

  Log Message:
  -----------
  [SystemZ] Use llvm::countl_zero and llvm::countr_zero (NFC)

isVectorConstantLegal calls findFirstSet and findLastSet, but we don't
rely on their ability to return std::numeric_limits<T>::max() on input
0.

This patch replaces those calls with calls to llvm::countl_zero and
llvm::countr_zero.

Due to an off-by-one error in the original code, the value of Upper
could change at bit N, where N is the index of the highest set bit in
SplatBitsZ, but the difference doesn't matter at the end.  Without
this patch, Upper could have bit N set.  With this patch, Upper never
has bit N set.  Either way, both calls to tryValue have this bit set
because the argument is ORed with SplatBitsZ.




More information about the All-commits mailing list