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

    <tr>
        <th>Summary</th>
        <td>
            [LoongArch] Backend Optimizers too aggressive for SIMD, causing worsen codegen
        </td>
    </tr>

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

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

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

<pre>
    I tried to check the assembly output for loongarch for my sha512 algorithms:
GCC sysroots being here:
https://github.com/trcrsired/gcc-releases/releases

```
clang++ -S sha512.cc -I../../include -std=c++26 -o sha512_loongarch64_clang.s --target=loongarch64-linux-gnu -O3 --sysroot=$HOME/toolchains/x86_64-generic-linux-gnu/loongarch64-linux-gnu
```
https://github.com/cppfastio/fast_io/blob/next/benchmark/0012.isa/sha512_loongarch64_clang.s
```
clang++ -S sha512.cc -I../../include -std=c++26 -o sha512_loongarch64_clang.s --target=loongarch64-linux-gnu -O3 --sysroot=$HOME/toolchains/x86_64-generic-linux-gnu/loongarch64-linux-gnu -msimd=none
```
https://github.com/cppfastio/fast_io/blob/next/benchmark/0012.isa/sha512_loongarch64_clang_nosimd.s

The simd optimizer for the long arch backend seems too aggressive, while this issue does not exist for aarch64 or x86_64 with APX.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVE2P4zYM_TXyhbDh0I6dHHyYmdTtAF1Mge2ht0CWGUsdWQpEeT766ws57mxbbPdcYAFDJkWReO-BpGQ2kyPqxP5e7E-ZXKL2oYtBBTaBxmzw43v3CDEYGiF6UJrUM0RNIJlpHuw7-CVelwgXH8B67yYZlF69-R1Yy_0OQdrJBxP1zKK6E-VJlHc_PjwAv3PwPjIMZNwEmgJ9xHWM1_U19gL7yUS9DIXys8D-A10KKJUHsiSZWGD_Ya41trMpt291lZVuEngv8B7yzxvCQinIH4tCYL8exim7jAQ5x1FUJ3V7jw3kfss4f3Bt6vNas2DI8yjDRFFUp7-Fc2vc8pZPboH8qYI833iL6iSw_unp0w-JlPdWaWlcovF2aM5NnU_kKBj1JV9g_9W6XyX6DQXV9XqRHI0X2CfjvFqD9YPA3tFbTB45pWcZngX2ZbnDwrAU2P83--9GbchnNnNC6ryj_4H2Z-cToOIfbf-rJki34K_RzOYPCutQptG13k2wjukg1TO5EZhoZojeg5ymQMzmhQQ-wKs2liBqw2CYF4LRE4PzEejN8G3o5Q0K-AA3JeHVRA13v_xWZGNXjcfqKDPqdi3iDut93Wa6G5vqoNRwoaYsj4dhd6ixVaqUVXs5NM2xyUyHJdZliy1W-33dFq0am_KAeBllfbkMo6hLmqWxhbUvc-HDlK0Au11ZHss2s3Igy-taQ3T0eoMvENOWC11KyodlYlGX1nDkL2WiiXbdhz8nme-C0mJ_gvtNqKe_xPy3WqsUnx8_nZJsSi6cNtqrD0wOlB9pIpctwXbf6IwEYfvl1-B_J5V6YQWe2nRj9tLhnwEAAP__9YnVFg">