[cfe-dev] atomic intrinsics

David Chisnall csdavec at swan.ac.uk
Wed Oct 6 06:59:16 PDT 2010


On 6 Oct 2010, at 14:40, Howard Hinnant wrote:

> Eric is suggesting to move that branch into the front end.  The compiler intrinsic exists in the front end, and the library calls it.  The front end asks the back end if it is supported and decides what to do.  I.e. to the library and to the back end, fallback is automatic, because the front end is now doing the decision making.


>From a purely pragmatic perspective, it seems very unlikely that you will persuade other compilers to adopt __has_feature() but not these atomic intrinsics.  As far as I know, no other compiler has yet adopted __has_feature(), so being able to test for the presence of individual intrinsics with it seems a bit optimistic. 

If other compilers want to adopt clang-compatible atomic intrinsics, then they will most likely adopt the entire set, or none.  

The other issue is that a particular target might only support some subset of these operations.  In this case, it's probably still cleaner to have the fallback code in the back end, because then optimisations can work more easily, with the high-level knowledge of the operations.

David

-- Sent from my Difference Engine






More information about the cfe-dev mailing list