[all-commits] [llvm/llvm-project] a6db20: [libcxx] Use generic builtins for popcount, clz an...

Marc Auberer via All-commits all-commits at lists.llvm.org
Thu Apr 11 05:15:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a6db20f2c39ecb5939890317068d5398c760746d
      https://github.com/llvm/llvm-project/commit/a6db20f2c39ecb5939890317068d5398c760746d
  Author: Marc Auberer <marc.auberer at chillibits.com>
  Date:   2024-04-11 (Thu, 11 Apr 2024)

  Changed paths:
    M libcxx/include/__bit/countl.h
    M libcxx/include/__bit/countr.h
    M libcxx/include/__bit/popcount.h

  Log Message:
  -----------
  [libcxx] Use generic builtins for popcount, clz and ctz (#86563)

Fixes #86556

Use `__builtin_popcountg` instead of `__buildin_popcount{l|ll}`
Use `__builtin_clzg instead` of `__buildin_clz{l|ll}`
Use `__builtin_ctzg instead` of `__builtin_ctz{l|ll}`

The generic variant of the builtins can be used to simplify some logic
with >= Clang 19 or >= GCC 14, where these generic variants are
available. As for backwards compatibility reasons, we can't completely
remove the old logic. Therefore, I left ToDo comments to address this,
as soon as support for pre Clang 19 as well as pre GCC 14 is dropped.

---------

Co-authored-by: Nick Desaulniers <nickdesaulniers at users.noreply.github.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list