Specify named registers for ARM inline asm

Jeremy Hall jeremy.m0jnx@gmail.com
Sat May 30 09:15:00 GMT 2015


For ARM, is there a way to directly load a named register in inline asm?
Registers may be named in the clobber list, but not in the input or
output lists.

I would like to do this:

  asm( "stuff" :: "r1" (xxx) );

but instead have to do this:

  asm( "mov r1,%0; stuff" :: "r" (xxx) : "r1" );

Its worse for "+r"

  asm( "stuff" : "+r1" (xxx) );

becomes:

  asm( "mov r1,%0; stuff; mov %0,r1" : "+r" (xxx) : "r1" );



More information about the Gcc-help mailing list