Re: [PATCH] parisc: Prevent using same register as soure and target in extru/shr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/17/22 14:49, Helge Deller wrote:
> In 2004 Randolph added the shr() assembly macro and noted that the
> source and target register could not be the same.
>
> I did not find any confindence in the docs for this restriction. Maybe
> it's related that on PA2.0 the upper bits may be clobbered?

Looking at the generated kernel code from C-files, I'll find all over usages of
	extru source, x,y,  target
where source and target are the same register.
So, at least for 32-bit this restriction can't be true.

Any ideas why this restriction could have been added to the comments?

Helge


> Anyway, add a compile-time check for it now.
>
> Signed-off-by: Helge Deller <deller@xxxxxx>
>
> diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
> index ea0cb318b13d..ca1a12ae5ee7 100644
> --- a/arch/parisc/include/asm/assembly.h
> +++ b/arch/parisc/include/asm/assembly.h
> @@ -146,6 +146,9 @@
>  	/* Shift Right - note the r and t can NOT be the same! */
>  	.macro shr r, sa, t
>  	extru \r, 31-(\sa), 32-(\sa), \t
> +.ifc \r,\t
> +        .error "Can not used the same register (\r) in shr/extru as source and target register."
> +.endif
>  	.endm
>
>  	/* pa20w version of shift right */





[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux