On Thu, Jul 09, 2020 at 01:42:56PM -0400, Mathieu Desnoyers wrote: > > 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.
You write to it as well, so an inout register ("+r" or such). And yes, you use a local var for it (like "long tmp;"). And then you can refer to it like anything else in your asm, like "%3" or like "%[a_long_name]"; and the compiler sees it as any other register, exactly. Segher