<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63978>63978</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64] Redundant mov instructions compare to gcc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vfdff
</td>
</tr>
</table>
<pre>
* test: https://gcc.godbolt.org/z/WjKzfd88G
```
double foo (double *x, int n)
{
double res = 100.0;
for (int i = 0; i < n; ++i)
res = __builtin_fmin (res, x[i]);
return res;
}
```
* gcc's loop:
```
.L3:
ld1d z31.d, p7/z, [x0, x2, lsl 3]
incd x2
fminnm z0.d, p7/m, z0.d, z31.d
whilelo p7.d, w2, w1
b.any .L3
```
* llvm's loop: **fminnm + mov -> fminnm** -- todo ?
```
.LBB0_2: // =>This Inner Loop Header: Depth=1
ld1d { z1.d }, p1/z, [x0, x8, lsl #3]
add x8, x8, x10
fminnm z1.d, p0/m, z1.d, z0.d
mov z0.d, p1/m, z1.d // fold into fminnm z0.d, p1/m, z1.d, z0.d ?
whilelo p1.d, x8, x9
b.mi .LBB0_2
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2PozgQ_TXFpRRkyiHAgQN0JrurndNqpT22AJvEI2NH2HT35NevzEemM5NByBhXvarye3Y1zqmzkbKEtIb0GDWTv9ixfOtF30etFd9LoAq9dB54hRfvrw54BXQCOp27Lj5b0VrtYzuegU43oNN_3_6-9SLP_wB2BFbBga3v_Cvs1GqJvbUIlK9_QNUH0Asq49EAFSsyq5cJrm6jdAj8iAljMQO-WXs7hlgBrGZ7sM3TFzRhClQD1eoeGPEe6vW1nZT2yrz2gzIhzChdKOUD0lpBegyge6ZR-mk0AXxfg-z4dJ_rSBWeuw4oc6itvQbqnnnHX_ndhOujRSLC98aTWISSrtnC8AtCWn-wuUoKo3Yaeah1wSvTzcAPegwYdmgGxBv7FG8Is21lSfUAer8oLbXFa7a4vM8Z35NHrzZuzHdEDPt4ygZVqPXb8JkIDLIDVVtZQDUO9g13wL-stS4OiLsdorfCIvDTb_ira_ZKIepyNIO4wL_8e1EO_zJGjvjV2iv-KRshx-B2lFd_AX5MnpMOWY23JBYY9A1cJb9yn2_cA_FP9K9PI-ZAq9s6Juw3kmwSs7sk68oszQMmcDSfi03G5DNmdVpZ6K0W4VbZLdNz0JboB7-_yL96rfsofpZ_ULhp8KhPJEouCl40kSyTQ17kB8ZyFl3KrkhyaqmjvmhlX-RJKwqRNrxI9yJJiy5SJTHiLCOWcL7fs7hv2ixrpGBp2x5SErBncmiUjsPJCg0oUs5NsjzwIssj3bRSu7mtERn5jrMRiEKXG8uA2bXT2cGeaeW8-xHFK6_nflhVY3c57CE94j9STEY0xs_0K-P8OHVeWeOws8O1GSV6G656NI26_KlNKn-Z2rizA9BpuQXzZ3cd7TfZeaDTXJsDOs21_x8AAP__MPN88w">