<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 28, 2019, at 12:02 PM, Billy O'Neal (VC LIBS) <<a href="mailto:bion@microsoft.com" class="">bion@microsoft.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Update: VS2019 Update 2 is likely to do this; who do I need to prod such that I get to use these unconditionally in our <atomic> ?<span id="🙂" title=":slight_smile:" class="">🙂</span></div></div></blockquote><div><br class=""></div><div>You want the same feature in clang-cl, so I suggest talking to Reid, sending a patch to clang, and having him review it ;-)</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span title=":slight_smile:" class="">Billy3</span></div><div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 915.3125px;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Billy O'Neal (VC LIBS)<br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, March 19, 2019 02:01 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>JF Bastien<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>cfe-dev<br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [cfe-dev] FYI, Intel folks might be looking to add the __iso_volatile_Xxx family for MSVC STL <atomic> soon</font><div class=""> </div></div><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">></span><span style="color: rgb(33, 33, 33); font-size: 15px;" class="">MSVC’s volatiles on x86 were traditionally seq_cst when they could.</span><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Normal loads are already seq_cst on x86 with no extra work. We still intend to use _InterlockedCompareExchange64 (on x86) or _InterlockedExchange64 (on amd64) to implement store. To be clear, this is in response to a specific customer bug where they want to put an atomic<8 bytes> into read only memory, and want load() to not break their program with STATUS_ACCESS_VIOLATION. ( <a href="https://developercommunity.visualstudio.com/content/problem/274938/vs2017-1567158p2-stdatomicload-causes-write-access.html" class="">https://developercommunity.visualstudio.com/content/problem/274938/vs2017-1567158p2-stdatomicload-causes-write-access.html</a><span class="Apple-converted-space"> </span>)</div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">><span style="color: rgb(33, 33, 33); font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;" class="">I think you should add type-generic versions as well.</span></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I don't think C1XX or EDG have the ability to do that form of intrinsics right now, so to implement volatile_load/volatile_store we're going to need library tech that calls the __iso_volatile family.</div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">><span style="color: rgb(33, 33, 33); font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;" class="">who doesn’t love C++ library features that require compiler support? Right Billy?</span></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important;" class="">I don't hate things that require compiler support. I hate things that require compiler support of the form nobody has demonstrated to be reasonably implementable. Things that can be implemented in terms of traditional builtins or intrinsics (like volatile_load / volatile_store) are fine.</span><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Billy3</div><div id="x_appendonsend" class=""></div><hr tabindex="-1" style="display: inline-block; width: 915.3125px;" class=""><div id="x_divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span><a href="mailto:jfbastien@apple.com" class="">jfbastien@apple.com</a> <<a href="mailto:jfbastien@apple.com" class="">jfbastien@apple.com</a>> on behalf of JF Bastien <<a href="mailto:jfbastien@apple.com" class="">jfbastien@apple.com</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, March 19, 2019 01:52 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Billy O'Neal (VC LIBS)<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>cfe-dev<br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [cfe-dev] FYI, Intel folks might be looking to add the __iso_volatile_Xxx family for MSVC STL <atomic> soon</font><div class=""> </div></div><div class="" style="word-wrap: break-word; line-break: after-white-space;"><div class="">These? <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Fintrinsics%2Farm-intrinsics%3Fview%3Dvs-2017%23IsoVolatileLoadStore&data=02%7C01%7Cbion%40microsoft.com%7C9e4e63a643884977521e08d6acacc3e2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636886255355080579&sdata=zfDNjIZrzKkc3RvHQSGdUadTzJytsmU5vmBbwyk%2FJW0%3D&reserved=0" originalsrc="https://docs.microsoft.com/en-us/cpp/intrinsics/arm-intrinsics?view=vs-2017#IsoVolatileLoadStore" shash="ZhaLVkNZwZOpIqT4j7SS/VDCBoBLjbcdxs2ZTGfYTpzJmls4KQZ+c6LIkec7AKs+wtYCqbRo8nl9DlvLma1doMrSqVWGsMzXB1lnhbu+DAYE2rEzGhuN3YZbWMUUGosuSXqfrUJGqIF4MSOuQmf76PElSaYhpQcnKfEDi5l/Miw=" class="">https://docs.microsoft.com/en-us/cpp/intrinsics/arm-intrinsics?view=vs-2017#IsoVolatileLoadStore</a></div><div class=""><br class=""><blockquote class="" style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class=""><div class=""><font face="Courier" class="">__int16 __iso_volatile_load16(const volatile __int16 * Location)</font></div></div><div class=""><div class=""><font face="Courier" class="">__int32 __iso_volatile_load32(const volatile __int32 * Location)</font></div></div><div class=""><div class=""><font face="Courier" class="">__int64 __iso_volatile_load64(const volatile __int64 * Location)</font></div></div><div class=""><div class=""><font face="Courier" class="">__int8 __iso_volatile_load8(const volatile __int8 * Location)</font></div></div><div class=""><div class=""><font face="Courier" class=""><br class=""></font></div></div><div class=""><div class=""><font face="Courier" class="">void __iso_volatile_store16(volatile __int16 * Location, __int16 Value)</font></div></div><div class=""><div class=""><font face="Courier" class="">void __iso_volatile_store32(volatile __int32 * Location, __int32 Value)</font></div></div><div class=""><div class=""><font face="Courier" class="">void __iso_volatile_store64(volatile __int64 * Location, __int64 Value)</font></div></div><div class=""><div class=""><font face="Courier" class="">void __iso_volatile_store8(volatile __int8 * Location, __int8 Value)</font></div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">Seems fine, given how MSVC’s volatiles on x86 were traditionally seq_cst when they could. I think the above match the LLVM IR semantics precisely.</div><div class=""><br class=""></div><div class="">I think you should add type-generic versions as well. Then you’ve got a nice builtin for <a href="https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwg21.link%2FP1382&data=02%7C01%7Cbion%40microsoft.com%7C9e4e63a643884977521e08d6acacc3e2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636886255355080579&sdata=H8iAKCg12tAuAqfupoU0MMPFYGrMxDc%2F3QxkPkbdRDE%3D&reserved=0" originalsrc="http://wg21.link/P1382" shash="h4NFTdR6B59jFZ89nMq27orCtUZ5SzS6KgzVPmGFWDyJZX6aRwkSAjk3L1Maisqstlv+K403TV01fHi98K7TWhYOi7Lelq/fjFVbMPpWgNI6PS1NaH6+21ZPzajM9oCfpsLqd5hO9dfo37FXgVLW83RmxqQ0SKDnJaDzOiLvwPQ=" class="">volatile_load<T> / volatile_store<T></a>, and who doesn’t love C++ library features that require compiler support? Right Billy? 😁</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 19, 2019, at 1:32 PM, Billy O'Neal (VC LIBS) via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="x_x_Apple-interchange-newline"><div class=""><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">I think Clang has those already implemented for ARM (since our <atomic> compiles there) but we are looking to use them instead of cmpxchg8b to implement load of atomic<8 bytes> on x86 soon.</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br class=""></div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Billy3</div><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline !important;">cfe-dev mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><a href="mailto:cfe-dev@lists.llvm.org" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">cfe-dev@lists.llvm.org</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-dev&data=02%7C01%7Cbion%40microsoft.com%7C9e4e63a643884977521e08d6acacc3e2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636886255355090573&sdata=amedPfjk4WtXDfRgivT9m3clPmrOQGfrl377SJOs7d8%3D&reserved=0" originalsrc="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" shash="WEWsRXy7N9OKHj8Ih/zHN3NEF/ykValCUr28+kBT3EbfhaKu4/Po1Ga6wa8YxuLvsrVPN5g7dUGgrtHEX5WpEIYmCsi7q0IpMTK8gFlm5YgccgAI3gVFZ0mxvqD3vb+L6KMQLy7FhmWgHG3YdcJoKrm1PYnb2pnW4hae/EAKjTc=" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></blockquote></div></div></div></div></div></div></blockquote></div><br class=""></body></html>