This is the mail archive of the
mailing list for the GCC project.
Re: Implement C11 _Atomic
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Nov 2013 12:21:10 -0500 (EST)
- Subject: Re: Implement C11 _Atomic
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1311052316480 dot 30260 at digraph dot polyomino dot org dot uk> <alpine dot BSF dot 2 dot 02 dot 1311210545480 dot 43309 at arjuna dot pair dot com> <528E1C0A dot 7020907 at redhat dot com> <alpine dot BSF dot 2 dot 02 dot 1311211010210 dot 53151 at arjuna dot pair dot com> <528E2CB6 dot 7020104 at redhat dot com>
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
Thanks! I'll play with it and get back.