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

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #0)

> compiles to unoptimized code on x86_64-linux-gnu with -O2:
> 
>         movl    $-1, %edx
>         movl    $-4, %eax
>         subq    $24, %rsp
>         addl    %edx, %eax
>         adcl    %edx, %eax
>         cmpl    $-2, %eax
>         movl    %eax, 12(%rsp)
>         jne     .L5
>         addq    $24, %rsp
>         ret
> .L5:
>         call    abort

Bah, the above is the *OPTIMIZED* case when we change the assignment to:

  unsigned int x = 0xFFFFFFFC;

The *UNOPTIMIZED* code from the original, unmodified test is:

        movl    $-1, %eax
-->     xorl    %edx, %edx
        subq    $24, %rsp
-->     addb    $-1, %dl
-->     movl    %eax, %edx
-->     adcl    %eax, %edx
        adcl    %edx, %eax
        cmpl    $-2, %eax
        movl    %eax, 12(%rsp)
        jne     .L5
        addq    $24, %rsp
        ret
.L5:
        call    abort

Reply via email to