You can't use the r
(general register) constraint in the clobber list. And an input-only register is assumed to be unmodified by the asm statement. The best solution is to specify the temp as an output register, which gives the compiler the option of discarding the 'result', as well as being able to retire the register.
unsigned long tmp; /* register 'word' type. */
__asm__ ("..." : "=r" (tmp), ... : <inputs> : <clobbered>);
You can now refer to the temp register as %0
, in this example. Provided that the tmp
variable is never used, the compiler can discard the result and continue to (re)use the register.