[cfe-dev] [PATCH] Support for builtins __sync_fetch_and_nand and __sync_nand_and_fetch

Chris Lattner clattner at apple.com
Tue Dec 21 17:51:41 PST 2010


On Dec 21, 2010, at 2:30 PM, dalej wrote:

> 
> On Dec 21, 2010, at 2:18 PM, Wesley Peck wrote:
> 
>> As a note, I just now noticed commit 99522 which removed these operations because they are inconsistently implemented in GCC. I believe the problem is GCC before 4.4 implemented:
>> 
>> 	res = ~(*mem) & val
>> 
>> where as GCC 4.4 and after implement:
>> 
>> 	res = ~(*mem & val) 
> 
> Yes.  IIRC I was the one who decided to follow 4.2 in llvm even though it was, IMO, wrong; I wasn't comfortable with that choice, but incompatibility is bad too.  Since this has been disabled for 9 months without anyone complaining it should be safe to go ahead and do it right at this point.   Just MO.

Wesley, is there any reason to add these?  Given the option, I'd rather delay adding these for as long as possible... and when/if we really need to add them, follow the obvious definition that mainline gcc switched to.  The reason to not add them is in the intermediate transition point: not having them forces people that use them to be aware of this.

Another way to handle this is to add a new name for the same operation.

-Chris



More information about the cfe-dev mailing list