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

--- Comment #2 from Jeffrey A. Law <law at redhat dot com> ---
So one more tidbit before I have to put this down.

The reason we don't CSE the library calls is because the REG_EQUAL note we rely
upon is removed.

At the start of CSE we call df_analyze which recomputes the REG_DEAD and
REG_UNUSED notes.  As a side effect it *removes* REG_EQUAL notes for any
pseudos that are dead.

If I manually prevent the note from being removed I get:


       mov.w   r4,@-r7
        mov.w   r5,@-r7
        mov.w   r6,@-r7
        mov.w   #13,r1
        jsr     @___mulhi3
        mov.w   #_x,r5
        add.w   r0,r5
        mov.b   #1,r6l
        mov.b   r6l,@r5
        mov.b   r6l,@(1,r5)
        mov.w   @r7+,r6
        mov.w   @r7+,r5
        mov.w   @r7+,r4
        rts

Which is definitely an improvement as the libcall is CSE'd.  Of course we're
not using the multiplier which would likely be even better, even if we have to
expand a cross multiplication.

Reply via email to