On Feb 8, 2011, at 13:50:36, Joerg Wunsch wrote:

> Rick Mann <[email protected]> wrote:
> 
>>        asm volatile (  "in     %0, %1"         "\n\t"
>>                        "andi   %0, %2"         "\n\t"
>>                        "out    %1, %0"         "\n\t"
> 
> "andi" requires an immediate operand.  So it takes the "r24" that is
> passed by the compiler as an immediate rather than a register.  The
> value of "r24" is not known to the assembler by that time, thus the
> assembler marks the symbol as "global undefined" in the object file.
> The linker then eventually complains because it cannot resolve that
> symbol ...
> 
> My guess is you'd like to use "and" rather than "andi". ;-)

Ah! I guess here's a case where the compiler isn't smart enough. Theoretically, 
because the code is inlined, it should be able to work out the inverse and then 
generate the immediate operand for andi. It's able to do that when the 
parameter value is passed directly (as evidenced by the set() method, which 
does exactly what I want.

Oh well. I'll live with the extra cycle.

Thanks!

-- 
Rick


_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to