Skip to content

Commit f1208cc

Browse files
committed
fixup! [clang] Implement __builtin_popcountg
1 parent ea2c219 commit f1208cc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,37 @@ builtin, the mangler emits their usual pattern without any special treatment.
34733473
// Computes a unique stable name for the given type.
34743474
constexpr const char * __builtin_sycl_unique_stable_name( type-id );
34753475
3476+
``__builtin_popcountg``
3477+
-----------------------
3478+
3479+
``__builtin_popcountg`` returns the number of 1 bits in the argument. The
3480+
argument can be of any integer type.
3481+
3482+
**Syntax**:
3483+
3484+
.. code-block:: c++
3485+
3486+
int __builtin_popcountg(type x)
3487+
3488+
**Examples**:
3489+
3490+
.. code-block:: c++
3491+
3492+
int x = 1;
3493+
int x_pop = __builtin_popcountg(x);
3494+
3495+
unsigned long y = 3;
3496+
int y_pop = __builtin_popcountg(y);
3497+
3498+
_BitInt(128) z = 7;
3499+
int z_pop = __builtin_popcountg(z);
3500+
3501+
**Description**:
3502+
3503+
``__builtin_popcountg`` is meant to be a type-generic alternative to the
3504+
``__builtin_popcount{,l,ll}`` builtins, with support for other integer types,
3505+
such as ``__int128`` and C23 ``_BitInt(N)``.
3506+
34763507
Multiprecision Arithmetic Builtins
34773508
----------------------------------
34783509

0 commit comments

Comments
 (0)