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

    <tr>
        <th>Summary</th>
        <td>
            LLVM disassembler can not decode POPCNT with REX2 prefix correctly
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:X86,
            mc
      </td>
    </tr>

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

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

<pre>
    bash$ cat 1.s
popcntl %r16d, %r17d

bash$ llvm-mc --show-encoding 1.s
 .text
        popcntl %r16d, %r17d                    # encoding: [0xf3,0xd5,0xd0,0xb8,0xc8]

bash$ cat 1.txt
0xf3,0xd5,0xd0,0xb8,0xc8

bash$ llvm-mc --disassemble 1.txt
        .text
        rep             popcntl %r16d, %r17d

Expect no rep prefix b/c 0xf3 is part of opcode here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMkstu2zwQhZ9mtCEsUCNRlwUXjhNv_vxtEBRFtryMLbayKJB04rx9YcluUiC9cKFDiJgz8x2MitHtRyIJ4gYQ_1Pjo9cUEiCCuM3UMfU-yJ-_M-3tq9Qq9oAVMyqxIo_Ab4GvJz-ZMQ0MUISitoCb5drY5X35XkuH4fmwOhi2WsXev6xoNN66cf9mx_JEp3S5X87vW7APDmDJrr5QrhmIG37alYAbfrJiET6LbmcxLYjbj4ZdONN1nL-6_JHXuqhipIMe6L3pdeoPsANNv4D9W9J3p4lMYqOf66dAO3diGnBr2BmAucgmFRLzO-Yn4y2xngLlmZWl7cpOZSSLpmixbXnTZL3seFe3jbZCNLtWYMNVQYLQVJ2lptZd5iRyrHhdlEVVVGWdG9KcN1Xd8hIFYgEVp4NyQ34OI_dhn7kYjyQ7URWYDUrTEC97qJX5TqOFcv3U1uddxA0gHsxlLYOc89THfYSKDy6m-GaaXBpI3t9__Z-9yzowo0Y2-sQszbQPnx82n76wF5d69nj3hNeIjA-BTBpes2MYZJ_SFKFcA24Bt3uX-qPOjT8Abs8NL7Kagv9GJgFuZ6QIuF2oniX-CAAA__9Uiful">