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

    <tr>
        <th>Summary</th>
        <td>
            side-effect-free _x variance not optimized to unpredicated instruction
        </td>
    </tr>

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

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

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

<pre>
    Ref gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106327

The Arm C Language Extension for SVE allows _x variance to be optimized to unpredicated instructions.

> The compiler can then pick whichever form of instruction seems to give the best code. This includes using unpredicated instructions, where available and suitable

I'm not sure if there's any side-effect free instructions where this would not be preferred but there are cases where this should almost certainly be done, e.g.

```
svfloat64_t add(svfloat64_t a, svfloat64_t b)
{
    auto und_ok = svcmpge(svptrue_b64(), a, b);
    return svadd_x(und_ok, a, b);
}
```

Both llvm and gcc basically treats this as _m instead of optimizing out the comparison.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE2PmzAQ_TXmMlpETALJgcPuZleq1FNb9RoZPIC7xka2STb76zt2IjWptlIjAp4x897zfNBaeW6-YQ9D10G7DDCGMHtWPjL-Shd588EsuXUDWbT_obQWtPSjPR3IzrtBsfJVSVbuV0VV8poVe1Y8Xu4_RoRHN8EzfBVmWMSA8PIe0HhlDfTWwfefLyC0ticPh3c4CqeE6RCChRbBzkFN6gNltBczO5SqE4FsZXxwSxcIxue3hKx8gUja2WlWGh10wkAY0cCsujc4jaob8Uh-Ip_A9rdI4BEnH7kGdcQYRSJ8ICyJOaEqT293epHoYfHKDP_WxPgzcaFDEEehtGg1rYwEv6gQjVvJXxivJzA20C4FqD4yOySvp5gzeCXxAfseuwC9Q7wjurKEKO5kFy0TEOWOhPXoSB0VNVwQQdC_Ex7voqiQMUzoycazogtCGX2OGNIajCfBfLhPclVcr2T6Y6-tCNX6EEBIyfj2zhMRbh0t47srTv10WQD9xJKKLA_2DaiXKKSb5gET2kznxUNbrcmK0YSYYBNUeQPiMCyOCnkkHYd3evsC-HkAq_efnudyf7JhBK2PUypcmg7hqdSachMciuAv-RPUuVOqCQoZO-ratbE_7CX1qRuptb011zxmsinlrtyJLKigsbmp8UOq8e0wxIr-1yhki9PNX_Orwri0OQkgI57m-niYnf1FbGQq7xekjn3dVJuaZ2MjxbZoi6rfbetVu91s5Gq7W23kupbbgtcVz6ifUfuGbZ4Y5wZPkCBozTb7TDW84LyoVxU9K77Oi3XZ96KsxbYu1pWQbF3gREORRx3xw5K5Jkmir4mnTa188H82hfdqMIiJjvCpT0brmvNyplEWNkvcTdL-G9HCk-o">