<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85965>85965</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Aarch64 popcountg codegen worse than RISC-V
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hiraditya
</td>
</tr>
</table>
<pre>
popcountg instruction was added to clang: https://github.com/llvm/llvm-project/commit/21d83324fbdb
https://godbolt.org/z/7fzrar4fE
```c
int test_builtin_popcountg(unsigned i) {
return __builtin_popcountg(i);
}
```
RISCV
```asm
test_builtin_popcountg(unsigned int): # @test_builtin_popcountg(unsigned int)
cpopw a0, a0
ret
```
AArch64
```asm
test_builtin_popcountg(unsigned int): // @test_builtin_popcountg(unsigned int)
fmov s0, w0
cnt v0.8b, v0.8b
uaddlv h0, v0.8b
fmov w0, s0
ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU8Fu3CAQ_ZrxBWWFB7xeH3xwklrqtZVyjcBgm4qFFeC1kq-vbCdN6lZVWhWtGNbzZngPeCJGMzitayhuobjPxJRGH-rRBKFMehKZ9OqpvvhL5yeXBmJcTGHqkvGOzCISoZRWJHnSWeEGYA0ZU7pEYA1gC9gOJo2TPHT-DNhae30NN5fgv-kuAbadP5_NssBcnRhD3kslgd4DbbZ519Er6W06-DAAts-Abdk_BxF4_-l9ERzp9uu2_8YlknRMj3IyNhn3-EMT4Gly6ykoYgArAuXtVkNI0GkKjjz-tmoBA3vBQnm_2_g9my-fv9497PIinrcvH6Dl0rpXQ94NQEaA0w9Xv0jaRnfxl5kICni3zFsu6PQHDU0TuvHI_4eK7Sb_nX1_9tclxpX_THfaXFrjlR5OcgFsi58wk1DKXgkZ6R7w2nteM3HX-9cjylTNVMUqkek6L3NaFZxjlY21KmRR9aVmldal4qf-yKvyVKlC0iMyqTJTI0VOGdK8pCXFQ97TQvC8o6LMc84QONVnYexhcczy4DMT46TrU1Edi8wKqW1cjYvo9EzWJCAuPg716jI5DRE4tSam-NYlmWR13Yj1PsmbuTuv9KAdmX2ImqRROLI83JuHbAq2_mtjr3wiYLvy_R4AAP__hTpQEw">