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

    <tr>
        <th>Summary</th>
        <td>
            [AMDGPU] SIFoldOperands can create V_FMA_F32_e64 instruction that violates constant bus restriction
        </td>
    </tr>

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

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

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

<pre>
    Test case: [r.txt](https://github.com/llvm/llvm-project/files/13297858/r.txt)

```
$ llc -march=amdgcn -mcpu=gfx1100 -x mir r.txt -run-pass si-fold-operands -verify-machineinstrs

# After SI Fold Operands
# Machine code for function fma_sgpr_sgpr_use: IsSSA, NoPHIs

bb.0:
  %0:sgpr_32 = IMPLICIT_DEF
  %1:sgpr_32 = S_MOV_B32 1234567
  %3:vgpr_32 = V_FMA_F32_e64 0, %0:sgpr_32, 0, 1234567, 0, %1:sgpr_32, 0, 0, implicit $mode, implicit $exec
  S_ENDPGM 0, implicit %3:vgpr_32

# End machine code for function fma_sgpr_sgpr_use.

*** Bad machine code: VOP* instruction violates constant bus restriction ***
- function: fma_sgpr_sgpr_use
- basic block: %bb.0  (0x194d4d0)
- instruction: %3:vgpr_32 = V_FMA_F32_e64 0, %0:sgpr_32, 0, 1234567, 0, %1:sgpr_32, 0, 0, implicit $mode, implicit $exec
LLVM ERROR: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVEuP4ygQ_jX4UnJkwORx8ME9jmcjdaajzmxfIww4ZgabCHBv-t-v7DwmSR_2cRrJwqqi6qsPqvi493rfKZUh9oRYEfE-NNZlP_hHbbmMKis_su_KBxDcK0RzQOzJTcIxIFYgMm9COHhEc0RKRMq9Dk1fTYRtESmNeb_84oOzP5QIiJS1NsojUmJKFrM5myNSnuDIAiUFSvLzOk3O38kkKRgjIG65Ew2iBW_lXnQQt-LQI1rs6yPGSQLxEVrtYESE2PVdfODeg9dxbY2M7UE53kkP8btyuv6IWy4a3Snd-eD8XX1CIa-DcrBdQWmNhJdz7q_99SkZhJUKauug7jsRtO2gbvnO7w_utPSni1v57TZH5At8s5s_VnfVqmqSDJc4GgCIsMEckykBRAtYrTfPqy-r77tiWd6E4Yew7W798rZ7ogQwoSmbzm5iKaL5-03s265c57uSkp2appAMzO4LD57RfcG62PeFr-5x0e3BaKEDIJK2VqpHnzoqcSG13S2_FZuv60-Zt1wfu7LsJLT__uYn9_nnD574PcrQoLeXzbA1DkN_gnvX1vCgPAjb-cC7AFXvwSkfnD5FXCFPFeIrlQHx8xycgyrutYDKWPFzfFOEDSMwtGmeHPEilalMri8ivqV0Dv_dmvn8_LaG5evry-tAsLR9JwHf90k5Z50_92PzvMy3S_B91eoAHKp-D04drAsQLPxnVdHe96OsAO8k6E6YXioIjQLhuG-g4uJncFxcx-EiL5HMqFzQBY9UhqeLRcpSkqZRk9V4VmGO64rRmiWcUUwpnk6rmrMZ56mMdEYSQjFO5jilM0InlMtaqDmb1mnCKjFHaaJars1k4Dqxbh-NLLMZns5ZZHiljB9Vl5BO_QXjJiJkEGGXjeer-r1HaWK0D_4XStDBjHKdr4uvmz8RK2C7GiTqolAgeAfCKR7Uw1zcjnZoePjn-Y56Z7L_347xrH8HAAD__4zs7SM">