[RFC] Port libitm to powerpc

Richard Henderson rth@redhat.com
Fri Dec 2 23:00:00 GMT 2011


On 12/02/2011 05:37 AM, Iain Sandoe wrote:
> Richard: things that I did, intentionally, differently (and I'm not sure are correct).
> 
> 1. I saved the CR
> 2. Once the vrs are saved, I update the VRsave mask to reflect that.

Don't update VRsave.  This gives the OS license to clobber those registers on task switch, which means that you'd need to reload all of those registers and restore VRsave after calling _GTM_begin_transaction.

> +	mffs f0
> +	stfd f31,-8(r1)

You didn't actually save FPSCRS, only copied it to f0.

> +#ifdef __ppc64__
> +  double fpscr;			/* ??? should we save this.  */
> +  unsigned int vscrpad;	
> +  unsigned int vscr;		/* VRsave */
> +#else
> +  double fpscr;			/* ??? should we save this.  */
> +  unsigned int vscrpad[2];	
> +  unsigned int vscr;		/* VRsave */
> +#endif

Why the difference?

> +  unsigned int cr;		/* Saved CR.  */
> +#ifdef __ppc64__
> +  unsigned int crpad;
> +#endif

Why not just make it unsigned long and be done with it?  There's nothing saying that you can't use lg/stg for the gp that holds the crs.  Nothing except for your corresponding longjmp cares about the layout.

I personally think the whole thing would be much easier to read without relying on the redzone.  Aside from that, there's actually very little real difference in the two files.  Essentially, you're storing the registers in a different order because the prologue does, just so you can make use of the redzone.  

The aix abi saves r2; darwin 32-bit saves r13.  One extra register in both cases, which could use the same slot.


r~



More information about the Gcc-patches mailing list