https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81602

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Interesting clang does:
```
        movzx   ecx, word ptr [rdi + 2*rax]
        popcnt  ecx, ecx
        lea     rsi, [rsi + 2*rcx]
```


While GCC 14+ does:
```
        xor     eax, eax
        add     rdi, 2
        mov     WORD PTR [rsi], ax
        popcnt  ax, WORD PTR [rdi-2]
        and     eax, 31
```

So clang has a zero extend before the popcount while GCC has it afterwards ...

Reply via email to