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

    <tr>
        <th>Summary</th>
        <td>
            [X86] Incorrect shuffle comment decoding for `vinsertps`
        </td>
    </tr>

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

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

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

<pre>
    ### Reproducer
```
; input.s
.intel_syntax
vinsertps xmm2,xmm2,dword ptr [r14+rdi*8+0x4C],0x0B0
```
### Current behaviour
```
> llvm-mc -triple x86_64-unknown-unknown input.s

.text
vinsertps $176, 76(%r14,%rdi,8), %xmm2, %xmm2 # xmm2 = xmm2[0,1,2],mem[2]
```

Note that shuffle comment says `mem[2]`. The part describing vinsertps operation in the Intel SDM says the following:
```
IF (SRC = REG) THEN COUNT_S := imm8[7:6] ELSE COUNT_S := 0
```
In input.s the source for the vinsertps is not a register therefore the source index in the comment should be 0 (`mem[0]`).


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0lE1v8zYMxz8NfSEaSPRLnIMPsZNsBbYOaDtgt8K2mFh7bCuQ5Db99oPsNO2edYAgiXqh-PuTdu2cPo3MBaQlpLuonnxnbGEGtqOMGqPeC6B4afjIZ2vU1LIFsQOxhUxc22LGJerxPPmVWxZWevTcv7j30deXZelVj46tPzu8DAMBVddBvRmr8OwtQlpamQCVVmmgbQ5UiktSQboDqsRFlOL7x29RVpO1PHpsuKtftZn-L9g99v3rcDe0eOetPveMlzx7yZK7afwxmrfxY_w305XM88X_TASUyHUGVGHoc6B0BqnCJLBUOdAmbAOlV-yPKYbAl0m8W6RJSwFUSaCKFvaBB0jL2fgWaO4fjGf0Xe3RddPx2DO2ZhiCHK5-dwiZ-OImEyt87hjPtfWo2LVWN3o84SeSObOtvTZBBPQd433IKD7tfl_8haWj6XvzpscTxNtvI7s_IFD-9FjNcI_7X4A2-Pzr_gGrP_58eH55wnAz3qEehhzScg3xNoN0h_vfnvY_n_k--_e3LM0hOTPZNkRmZ_OTRzscjccaLZ-08zzvWz4ay18v6lHx5QP5JmBnpl5hwygCz01KsUgJtFl9zUSkilht4k0dcSHXMck8k7GIuoIbSkitG1nHWZPLtRTMdcr5mo6xXMs40gUJSqQkKUWSp2KVczimWK5VmiiZQyJ4qHW_CgW8MvYUaecmLqRcy0RGfd1w7-Yvmqip2x88Koi3f-UZUMh7ZIu58pvp5CARvXbefbry2vfz7yCcT3d4P7bGWm7_W1GKW6NCvQSdIRM3mSET0WT7ovPBiLdAB6DDSftualatGYAO4bnrcHe25m9uPdBhxnBAhyvJa0H_BAAA__9y-1yU">