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

    <tr>
        <th>Summary</th>
        <td>
            [X86] Premature replacement of TRUNCATE with PACKSS/PACKUS patterns are preventing generic combines
        </td>
    </tr>

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

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

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

<pre>
    The combineVectorTruncation / combineVectorSignBitsTruncation combines are converting generic truncate nodes to target specific packss/packus nodes very early, mainly as a way to retain these patterns before type legalization. But this prevents the use of generic combines that use truncate.

combineVectorTruncation / combineVectorSignBitsTruncation need to be removed and we need better lowering of truncate nodes from illegal result/operand types.

This is very obvious with https://reviews.llvm.org/D152928
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk09vqzgUxT-N2Vw1IoYEWLBIm2FTaVQ16Wi2trmAp8ZG9oUo8-mfnNB_b_s2YHH_cM7hhwhB9xaxZrtHxvnr80mPzjLO2e6YiJkG5-v1YSJde63PA4Jyo9QW_0FFzp_9bJUg7Sww3vysnXRvHzWFbz1rPYDwcZFd0JO2PfRo0WsFdG9FsK7FAOSAhO-RIEyodKcVTEK9h8B4Ew9zWBsX9FdA4c2V8ScYhbbmCiKAgIu4xjUeSWgLNGBAmAQRehtAYuc8Al0nBIO9MPr_m84NPM4ENOgAk8cFLYU4CnNAcN2n2k83NAi6FT_0b1h6ZOnhfv2TwCxiG_VLBI-jW7AFYVu44L0iMToB4y7oY46u-z3CzrsRtLm5A49hNsR44yb0cU90Hn6IPUfTek3UyUW7OcBF0wAD0RRYdmC8YbzxuGi8hI0xy7hxvme8OW53vOJl0tZZW2WVSLDe7styn2VZVSVDvS-UzPN0m7Ydl5lEVSBPd8VOFttKtbJNdM1TnqVFuk_LvNqVGyyLlpe5Srs87zBTLE9xFNp8vjXRIcxY77NimyZGSDRhZVkK9Y62Zdnh33K_Eu3rOPcg5z6wPDU60Jf-hDSZ248Q-3dHePE4Cpp9DH4yQuGIlmLA59e3v58O57_uqbwcnp5PJ8abeHg7fbEVCV_h-U74BzPJ7E39M9Je0zDLjXIj403Utd4eJu_-QxW_281upP_m-FcAAAD__yX4Smc">