[cfe-commits] [PATCH] atomic operation builtins, part 1

Girkar, Milind milind.girkar at intel.com
Mon Feb 27 18:01:47 PST 2012


>I plan to work on C11 Atomic support for the next release, GCC 4.8.
>I expect to provide a compile time flag to disable the atomic padding/alignment should someone decide they don't want it, but the default option would be whatever we decide on as 'good' padding/alignment.
>Andrew


Thanks, Andrew. Besides performance on intel processors, one of my concerns is keeping the intel compiler compatible with gcc.  Hence, we would like what gcc does to be documented in the ABI.

- Milind

-----Original Message-----
From: Andrew MacLeod [mailto:amacleod at redhat.com] 
Sent: Monday, February 27, 2012 7:12 AM
To: Girkar, Milind
Cc: Jeffrey Yasskin; John McCall; cfe-commits at cs.uiuc.edu Commits; Lawrence Crowl
Subject: Re: [cfe-commits] [PATCH] atomic operation builtins, part 1

On 02/24/2012 09:24 PM, Girkar, Milind wrote:
>
> This does make the size/alignment of the atomic type different from the unqualified type - can somebody highlight the disadvantages due to this difference?
The only thing I can think of is maybe casting.  Casting from a smaller 
object to a larger atomic object could become problematic since the 
atomic may access more memory than the unqualified type has allocated.  
   Casting from atomic to unqualified should be OK as long as the 
padding is at the end of the atomic object.   Does C11 have any rules 
about casting to/from an Atomic?

I don't think padding issues apply to arithmetic objects since we only 
support 1,2,4,8 and 16 byte objects.  ie, we dont have to worry about a 
3 byte atomic_fetch_add operating on a 4 byte padded value (which is 
effectively left shifted 8 bits).   Will that always be true?  It's 
probably not an issue...

> Also, is there any effort going on to implement the C _Atomic in gcc?
>

I plan to work on C11 Atomic support for the next release, GCC 4.8.

I expect to provide a compile time flag to disable the atomic 
padding/alignment should someone decide they don't want it, but the 
default option would be whatever we decide on as 'good' padding/alignment.

Andrew





More information about the cfe-commits mailing list