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

    <tr>
        <th>Summary</th>
        <td>
            [LLVM] LLVM fails to optimize shuffles from 256-bit vectors to 128-bit or smaller vectors on LASX
        </td>
    </tr>

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

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

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

<pre>
    Here is a snippet that demonstrates a missed optimization on LASX (emits a store followed by a reload when the only thing possibly needed are shuffle instructions):
https://godbolt.org/z/PWMYY1eMj

Here is more optimized code for the above snippet on LASX:
```
ExtractLowerHalfOfVec256: # @ExtractLowerHalfOfVec256
        ret
ExtractUpperHalfOfVec256: # @ExtractUpperHalfOfVec256
        xvpermi.q $xr0, $xr0, 1
 ret
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEUstu2zoQ_RpqM4hBjUw7Wmjhe1MjCwctUDRtlqQ4shhQokqO7DhfX0hRHmhRVBBAQnN0HpijU3LHnqgS6j-hbjI9chti9RjafvCaOWUm2Et1S5HAJdCQejcMxMCtZrDUhT5x1EzTrHMpkYUwsOvcs2YXegg9HHZff4DAa-oczxQcIkETvA9nsmAuoCGSD9rCuaUeuCUIvb8At64_whBScsZfoCeyZEFHgtSOTeMJ3KQ-1pNSEliKYifkrmUe0nTFvcD9MVgTPK9CPArcPwvcf_l-9_CQ092jkBP8NVs3uVq8k4U62MlknO1oE070ln3J9KImNnJ55e7TE0dd8yGcKd5q33xu7qlGtRHFDgQWINbyrxC5g-WJxO9c34bhX1x_Qt65nk4Dxc6tfoLA9VOUAv__cMsn5IvcxxiZrQpbFqXOqMq3CuVWFds8a6tcmcKUBTbUrDdYN4Xa1M12ragujSqtzFyFEpXcyjJXxSbPV4a0qY2k2qLC6wLFWlKnnV95f-qmnWQupZGqfL3dbsrMa0M-zWVE7OkM81QgTt2M1fTTlRmPSayld4nTOw079nOLD4f7O6FuYDqh0c4n4PC219fmJGhi6ADV5so4hhPVHOKMzPF6_hQipE57T_Ftuuw9G6OvfiuZ43Y0qzp0AveTp-W4GmJ4pJoF7uckSeB-iXqq8FcAAAD__5wSH9E">