Does it really matter which instruction the compiler chooses? Both constructs consume the same amount of memory and execution time.
I understand your concern that potentially more time and memory could be used if the compiler resisted the use of inc and the register was below R16, but unless you've seen evidence of it doing this... Is it an issue or just an idle curiousity?
Gre7g
From: Sparr <address@hidden>
To: address@hidden
Sent: Tuesday, November 11, 2008 4:24:09 PM
Subject: [avr-gcc-list] foo++, subi vs inc?
Why does "foo++;" compile to "subi Rd,lo8(-(1))" instead of "inc Rd"? I am keeping global register variables in registers below 16, which are not valid for subi so they get duplicated to perform the increment. I am preparing to check out the machine description for the avr target, but thought I would ask here before I go that deep.