public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/55757] New: Suboptimal interrupt prologue/epilogue for ARMv7-M (Cortex-M3)
@ 2012-12-20 15:04 freddie_chopin at op dot pl
  2012-12-20 15:24 ` [Bug rtl-optimization/55757] " freddie_chopin at op dot pl
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: freddie_chopin at op dot pl @ 2012-12-20 15:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55757

             Bug #: 55757
           Summary: Suboptimal interrupt prologue/epilogue for ARMv7-M
                    (Cortex-M3)
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: freddie_chopin@op.pl


With a Cortex-M3 microcontroller (ARMv7-M) and an empty interrupt handler
function:

void DMA_IRQHandler(void) __attribute((interrupt));
void DMA_IRQHandler(void)
{

}

Results in suboptimal prologue/epilogue:

000023b4 <DMA_IRQHandler>:
void DMA_IRQHandler(void) __attribute((interrupt));
void DMA_IRQHandler(void)
{
    23b4:    4668          mov    r0, sp
    23b6:    f020 0107     bic.w    r1, r0, #7
    23ba:    468d          mov    sp, r1
    23bc:    b501          push    {r0, lr}
}
    23be:    e8bd 4001     ldmia.w    sp!, {r0, lr}
    23c2:    4685          mov    sp, r0
    23c4:    4770          bx    lr
    ...

Without the __attribute__ the function is fine, just a single "bx lr".

This behavior is incorrect not only because r0 and lr are unused, but also
because on ARMv7-M these registers (r0-r3, lr, ip, sp, pc, psr) are saved by
hardware, so there's no point in saving them again.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-28 23:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 15:04 [Bug rtl-optimization/55757] New: Suboptimal interrupt prologue/epilogue for ARMv7-M (Cortex-M3) freddie_chopin at op dot pl
2012-12-20 15:24 ` [Bug rtl-optimization/55757] " freddie_chopin at op dot pl
2012-12-20 16:52 ` rearnsha at gcc dot gnu.org
2012-12-20 17:08 ` freddie_chopin at op dot pl
2012-12-21  3:23 ` joey.ye at arm dot com
2012-12-21  3:32 ` joey.ye at arm dot com
2012-12-21  7:09 ` freddie_chopin at op dot pl
2013-03-02 15:23 ` web at brolinembedded dot se
2023-11-28 23:10 ` yann at poupet dot eu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).