[PATCH 1/6] powerpc: Add ZERO_GPRS macros for register clears

Rohan McLure rmclure at linux.ibm.com
Fri Jun 10 13:32:58 AEST 2022


> On 2 Jun 2022, at 2:00 am, Segher Boessenkool <segher at kernel.crashing.org> wrote:
> 
> Hi!
> 
> On Wed, Jun 01, 2022 at 03:48:45PM +1000, Rohan McLure wrote:
>> +.macro BINOP_REGS op, rhs, start, end
>> +	.Lreg=\start
>> +	.rept (\end - \start + 1)
>> +	\op .Lreg, \rhs
>> +	.Lreg=.Lreg+1
>> +	.endr
>> +.endm
> 
> This is for unary operations, not binary operations (there is only one
> item on the RHS).  You can in principle put a string "a,b" in the rhs
> parameter, but in practice you need a or b to depend on the loop counter
> as well, so even such trickiness won't do.  Make the naming less
> confusing, maybe?  Or don't have an unused extra level of abstraction in
> the first place :-)
> 
> 
> Segher

Thanks Segher, Christophe for reviewing this.

Yep I see how having a macro to perform rX = rX <> Y for arbitrary infix <> and operand
is unlikely to find much use outside of ZERO_GPRS. As I resubmit this patch series I
will rename it to ZERO_REGS or similar to be more explicitly coupled to ZERO_GPRS.

Something like this I was thinking:

.macro ZERO_REGS start, end
	.Lreg=\start
	.rept (\end - \start + 1)
	li	.Lreg, 0
	.Lreg=.Lreg+1
	.endr
.endm

Thanks,
Rohan


More information about the Linuxppc-dev mailing list