[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: |
Joerg Wunsch |
Subject: |
Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't match constraints |
Date: |
Tue, 8 Feb 2011 23:08:12 +0100 (MET) |
Rick Mann <address@hidden> wrote:
> Ah! I guess here's a case where the compiler isn't smart enough.
No, the problem sits in front of the computer. ;-)
> Theoretically, because the code is inlined, it should be able to
> work out the inverse and then generate the immediate operand for
> andi.
Then you have to constrain it as an immediate value. If you constrain
it as a register ("r"), the code must use it as a register. The
compiler cannot analyze your inline assembly code itself; this is just
a "black box" to the compiler.
It's even possible to provide two different implementations, based on
whether it's a compile-time constant or not that is being passed down
to the inline function. I think it's something like the operator
__constant_p or such (which you have to apply to your mask), please
have a look into the GCC documentation.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)