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

    <tr>
        <th>Summary</th>
        <td>
            Power-of-two checks use popcnt even if underlying architecture does not support it
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Best illustrated by this Compiler Explorer example: https://gcc.godbolt.org/z/qGzWo39b6 (original repro was using libcxx unordered_map::find). x&(x-1) might be converted to popcnt which works OK if compiled for SSE4, but if not, rather than just doing LEA/TEST it tries to implement it using bit twiddling hacks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxckk9v2zAMxT-NfCES2HQS2wcf2i7eYQM2oAV2HPSHsdXKkifRcdpPP6jdMGAngXoQ9d6PlCnZ0RP14ngvjp8KufIUYj8n660LhQrmtb-nxGCdWxNHyWRAvQJPNsFDmBfrKML5trgQKQLd5Lw4EvUdTMxLEvWdwEHgMGq9H4NRwfE-xFHg8CZw-PX57UeoO3UCgW2IdrReOoi0xACbTLAm60dwVunbDVYfoqFI5ucsl9y4vrtYbwR2e7gJPAlsb7tKYAezHScGRaCDv1LMljnAEhbtGbbJ6gm2EF8SfPsC9gL6I4aBS4jw-Hg-CHwAtXLWfOBcRckTReBJenheE4MJ2dnXc473dH58AsvA0VLKP9nMYCbP-fYjg8r6Zo1xuZqkfkn7wvS16epOFtRXTdW0VV0esZj6Sl6UOlYHU7UnbBU21J2OrdayofIoOypsjyUeylPZllg1Ne6PTakPpilbo4yssBOHkmZp3d6565yBFzallfru0GJXOKnIpfeRI3ra4F0UiHkDYp_f7NQ6JnEonU2c_nVhy47672GjuAuXHW8B9ET6JY-K_hKmK_nMbvWGonvNgWXUk2XSvEYCEyhlsJDWZQkxUyrW6Pr_NsbytKq9DrPAIRv4c-yWGJ5Js8Dh3XYSOHzEuvb4OwAA__-7BPFj">