<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 10, 2015, at 6:29 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 10, 2015 at 5:57 PM, Michael Zolotukhin<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mzolotukhin@apple.com" target="_blank" class="">mzolotukhin@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">mzolotukhin added inline comments.<br class=""><span class=""><br class="">================<br class="">Comment at: docs/LanguageExtensions.rst:1802-1807<br class="">@@ +1801,8 @@<br class=""></span><span class="">+<br class="">+For example, on AArch64 in the following code::<br class="">+<br class="">+  LDR X1, [X2]<br class="">+  LDNP X3, X4, [X1]<br class="">+<br class="">+the ``LDNP`` might be executed before the ``LDR``. In this case the load would<br class="">+be performed from a wrong address (see 6.3.8 in `Programmer's Guide for ARMv8-A<br class=""></span>----------------<br class=""><span class="">rsmith wrote:<br class="">> This seems to make the feature essentially useless, since you cannot guarantee that the address register is set up sufficiently far before the non-temporal load. Should the compiler not be required to insert the necessary barrier itself in this case?<br class=""></span>Yes, we can require targets to only use corresponding NT instructions when it's safe, and then remove this remark from the documentation. For ARM64 that would mean either not to emit LDNP at all, or conservatively emit barriers before each LDNP (which probably removes all performance benefits of using it) - that is, yes, non-temporal loads would be useless on this target.<br class=""></blockquote><div class=""><br class=""></div><div class="">I think this should already be the case -- according to the definition of !nontemporal in the LangRef (<a href="http://llvm.org/docs/LangRef.html#load-instruction" class="">http://llvm.org/docs/LangRef.html#load-instruction</a>), using an LDNP without an accompanying barrier would not be correct on AArch64, as it does not have the right semantics.</div></div></div></div></div></blockquote>I removed the paragraph in updated patch.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">But I think we want to keep the builtin for NT-load, as it's a generic feature, not ARM64 specific. It can be used on other targets - e.g. we can use this in x86 stream builtins, and hopefully simplify their current implementation. I don't know about non-temporal operations on other targets, but if there are others, they can use it too right out of the box.</blockquote><div class=""><br class=""></div><div class="">Yes, I'm not arguing for removing the builtin, just that the AArch64 backend needs to be very careful when mapping it to LDNP, because that will frequently not be correct.</div></div></div></div></div></blockquote>Yes, that's true, and that was the reason why we only implemented STNP for now.</div><div><br class=""></div><div>Michael</div><br class=""></body></html>