[all-commits] [llvm/llvm-project] d1a0d0: [CIR] Fix __builtin_clz/__builtin_ctz poison_zero ...

Henrich Lauko via All-commits all-commits at lists.llvm.org
Sun Apr 19 12:03:18 PDT 2026


  Branch: refs/heads/users/xlauko/cir-fix-clz-ctz-poison-zero
  Home:   https://github.com/llvm/llvm-project
  Commit: d1a0d046e6eca4019b8a120f4186169c672eacc1
      https://github.com/llvm/llvm-project/commit/d1a0d046e6eca4019b8a120f4186169c672eacc1
  Author: xlauko <xlauko at mail.muni.cz>
  Date:   2026-04-19 (Sun, 19 Apr 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
    A clang/test/CIR/CodeGenBuiltins/builtin-bit-clz-ctz-target.cpp

  Log Message:
  -----------
  [CIR] Fix __builtin_clz/__builtin_ctz poison_zero to respect target

CIR was hardcoding poisonZero=true for all clz/ctz builtins, ignoring
the target's isCLZForZeroUndef(). This caused incorrect UB on targets
like AArch64 where clz/ctz of zero is well-defined.

Also add support for __builtin_c[lt]zg fallback (2-arg) variants with
compare+select, and add NYI stubs for elementwise variants.



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