<div dir="ltr"><div><div>Note that there are also some constant optimizations which assume the floating point rounding mode in order to be correct, so that they may misapply if the rounding mode is different. Duncan Sands has suggested that the correct "fix" is to add metadata to each floating point operation describing the rounding mode and then change processing to be aware of this. This seems like a good plan, but it's also a very big feature to implement with appropriate confidence that it's right, so it's not something I'm planning to dive into any time soon.<br>
<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 4:59 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">----- Original Message -----<br>
> From: "reed kotler" <<a href="mailto:rkotler@mips.com">rkotler@mips.com</a>><br>
> To: <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><br>
> Sent: Wednesday, April 17, 2013 8:32:23 PM<br>
> Subject: [LLVMdev] optimization in presence of floating point<br>
><br>
> an interesting problem occurs if you do interval arithmetic.<br>
><br>
> void foo() {<br>
> float XL, XU, Y, Z;<br>
><br>
> ....<br>
> call_change_rounding_mode(lower);<br>
> XL = Y + Z; // lower bound<br>
> call_change_rounding_mode(upper);<br>
> XU = Y + Z;<br>
><br>
> }<br>
><br>
> Two issues here:<br>
> 1) will the compiler mistakenly treat Y+Z as a common subexpression.<br>
> 2) might it move the call_change_rounding_mode after the assignment<br>
> to<br>
> XU since it seens no dependency.<br>
<br>
</div>I have come across these issues myself as well. To be fair, Clang does not support the FENV_ACCESS pragma, and as I recall, the standard allows an implementation-defined default value (which, in our case, cannot be changed). Moreover, LLVM internally does not have an option to enable the correct conservative side-effect model to make all of this really work correctly.<br>

<span class="HOEnZb"><font color="#888888"><br>
 -Hal<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> This is actually to my previous mips16 ir post but is a question of<br>
> more<br>
> wide interest.<br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div>cheers, dave tweed__________________________</div><div>high-performance computing and machine vision expert: <a href="mailto:david.tweed@gmail.com" target="_blank">david.tweed@gmail.com</a></div>
<div>"while having code so boring anyone can maintain it, use Python." -- attempted insult seen on slashdot</div><div> </div>
</div>