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

--- Comment #20 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Fredrik Hederstierna from comment #19)
> I'm not sure why bug 59535 was closed, same problem might still exist, quote:
> 
> > Zhenqiang Chen 2014-09-03 06:17:44 UTC
> > 
> > Here is a small case to show lra introduces one more register copy (tested 
> > with trunk and 4.9).
> 
> int isascii (int c)
> {
>   return c >= 0 && c < 128;
> }
> With options: -Os -mthumb -mcpu=cortex-m0, I got
> 
> isascii:
>       mov     r3, #0
>       mov     r2, #127
>       mov     r1, r3   //???
>       cmp     r2, r0
>       adc     r1, r1, r3
>       mov     r0, r1
>       bx      lr
> 
> With options: -Os -mthumb -mcpu=cortex-m0 -mno-lra, I got
> 
> isascii:
>       mov     r2, #127
>       mov     r3, #0
>       cmp     r2, r0
>       adc     r3, r3, r3
>       mov     r0, r3
>       bx      lr
> 
> Testing 4.8.5 and 5.2.0 still still produces same bigger code in GCC 5.2.
> So something adds a register copy in this small case.

Thanks for providing a small test case.  I've started to work on the PR.  I
hope to provide a fix for the case today.

Reply via email to