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

    <tr>
        <th>Summary</th>
        <td>
            [LLVM][AMDGPU] PR#137930 introduces correctness inconsistency
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AMDGPU,
            llvm:codegen
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            frederik-h
      </td>
    </tr>

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

<pre>
    PR: https://github.com/llvm/llvm-project/pull/137930 shows a correctness issue which is reported here: https://github.com/iree-org/iree/issues/20737

Supplying: 1. source LLVM IR; 2. assembly files with and without #137930: 
https://gist.github.com/lialan/0cf658c174d02edef6aebc9c4d248c2e

LLVM IR file is small so I did not try to get a minimal reproducer. The diff of before(left)/after(right) assembly is relatively scoped.
<img width="1342" alt="Image" src="https://github.com/user-attachments/assets/ef2ab082-6f10-4429-bafb-c188193fc1d3" />

Seems relevant change is to enable `V_CNDMASK_B32_E32` to be converted to SDWA: https://github.com/llvm/llvm-project/pull/137930/files#diff-dc487be6b0b90778163b61e49a83c61afc0dc647a5582f282e610f3344419180L1111-L1114


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVE2P4zYM_TXKhUggUf48-JDZbIpBZ4rBTLs9DmSJstVVrECSM8i_L-yku9geWhS9WARhkI_vkU-l5IaJqGPlA0O0kQxF93U7MkRWHjZqzmOInXfKq2nTB3PtXl6Z3MOY8zkxuWd4ZHgcXB7nfqfDieHR-8tfz_Ycwx-kM8Pjefae4VHIupUc0hg-EijQIUbSeaKUwKU0E3yMTo_gEkQ6h5jJwEiR_qWli0TbEId7uDxLscTwiLyWNeN7xvdv8_nsr24almpiBynMURM8PX15hsdXJh8Ad6BSolPvr2CdpwQfLo-gJrMGYc7AUN5mWIowvv87qpR3P7KxUsfwyLWtykaLujAcyZCtFPW61YXBotFIN4x3MGv3hYV0Ut5DCvAIxhmYQoYcr5ADDJRBwclN7qT8wlYMZtYUd_DrSGCctRAs9GRDJIaNJ5sZtgyPymaKDJvohnFJfR95Zd2r7C7kr5B0OJPZLbjkJ3ca4MOZPDJ5YIhCFsgQQfl8Szye1EBLJkV9y_yDXHOiuFU5Kz2eaMqLTAuGNSCLqucNbisr-LYosN32yvZbLZpGtNJqYeTSZykrP9-FJTqt0Omipgx6VNOwspcD0KR6T8Aq_uX90y-H5_3bz-8PEt8_S2QVX_7oCXSYLrQuWw7wdvh9__9XnOFx3SCGctFia3TR1D1VPe9bXteNqGRfCSpa1UhdCWU1N7oqalWWDVpskCrBrZRFUYhWNPxJCCG2y7e4Db0xnTStbNWGOlEXVVnVyPlm7CTV1vK2rKikui-stH3JueQka902Tb9xHXIseckrFFIi32lDbS0EYoN9bYuCFZxOyvndMuAuxGGznlMnZFNX1carnny6W0av9FeaDJP7_fPhp5ffFuPATwxx5UjudTA00HT3k9itnPXzkFjBvUs5fW-SXfarEy1HwMoDKx_uNcsDvLx-uzxwU74te_rRQCYdpuRSpklfN3P03X-W8Jtt3Ee9dPhnAAAA__9Dypgp">