<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63361>63361</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[sve] clang don't fold tail loop according the command option
</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/EGqqYn13E
```
int eval2_vec (const float rsq_lookup[], int itable[]){
for (int i=0; i<1024; i++) {
union conv tmp;
float rsq = rsq_lookup[i];
tmp.fval = rsq * rsq;
itable[i] = tmp.ival >> 5;
}
return 0;
}
```
* the **kernel body** of clang already choose the sve, but it doesn't choose to fold the tail according the command option **-mllvm --prefer-predicate-over-epilogue=predicate-else-scalar-epilogue**
```
.LBB3_1: // =>This Inner Loop Header: Depth=1
ld1w { z0.s }, p0/z, [x0, x9, lsl #2]
fmul z0.s, z0.s, z0.s
asr z0.s, z0.s, #5
st1w { z0.s }, p0, [x1, x9, lsl #2]
add x9, x9, x10
cmp x8, x9
b.ne .LBB3_1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVF2PqzYQ_TXDyygIbEKWBx6SJWkr3ce-9Gll7CFxr7FZ2-R-_PrKkM1urrZVJcQ4njPD8ZkTixD02RK1sD3AtsvEHC_Ot9dBDUPWO_WjBbbHSCEC3-MlxikA3wM7ATudpczPTvXOxNz5M7DTT2Cn42-vr3_Zkh-h6KDYQ13cnuWnthHpKgx7uZJEYE_S2RBxME5E9OH1xTj3dZ5WNsCeMRXoKHpDb3sN7A5rM0QcnE9dFhTwrgB-SIvnsmDVumaH5WnwYxnibLWzKJ29Yhwn4B9zdzYIvHtkpROFB3Acp3y4CvOGxSSYD6-PqPsRUoMFmur0WncEfsTtxwLYdfe1pzh7i8U9f0_-ou3tneZ1oUQD2P4reUsG0yTXDXQDSiPsGYXxJN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