This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/39510] [avr] missed optimisation with IO read and register variables



------- Comment #2 from k dot kosciuszkiewicz+gcc at gmail dot com  2009-03-27 17:46 -------
I can't see how register usage and calling convention affect this.

As I said before, this behaviour bit me in a naked interrupt handler, with no
arguments and no return value.

I'm attaching a fixed test case where functions have no arguments and void
return type.

#include <avr/io.h>

register uint8_t test asm("r2");

void fun1(void)
{
    test = TCNT0;
}

void fun2(void)
{
    TCNT0 = test;
}

Compile with -Os. Generated instruction sequence:

00000000 <fun1>:
   0:   82 b7           in      r24, 0x32       ; 50
   2:   28 2e           mov     r2, r24
   4:   08 95           ret

00000006 <fun2>:
   6:   22 be           out     0x32, r2        ; 50
   8:   08 95           ret


-- 

k dot kosciuszkiewicz+gcc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]