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

    <tr>
        <th>Summary</th>
        <td>
            [X86] Failure to commute PCMPGT(C, X) -> NOT(PCMPGT(X,C-1))
        </td>
    </tr>

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

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

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

<pre>
    https://rust.godbolt.org/z/1c7b14rxj

It should be profitable to commute PCMPGT operands if the LHS is constant, permitting folding on the RHS and then flip the result if its feeding a SELECT/BLEND node which can then commute the select operands.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxskk1v2zwMxz8NfSESWPRLrIMPbRI_fbCuK5oeepUlxVYnS4Yk7-3TD3a3Dhh2EQWK_IvkjyJGMzitW6huoTplYkmjD-3Th4uZvMt6r763Y0pzhOIGqAPqwhLTfvCq9zbtfRiAuh9AHZOHnpXh2yvkJ8hv3s7_E8bRL1Zhr3EO_mqS6K3G5FH6aVqSxsfjx8f_ntHPOginIporplHj_d0FTUTpXUzCJaAjzjpMJiXjBrx6q1br3Rb8dHdB4dR6d3i1Zt68QcfFplXQpIhXrbcUgZfz_fn4DNTd3p8fTui80vh1NHJEKdybxu_iVpmorZbpvcB9ptpC8YKLTLes5lVd5znn2dg2TB9KVTeyapRk1LCcdMUaRWXBeclUZlrKqcg5VawuWcH3rChZJQtWkpZEPYcy15Mwdm_tl2mdbWZiXHRbH4rykFnRaxs3UES9kJ-1U1DcvDQ1EK3sQrvm7fpliFDm1sQU_yglk-xGeY2vTtgJY5fwDxRAzXEd9wsQxx0UZ3z4tDrfX1-AjscdA-JAPFuC_WtBBpPGpd9LPwF16_-_zG4O_lXLBNRtbUWgbuvsZwAAAP__JsDKpw">