[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't
From: |
Rick Mann |
Subject: |
Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't match constraints |
Date: |
Tue, 8 Feb 2011 14:00:29 -0800 |
On Feb 8, 2011, at 13:50:36, Joerg Wunsch wrote:
> Rick Mann <address@hidden> 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