This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/39510] [avr] missed optimisation with IO read and register variables
- From: "k dot kosciuszkiewicz+gcc at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Mar 2009 17:46:19 -0000
- Subject: [Bug rtl-optimization/39510] [avr] missed optimisation with IO read and register variables
- References: <bug-39510-16981@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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