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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #3)
> (In reply to Richard Biener from comment #1)
> > might be also interesting on x86-64 when using bts can use a smaller
> > immediate than the now used orq and thus improve instruction size (but it
> > clobbers flags).
> There is *iordi_1_bts pattern available, but for some reason not exercised
> for the testcase in the description.
I tried this testcase:

long foo1 (long c) { return c >= 0 ? 0x400000000 : -1 ; }

that resulted in:

        testq   %rdi, %rdi
        movq    $-1, %rax
        movabsq $17179869184, %rdx
        cmovns  %rdx, %rax
        ret

when the constant fits in the immediate field of the instruction (e.g.
0x40000000):

        movq    %rdi, %rax
        sarq    $63, %rax
        orq     $1073741824, %rax
        ret

Reply via email to