lkml.org 
[lkml]   [2014]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 0/5] arch: atomic rework
    On Fri, Feb 21, 2014 at 10:10:54PM +0000, Joseph S. Myers wrote:
    > On Fri, 21 Feb 2014, Paul E. McKenney wrote:
    >
    > > This needs to be as follows:
    > >
    > > [[carries_dependency]] int getzero(int i [[carries_dependency]])
    > > {
    > > return i - i;
    > > }
    > >
    > > Otherwise dependencies won't get carried through it.
    >
    > C11 doesn't have attributes at all (and no specification regarding calls
    > and dependencies that I can see). And the way I read the C++11
    > specification of carries_dependency is that specifying carries_dependency
    > is purely about increasing optimization of the caller: that if it isn't
    > specified, then the caller doesn't know what dependencies might be
    > carried. "Note: The carries_dependency attribute does not change the
    > meaning of the program, but may result in generation of more efficient
    > code. - end note".

    Good point -- I am so used to them being in gcc that I missed that.

    In which case, it seems to me that straight C11 is within its rights
    to emit a memory barrier just before control passes into a function
    that either it can't see or that it chose to apply dependency-breaking
    optimizations to.

    Thanx, Paul



    \
     
     \ /
      Last update: 2014-02-22 00:21    [W:2.799 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site