<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94572>94572</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64] The option -alu-lsl-fast don't split the x * 3 into a shift for vector
</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/jW43j3bfn
```
void foo (int * __restrict a, int * b, int N) {
for (int i = 0; i < N; ++i)
{
a[4*i + 0] = b[4*i + 0] * 3;
a[4*i + 1] = b[4*i + 1] + 3;
a[4*i + 2] = (b[4*i + 2] * 3 + 3);
a[4*i + 3] = b[4*i + 3] * 3;
}
}
```
* gcc use **shl** to replace the `x * 3`, the kernel body of gcc; while clang don't even with **-Xclang -target-feature -Xclang +alu-lsl-fast**
```
.L4:
ld4 {v28.4s - v31.4s}, [x3], 64
add v0.4s, v24.4s, v30.4s
shl v26.4s, v28.4s, 1
add v27.4s, v25.4s, v29.4s
shl v29.4s, v31.4s, 1
add v26.4s, v26.4s, v28.4s
shl v28.4s, v0.4s, 1
add v29.4s, v29.4s, v31.4s
add v28.4s, v28.4s, v0.4s
st4 {v26.4s - v29.4s}, [x4], 64
cmp x5, x3
bne .L4
and w7, w2, -4
cmp w2, w7
beq .L1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVU2vqzYQ_TXDZkRkhq-wYAE3yqp6q0rt7skYE3zri1PskNv--spAcpOU914U4WE85_jYMx64teo0SFlCWkN6CPjF9WYsp67tuqAx7T8lUIVOWgdxhb1zZwtxBXQEOp6E2J1M2xjtdmY8AR3_BTq-_5HE73HTDcAOwCrI2PqfXyejWuyMQaC9Ghx69u_fR2ndqIRDDvSGN39ze_kGVCDk9UKB2JnxhlcI8QEZxPVsvuE3bwLVQLUCKm4QfMT7H4e0ToAq5YORQXqYmZoNN1UYQ_wTdLSNXtxU_wJNNzTQvtmY8cuvNFT8lCne1hFv7ALyw5qfu_GcqPVJFZ6EwIuVngGosr1eDHQGR3nWXEh0vUTI2Oe6SsZ85rzzLzkOUqMvJDSdp_LpufZKSxSaDydszQCUO5STHPCqXL-uE_65zIeOjyfpwk5ydxkl3vxANdeXUFsddty6BbS5k91viS_Zh1ND1G2Ca1FMtN8lFkOc4miXWH8e9IaQ1p_-3LydJc9g3rbzODEfT284UXKz4tn3FG57vYRTdo_fr1b0A2bK76Hp3So2qVf_vHj0K9ovBS9aNmhvGu_b_CFr8SzxS8r_4h9YX_ifBbiH9GRrehbyr_Qkr-kRH-cZ9Zl692f8zNkMch59OTzrGpZ9XHMPu5J_hq-ci_uav3DKv1fOaLP0graM2yIueCDLKI_yLI2iJAr6UrAkyttWyC6Pm443XbtnotunOXEp46YJVEmMEpaxjKVRwaKdEGnWtXuKslyQYAUkTH5wpXdaTx--_QbK2ossiyTNKdC8kdrOTZ1okFecJ4F8RwnG0mPC5nKykDCtrLNfLE45PX8NqmoUfeYPGX_vJZqzU2bA8PHS3S-vPWvl5gu_tgDftg1ytL3q3NyvJymcGYPLqMuXr4hy_aXZCfMBdPQy1iE8j-ZdCgd0nMVboOOyuamk_wIAAP__EFe3Sg">