[aarch64-port-dev ] RFC: Change stack bang sequence

Andrew Dinn adinn at redhat.com
Tue Jul 4 16:23:47 UTC 2017


On 04/07/17 16:50, Andrew Haley wrote:
> The stack bang size changed to 25 4k pages due to 8172144, Implement
> "JEP 270: Reserved Stack Areas for Critical Sections" and 8173339, Fix
> minimum stack size computations.
> 
> Unfortunately this means that we now generate three instructions for a
> stack bang if we are using 4k pages.
> 
> This patch changes
> 
>   0x0000007fa8f748d4: mov	x9, #0xffffffffffffc000    	// #-16384
>   0x0000007fa8f748d8: movk	x9, #0xfffe, lsl #16
>   0x0000007fa8f748dc: str	xzr, [sp,x9]
> 
> to
> 
>   0x0000007f88bae8d4: sub	x9, sp, #0x14, lsl #12
>   0x0000007f88bae8d8: str	xzr, [x9]
> 
> There's no measurable speed difference on a system I have tested, so
> do we care?  I suppose we do, given that it makes the code slightly
> smaller.  Opinions welcome.

That's a fix worth having. If nothing else it improves readability of
the generated code. Clearly, code size is a more important reason.

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the aarch64-port-dev mailing list