<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 31 August 2017 at 11:09, Kaylor, Andrew via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div bgcolor="white" lang="EN-US">
<div class="gmail-m_1667421056975128580WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">There are still a few things missing from the optimizer to get it completely robust, but I think there is enough in place for front end work to begin.  As I think
 I’ve demonstrated in my recent attempt to contribute a clang patch I’m not skilled enough with the front end to be the person to pull this off without an excessive amount of oversight, but as Erich indicated we do have some good front end people here who have
 this on their TODO list.  It’s just not at the top of the TODO list yet.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">If anyone is interested in the details of the LLVM side of things, there are constrained FP intrinisics (still marked as experimental at this point) documented
 in the language reference.  The initial patch can be seen here:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://reviews.llvm.org/D27028" target="_blank">https://reviews.llvm.org/<wbr>D27028</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I’ve since added another group of intrinsics to handle the libm-equivalent intrinsics, and more recently Wei Ding contributed an fma intrinsic.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">The idea is that the front end will emit the constrained intrinsics in place of equivalent general FP operations or intrinsics in scopes where FENV_ACCESS is
 enabled.  This will prevent the optimizer from making optimizations that assume default fenv settings (which is what we want the optimizer to do in all other cases).  Eventually, we’ll want to go back and teach specific optimizations to understand the intrinsics
 so that where possible optimizations can be performed in a manner consistent with dynamic rounding modes and strict exception handling.</span></p></div></div></blockquote><div><br></div><div><div style="font-size:12.8px">How do you deal with the hoisting-into-<span class="gmail-il">fenv_access</span> problem? Eg:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">double f(double a, double b, double c) {</div><div style="font-size:12.8px">  {</div><div style="font-size:12.8px">#pragma STDC <span class="gmail-il">FENV_ACCESS</span> ON</div><div style="font-size:12.8px">    feenableexcept(FE_OVERFLOW);</div><div style="font-size:12.8px">    double d = a * b;</div><div style="font-size:12.8px">    fedisableexcept(FE_OVERFLOW);</div><div style="font-size:12.8px">  }</div><div style="font-size:12.8px">  return c * d;</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">What stops llvm from hoisting the second fmul up to before the fedisableexcept?</div><div class="gmail-yj6qo gmail-ajU" style="margin:2px 0px 0px;font-size:12.8px"></div></div><div><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt"> </span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="white" lang="EN-US"><div class="gmail-m_1667421056975128580WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">-Andy<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_1667421056975128580__MailEndCompose"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></a></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext"> Hal Finkel [mailto:<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>]
<br>
<b>Sent:</b> Thursday, August 31, 2017 10:45 AM<br>
<b>To:</b> Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>>; Marcus Johnson <<a href="mailto:bumblebritches57@gmail.com" target="_blank">bumblebritches57@gmail.com</a>><br>
<b>Cc:</b> Clang Dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>; Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>><br>
<b>Subject:</b> Re: [cfe-dev] Why is #pragma STDC FENV_ACCESS not supported?<u></u><u></u></span></p>
</div>
</div><div><div class="gmail-h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 08/31/2017 12:10 PM, Richard Smith via cfe-dev wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">Because no-one has implemented it. Patches would be welcome, but will need to start with a design and implementation of the requisite llvm extensions.<u></u><u></u></p>
</div>
</blockquote>
<p class="MsoNormal"><br>
Yes. This is what Andrew Kaylor has been working on (cc'd).<br>
<br>
 -Hal<br>
<br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 31 Aug 2017 10:06, "Marcus Johnson via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:18pt">^^^^^^<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12pt"><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<u></u><u></u></p>
<pre>______________________________<wbr>_________________<u></u><u></u></pre>
<pre>cfe-dev mailing list<u></u><u></u></pre>
<pre><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><u></u><u></u></pre>
<pre><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><u></u><u></u></pre>
</blockquote>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<pre>-- <u></u><u></u></pre>
<pre>Hal Finkel<u></u><u></u></pre>
<pre>Lead, Compiler Technology and Programming Languages<u></u><u></u></pre>
<pre>Leadership Computing Facility<u></u><u></u></pre>
<pre>Argonne National Laboratory<u></u><u></u></pre>
</div></div></div>
</div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>