<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 11, 2011, at 6:55 PM, Eli Friedman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><blockquote type="cite">  <dt>Relevant standard</dt><br></blockquote><blockquote type="cite">@@ -344,11 +345,17 @@<br></blockquote><blockquote type="cite">      reason about for the programmer than other kinds of operations, and using<br></blockquote><blockquote type="cite">      them is generally a practical performance tradeoff.</dd><br></blockquote><blockquote type="cite">  <dt>Notes for optimizers</dt><br></blockquote><blockquote type="cite">-  <dd>In general, optimizers should treat this like a nothrow call; the<br></blockquote><blockquote type="cite">-      the possible optimizations are usually not interesting.</dd><br></blockquote><blockquote type="cite">+  <dd>In general, optimizers should treat this like a nothrow call.<br></blockquote><blockquote type="cite">+      However, optimizers may improve performance by reordering a<br></blockquote><blockquote type="cite">+      store followed by a load unless both operations are sequentially<br></blockquote><blockquote type="cite">+      consistent.</dd><br></blockquote><br>It's legal, but how is it likely to improve performance?  I can't<br>think of any transformation that would try to do this... maybe GVN?<br></div></span></blockquote><div><br></div>Yes, maybe GVN. This may be more of a codegen issue, and somewhat architecture specific. I think it's safe to say though that for any architecture, if a load can be scheduled above a fence, it should be. But I don't want to make such a specific statement in this doc.</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><blockquote type="cite">  <dt>Notes for code generation</dt><br></blockquote><blockquote type="cite">-  <dd>SequentiallyConsistent operations generally require the strongest<br></blockquote><blockquote type="cite">-      barriers supported by the architecture.</dd><br></blockquote><blockquote type="cite">+  <dd>SequentiallyConsistent loads minimally require the same barriers<br></blockquote><blockquote type="cite">+    as Acquire operations and SequeuentiallyConsistent stores require<br></blockquote><blockquote type="cite">+    Release barriers. Additionally, the code generator must enforce<br></blockquote><blockquote type="cite">+    ordering between SequeuentiallyConsistent stores followed by<br></blockquote><blockquote type="cite">+    SequeuentiallyConsistent loads. On common architectures, this<br></blockquote><blockquote type="cite">+    requires emitting a full fence after SequeuentiallyConsistent stores.</dd><br></blockquote><blockquote type="cite"> </dl><br></blockquote><br>See<span class="Apple-converted-space"> </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html</a><br>?  It's actually kind of nasty: you can implement seq_cst load/store<br>by add a fence for either the load or the store, and people don't<br>appear to be making the choice consistently.<br></div></span></blockquote></div><br><div>Absolutely. Please reword this in your own language.</div><div><br></div><div>Thanks,</div><div>-Andy</div></body></html>