----- On Jul 9, 2020, at 1:37 PM, Segher Boessenkool seg...@kernel.crashing.org wrote:
> On Thu, Jul 09, 2020 at 09:43:47AM -0400, Mathieu Desnoyers wrote: >> > What protects r17 *after* this asm statement? >> >> As discussed in the other leg of the thread (with the code example), >> r17 is in the clobber list of all asm statements using this macro, and >> is used as a temporary register within each inline asm. > > That works fine then, for a testcase. Using r17 is not a great idea for > performance (it increases the active register footprint, and causes more > registers to be saved in the prologue of the functions, esp. on older > compilers), and it is easier to just let the compiler choose a good > register to use. But maybe you want to see r17 in the generated > testcases, as eyecatcher or something, dunno :-) Just to make sure I understand your recommendation. So rather than hard coding r17 as the temporary registers, we could explicitly declare the temporary register as a C variable, pass it as an input operand to the inline asm, and then refer to it by operand name in the macros using it. This way the compiler would be free to perform its own register allocation. If that is what you have in mind, then yes, I think it makes a lot of sense. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com