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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
4.7 produces:
        shr     rsi, 63
        mov     rax, rdi
        xor     edi, edi
        add     rax, rsi
        xor     r10d, r10d
        mov     r9, rax
        mov     rdx, r10
        and     r9d, 1
        mov     rax, r9
        sub     rax, rsi
        sbb     rdx, rdi
        ret

4.9:
        mov     rcx, rsi
        sar     rcx, 63
        xor     rdi, rcx
        mov     rdx, rcx
        mov     rax, rdi
        sub     rax, rcx
        and     eax, 1
        xor     rax, rcx
        sub     rax, rcx
        sbb     rdx, rcx
        ret

7.1.0-7.3.0, 8.1.0-8.2.0 decides not to inline it:

        sub     rsp, 8
        .cfi_def_cfa_offset 16
        mov     edx, 2
        xor     ecx, ecx
        call    __modti3
        add     rsp, 8
        .cfi_def_cfa_offset 8
        ret

And then we are back to the 4.9 code gen for 7.4, 8.3 and 9.x

10.x produces:

        mov     r10, rsi
        mov     r8, rdi
        sar     r10, 63
        xor     r8, r10
        mov     rdx, r10
        mov     rax, r8
        sub     rax, r10
        and     eax, 1
        xor     rax, r10
        sub     rax, r10
        sbb     rdx, r10
        ret

GCC 11 and trunk is back to the 4.9 code gen

Reply via email to