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

--- Comment #2 from Shan Huang <apowenq at gmail dot com> ---
> GCC truck at O3:
> src:
>         xor     eax, eax
>         ret
> 
> Clang truck at O3:
> src:
>         movsx   eax, dl
>         movsx   esi, sil
>         mov     ecx, edi
>         cdq
>         idiv    esi
>         sar     edx, cl
>         mov     eax, edx
>         ret

Sorry, I accidentally swapped the outputs for LLVM and GCC in my original post.
Here is the correct mapping:

GCC truck at O3:
src:
        movsx   eax, dl
        movsx   esi, sil
        mov     ecx, edi
        cdq
        idiv    esi
        sar     edx, cl
        mov     eax, edx
        ret

Clang truck at O3:
src:
        xor     eax, eax
        ret

Reply via email to