Implement C11 _Atomic

Hans-Peter Nilsson hp@bitrange.com
Thu Nov 21 19:24:00 GMT 2013


On Thu, 21 Nov 2013, Andrew MacLeod wrote:
> If we add the hook for atomic_align_for_mode, and change the initalizers in
> tree.c, any target which doesnt need/use the hook should be unaffected. So
> everything remains as it is today.
>
> So Putting the hook in shouldn't be an issue.  Then you can experiment with it
> on your port and see if you get the desired effect...
>
> I've attached what I think the remaining bits are regarding the alignment.

Right, that's about what I expected.  Nice.

Of course, I'd argue that a better default for the atomic
alignment is the max of the default alignment and the natural
alignment, since *you can't have atomic support without extra
machinery for misaligned data* - straddling a page or cache
boundary has dire consequences.

But then the patch would not have the nice property of
"obviously" being a NOP elsewhere.  Then again, where it isn't a
NOP, you have breakage anyway.  Bah.

> All untested since I wrote it of course :-)  In any case,  you should just
> need to provide a function to override the alignment for whatever mode(s)  you
> need with this...
>
> I can bootstrap and check this on x86 to make sure it doesnt affect anything,
> and you can fool with it and see if you can get your desired results with your
> port.

Thanks!  I'll play with it and get back.

brgds, H-P



More information about the Gcc-patches mailing list