@@ -1459,40 +1459,45 @@ More information could be found `here <https://clang.llvm.org/docs/Modules.html>
14591459Language Extensions Back-ported to Previous Standards
14601460=====================================================
14611461
1462- ====================================== ================================ ============= =============
1463- Feature Feature Test Macro Introduced In Backported To
1464- ====================================== ================================ ============= =============
1465- variadic templates __cpp_variadic_templates C++11 C++03
1466- Alias templates __cpp_alias_templates C++11 C++03
1467- Non-static data member initializers __cpp_nsdmi C++11 C++03
1468- Range-based ``for `` loop __cpp_range_based_for C++11 C++03
1469- RValue references __cpp_rvalue_references C++11 C++03
1470- Attributes __cpp_attributes C++11 C++03
1471- variable templates __cpp_variable_templates C++14 C++03
1472- Binary literals __cpp_binary_literals C++14 C++03
1473- Relaxed constexpr __cpp_constexpr C++14 C++11
1474- ``if constexpr `` __cpp_if_constexpr C++17 C++11
1475- fold expressions __cpp_fold_expressions C++17 C++03
1476- Lambda capture of \* this by value __cpp_capture_star_this C++17 C++11
1477- Attributes on enums __cpp_enumerator_attributes C++17 C++03
1478- Guaranteed copy elision __cpp_guaranteed_copy_elision C++17 C++03
1479- Hexadecimal floating literals __cpp_hex_float C++17 C++03
1480- ``inline `` variables __cpp_inline_variables C++17 C++03
1481- Attributes on namespaces __cpp_namespace_attributes C++17 C++11
1482- Structured bindings __cpp_structured_bindings C++17 C++03
1483- template template arguments __cpp_template_template_args C++17 C++03
1484- ``static operator[] `` __cpp_multidimensional_subscript C++20 C++03
1485- Designated initializers __cpp_designated_initializers C++20 C++03
1486- Conditional ``explicit `` __cpp_conditional_explicit C++20 C++03
1487- ``using enum `` __cpp_using_enum C++20 C++03
1488- ``if consteval `` __cpp_if_consteval C++23 C++20
1489- ``static operator() `` __cpp_static_call_operator C++23 C++03
1490- Attributes on Lambda-Expressions C++23 C++11
1491- -------------------------------------- -------------------------------- ------------- -------------
1492- Designated initializers (N494) C99 C89
1493- Array & element qualification (N2607) C23 C89
1494- Attributes (N2335) C23 C89
1495- ====================================== ================================ ============= =============
1462+ ============================================ ================================ ============= =============
1463+ Feature Feature Test Macro Introduced In Backported To
1464+ ============================================ ================================ ============= =============
1465+ variadic templates __cpp_variadic_templates C++11 C++03
1466+ Alias templates __cpp_alias_templates C++11 C++03
1467+ Non-static data member initializers __cpp_nsdmi C++11 C++03
1468+ Range-based ``for `` loop __cpp_range_based_for C++11 C++03
1469+ RValue references __cpp_rvalue_references C++11 C++03
1470+ Attributes __cpp_attributes C++11 C++03
1471+ Lambdas __cpp_lambdas C++11 C++03
1472+ Generalized lambda captures __cpp_init_captures C++14 C++03
1473+ Generic lambda expressions __cpp_generic_lambdas C++14 C++03
1474+ variable templates __cpp_variable_templates C++14 C++03
1475+ Binary literals __cpp_binary_literals C++14 C++03
1476+ Relaxed constexpr __cpp_constexpr C++14 C++11
1477+ Pack expansion in generalized lambda-capture __cpp_init_captures C++17 C++03
1478+ ``if constexpr `` __cpp_if_constexpr C++17 C++11
1479+ fold expressions __cpp_fold_expressions C++17 C++03
1480+ Lambda capture of \* this by value __cpp_capture_star_this C++17 C++03
1481+ Attributes on enums __cpp_enumerator_attributes C++17 C++03
1482+ Guaranteed copy elision __cpp_guaranteed_copy_elision C++17 C++03
1483+ Hexadecimal floating literals __cpp_hex_float C++17 C++03
1484+ ``inline `` variables __cpp_inline_variables C++17 C++03
1485+ Attributes on namespaces __cpp_namespace_attributes C++17 C++11
1486+ Structured bindings __cpp_structured_bindings C++17 C++03
1487+ template template arguments __cpp_template_template_args C++17 C++03
1488+ Familiar template syntax for generic lambdas __cpp_generic_lambdas C++20 C++03
1489+ ``static operator[] `` __cpp_multidimensional_subscript C++20 C++03
1490+ Designated initializers __cpp_designated_initializers C++20 C++03
1491+ Conditional ``explicit `` __cpp_conditional_explicit C++20 C++03
1492+ ``using enum `` __cpp_using_enum C++20 C++03
1493+ ``if consteval `` __cpp_if_consteval C++23 C++20
1494+ ``static operator() `` __cpp_static_call_operator C++23 C++03
1495+ Attributes on Lambda-Expressions C++23 C++11
1496+ -------------------------------------------- -------------------------------- ------------- -------------
1497+ Designated initializers (N494) C99 C89
1498+ Array & element qualification (N2607) C23 C89
1499+ Attributes (N2335) C23 C89
1500+ ============================================ ================================ ============= =============
14961501
14971502Type Trait Primitives
14981503=====================
@@ -3548,6 +3553,47 @@ argument can be of any unsigned integer type.
35483553``__builtin_popcount{,l,ll} `` builtins, with support for other integer types,
35493554such as ``unsigned __int128 `` and C23 ``unsigned _BitInt(N) ``.
35503555
3556+ ``__builtin_clzg `` and ``__builtin_ctzg ``
3557+ -----------------------------------------
3558+
3559+ ``__builtin_clzg `` (respectively ``__builtin_ctzg ``) returns the number of
3560+ leading (respectively trailing) 0 bits in the first argument. The first argument
3561+ can be of any unsigned integer type.
3562+
3563+ If the first argument is 0 and an optional second argument of ``int `` type is
3564+ provided, then the second argument is returned. If the first argument is 0, but
3565+ only one argument is provided, then the behavior is undefined.
3566+
3567+ **Syntax **:
3568+
3569+ .. code-block :: c++
3570+
3571+ int __builtin_clzg (type x[, int fallback])
3572+ int __builtin_ctzg (type x[, int fallback])
3573+
3574+ **Examples **:
3575+
3576+ .. code-block :: c++
3577+
3578+ unsigned int x = 1;
3579+ int x_lz = __builtin_clzg (x);
3580+ int x_tz = __builtin_ctzg (x);
3581+
3582+ unsigned long y = 2;
3583+ int y_lz = __builtin_clzg (y);
3584+ int y_tz = __builtin_ctzg (y);
3585+
3586+ unsigned _BitInt (128) z = 4;
3587+ int z_lz = __builtin_clzg (z);
3588+ int z_tz = __builtin_ctzg (z);
3589+
3590+ **Description **:
3591+
3592+ ``__builtin_clzg `` (respectively ``__builtin_ctzg ``) is meant to be a
3593+ type-generic alternative to the ``__builtin_clz{,l,ll} `` (respectively
3594+ ``__builtin_ctz{,l,ll} ``) builtins, with support for other integer types, such
3595+ as ``unsigned __int128 `` and C23 ``unsigned _BitInt(N) ``.
3596+
35513597Multiprecision Arithmetic Builtins
35523598----------------------------------
35533599
0 commit comments