<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81376>81376</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
aarch64: could generate movmskps like instruction in more cases (SLP)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pinskia
</td>
</tr>
</table>
<pre>
Take:
```
void f(unsigned int * __restrict a, unsigned int * __restrict b)
{
unsigned int t = 0;
t += (a[0] == b[0])<<0;
t += (a[1] == b[1])<<1;
t += (a[2] == b[2])<<2;
t += (a[3] == b[3])<<3;
*a = t;
}
```
This is not SLP into
```
f:
ldr q0, [x1]
ldr q1, [x0]
adrp x8, .LCPI0_0
cmeq v0.4s, v1.4s, v0.4s
ldr q1, [x8, :lo12:.LCPI0_0]
and v0.16b, v0.16b, v1.16b
addv s0, v0.4s
str s0, [x0]
```
Which is the trick LLVM is able to produce for reduction of compares (see https://github.com/llvm/llvm-project/issues/81375 ). LLVM is able to SLP the above for x86_64 though into:
```
movdqu (%rdi), %xmm0
movdqu (%rsi), %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
movl %eax, (%rdi)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklM-P6jYQx_-ayWVU5IyTQA45wCKkSlRa6T21x5UTG-KSxFnbofS_rxzILr92e3gIMc748x2PZ4YI5_S-U6qAdAXpOhKDr40tet25gxZRaeS_xU9xUMCXwNbAlpCxy3d8PBotcQe0GLoxkETdeQRa4tubVc5bXXkUQC_4HVAC5Zfw89V5gbcCj8DXyIBP2yHGKviAFgLSFYN0HZjgKi_PISp_Af5ypXsQxnfC-FoYfyOkOyFdC-kbIb8T8mshvxICLcV4b__hhPn6aR9-1tqhdtgZjz-2r6FmBp-Su49W4uXTSDvadxb6BOnqNNbgORNPDHtghLR9sKdFYGbbl9ff2Ru7ZapWvQd7ZLPEBewYT4vR8z-HjpGBLxsTE_DlxxkPqXQSL8fEWXkJP63icXWXujwG69gXqTh_TsWxx_vfFfj8-1etqzp0xNcKw5QfcLv984_gEWWj0BvsrZFDpXBnLFolh8pr06HZYWXaXljlwsA4pbD2vnehbbQB2uy1r4dyVpkWaNM0x8n81lvzt6o80EY7NygHtFnEfJ4iUD7Dh-PDmITkRGmO5yROi-wtS9DXZtjX4wh99befytKao3wfQp5AqZU6jHGoD6Wntn3OTrC7heNbuK_aXr3Lj0hfca05tu7Qu-l5gs68EqcHvLlgYW-krlK_vWokCy5znotIFfGczdM8iSmL6mJBFROpkGqnpKoSkZYplzkjJnjFqzSPdEGMEkYxi_OEWDZTguZiviAhS4oXOYeEqVboZhYaNzN2H40tK0K_sqgRpWrc-Eom6tQ_OG4ChTdMZIux2eWwd5CwRjvvPqN47RtVCGGrOkuAL7EyQyNxrzplhVef5Wr0QaHunLeXsdMdtsYqrIQ7D96P7StQHg22KX5t_rL_AgAA__8varQO">