Post-increment constraint in inline assembly (SuperH)

Segher Boessenkool
Mon Jan 29 23:51:00 GMT 2018

On Mon, Jan 29, 2018 at 05:57:47PM +0100, Georg-Johann Lay wrote:
> YMMV, I am not even sure if it is correct or even makes complete sense.
> The "m>"(*src) operand doesn't even express that src is changing, and 
> the constraint allows to use post-increment, but does not force it.

src does not change.  If the compiler chooses to use a post-increment
then this asm will increment the register used.  Which is equal to src
on input to this asm, but not on output in that case.

src is a C variable.  The compiler translates C to assembler code that
implements the same stuff.  Inline assembler integrates with C and the
internal GCC representation, not directly with the generated assembler
code.  Extended asm is not like basic asm (which essentially just drops
a block of assembler code in the middle of the compiler's output, no
questions asked).

> And my experience with inline asm is this: if one doesn't express all 
> side effects (which is the case for "m>"(src)), then the asm will bite 
> you sooner or later; even it it appeared to work fine in the past.

Certainly.  But "m>" describes everything as it should.


More information about the Gcc-help mailing list