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

--- Comment #309 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #308)
> Thanks for confirming it.  In this case, wouldn't it be better to explicitly
> mention the hard reg numbers everywhere, where they are involved?  Otherwise
> the definitions are bara-bara all over the place.  For example:
> 
> (define_insn "block_lump_real"
>   [(set (mem:BLK (match_operand:SI 2 "hard_reg_r4" "=r,r"))

Sure. hard_reg_r[456] sounds better.

> But actually, why are the register constraints "=r,r"?  The insn only takes
> inputs, but those are declared as outputs.  That looks wrong to me.  Perhaps
> that's why the need for the seemingly superflous (use (reg:SI ... )?

If "=" is removed, it doesn't work, unfortunately. It compiles our tiny case to

foo:
        mov.l   r14,@-r15       ! 32    [c=4 l=2]  movsi_ie/8
        mov     r4,r5   ! 23    [c=4 l=2]  movsi_ie/1
        sts.l   pr,@-r15        ! 33    [c=4 l=2]  movsi_ie/10
        mov.w   .L6,r1  ! 34    [c=10 l=2]  *movhi/0
        mov     #31,r6  ! 11    [c=4 l=2]  movsi_ie/2
        mov.l   .L4,r14 ! 29    [c=10 l=2]  movsi_ie/0
        mov     #0,r7   ! 16    [c=4 l=2]  movsi_ie/2
        sub     r1,r15  ! 35    [c=4 l=2]  *subsi3_internal
        mov     r15,r4  ! 30    [c=4 l=2]  movsi_ie/1
        jsr     @r14    ! 12    [c=1 l=2]  block_lump_real_i4/0
        add     #4,r4   ! 31    [c=4 l=2]  *addsi3_compact_lra/0
        mov.l   .L5,r1  ! 27    [c=10 l=2]  movsi_ie/0
        mov     #0,r6   ! 17    [c=4 l=2]  movsi_ie/2
        mov.l   r4,@r15 ! 14    [c=4 l=2]  movsi_ie/8

which uses r4 as if it isn't clobbered.
As mentioned in c#276, I assume that LRA doesn't handle the clobber reg pattern
if that reg is recognized as the input reg, unless it's call_insn.  It would
have been nice if the pattern in c#276 had worked.

Reply via email to