<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/82058>82058</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] implement __builtin_popcountg
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            c23
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nickdesaulniers
      </td>
    </tr>
</table>

<pre>
    GCC recently added this builtin <https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fpopcountg> which makes implementing C23's `stdc_count_ones` (and `stdc_count_zeros`) way way simpler.  In particular, because it's type generic, it makes it easier to support not only the existing standard types pre-C23, but the extended 128b+ types (`__int128`) and C23 addition `BitInt` types.

This was alluded to by @pinskia in https://github.com/llvm/llvm-project/issues/79630#issuecomment-1912561197.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU02T5CYM_TX4omoXlj_aPviw05NO7SmX3LswaGwyNLhAzmzn16egZ7JVe8zBGFtIvKf3pFKyqyeaRf8i-tdKHbyFOHur3w0ldThvKaZqCeYx_365QCRNnt0DlDFkgDebYDmsY-tBtJeNeU-i_SbwKvC6al2v_qhDXAVeg3fWkwk6PUMCr3_wRvH08sxP9cZ3J7C13tCP003K_q0sn_XLfg-7DofnVbS_wcdm9QZ39U4J7H13dCfP1q9wwVbgOYEYZGKjbyXlFjwlMUgQOCpvfgn-QzHkqMAJPtSjPKkUjTXAdw-7imz14VQUeIGFtDoSgeVyET92gpU8Ratz2PIXLAZSyVIEDpCOfQ-RwQeG4N0DeCOgHzYV0ImVNyqaUizBHulUeFxgOfjzKJPPbW9wXAS-fJ4UOIpB3m7Wc1O2mUNmeME262TZBp_pvlj-7jm3oCTWQr4K-e25_pmV_FAJlHNHkTbA8gDRyd369G4VWA-_yGt5O5Zah7vAq3N_f71Oewx_kWaBV5vSQVnv8zS0Mmubf-hwz0qdmqnBfmia6VxXZm7N1E6qork5y7HBtm-7apvbMy5TY86LGuU4nIexGWggbN6m7o3kQpWdUWInsRkQu77t6nM_dV2v1NJqNNq0opN0V9bVGVv2YlVAzCPKfqycWsilYn9E7ZRfBaLAS_7K3cc8FXEuvJZjTaKTziZOP6uxZVfm55ndv_70ItxuX-b9z7jVEd38_xtZUP8bAAD__wuLNmI">