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

    <tr>
        <th>Summary</th>
        <td>
            [X86] bt regression with bmi
        </td>
    </tr>

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

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

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

<pre>
    looks worse with bmi?
godbolt:  https://godbolt.org/z/aj3so3noj
```
int test (int x)
{
  x &= 0xf;
  return (0x6996 >> x) & 1;
}
```
trunk:
```
test(int): # @test(int)
  and dil, 15
  movzx ecx, dil
  mov edx, 27030
  xor eax, eax
  bt edx, ecx
  setb al
  ret
```
clang 14:
```
test(int): # @test(int)
  mov ecx, edi
  and cl, 15
  mov eax, 27030
  shr eax, cl
  and eax, 1
  ret
```
clang 14 with bmi2:
```
test(int): # @test(int)
  and dil, 15
  mov eax, 27030
  shrx eax, eax, edi
  and eax, 1
  ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1lMty2yAUhp8Gbc7Uw0XXhRZJHT9DtyCwjINFBlCs5OkLsqw4jTvtop1B4vAfOPo_kCSsfGuNtc8eztZ5BWcdDiBOGrEdwluEH3orhTUBsQeAQwgvPkaI7mJbMhvr-jh6jxc_Mm_ZYI-XpajES5uHeggQlA-AaJ3iCdFmmVg9XgKAKWZLxLaApz1iq-xUGN2QVuKpbJoSEHuKba6RVgBZJ6Nqe_fxwY3DczJ_Nxl9XWwlU5EVUQYox5_1xQwfJEhtEP0OpLiKJ_v6PoHqpiSn7IcOSs4qrTDDK6h1oPisp25RRbhOTpUW0asggJubvbjL0Bk-9EDyf8I4277AKKlvybuv4FeQT4D-sAJ25rbAIpK_5VnfSfpfT-93ENPtMX3djj_TZLJlsmENz4IORrWoePxRl6jYptN2qnfKe22HFTMbnWl_-dRiahSbzp7iwJjXa_ftxdmj6iLeTns_Kh-DoiCszg6tFEVVkaYWNRZNIVXDalF2dU7wviZ70mWGC2V8soMoHdQZ5hIxjtYy3VJMKc5pRdK92ZS8KTjNcVeQGism4vaqE9dmk3ykf0Dm2tmSGHsfk0b74D-SPDL2g5rpU30-hoN1rd8HI7ohmx_dztZ_As8hQEk">