[all-commits] [llvm/llvm-project] e27066: [clang]Implement the c23 stdc bit builtins (#185978)

NagaChaitanya Vellanki via All-commits all-commits at lists.llvm.org
Fri Apr 17 05:05:42 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e270662c0b2c3a24211f200fe758a84b45b25fcd
      https://github.com/llvm/llvm-project/commit/e270662c0b2c3a24211f200fe758a84b45b25fcd
  Author: NagaChaitanya Vellanki <pnagato at protonmail.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/BuiltinHeaders.def
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/AST/ByteCode/InterpBuiltin.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/CodeGen/Inputs/stdbit.h
    A clang/test/CodeGen/builtin-stdc-bit-functions.c
    A clang/test/Sema/Inputs/stdbit.h
    A clang/test/Sema/builtin-stdc-bit-functions.c
    A clang/test/SemaCXX/constexpr-builtin-stdc-bit-functions.cpp

  Log Message:
  -----------
  [clang]Implement the c23 stdc bit builtins (#185978)

This patch implements the following C23 bit builtins

  __builtin_stdc_leading_zeros/ones
  __builtin_stdc_trailing_zeros/ones
  __builtin_stdc_first_leading/trailing_zero/one
  __builtin_stdc_count_zeros/ones
  __builtin_stdc_has_single_bit
  __builtin_stdc_bit_width
  __builtin_stdc_bit_floor
  __builtin_stdc_bit_ceil

Additional Notes:
* Supports all unsigned integer types including _BitInt and __int128
 * lowers to llvm.ctlz / llvm.cttz / llvm.ctpop intrinsics
* constexpr support 

Addresses: #79630



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