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

--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Hongtao Liu from comment #5)
> > My experience is memory cost for the operand with rm or separate r, m is
> > different which impacts RA decision.
> > 
> > https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595573.html
> 
> Change operands[1] alternative 2 from m -> rm, then RA makes perfect
> decision.

Yes, I can confirm this oddity:

        movl    v1(%rip), %edx  # 5     [c=6 l=6]  *zero_extendsidi2/3
        movq    %rdx, v2(%rip)  # 16    [c=4 l=7]  *movdi_internal/5
        movq    %rdx, %rax      # 18    [c=4 l=3]  *movdi_internal/3
        ret             # 21    [c=0 l=1]  simple_return_internal

But even there is room for improvement. The last move can be eliminated by
allocating %eax in the first instruction.

Reply via email to