<div dir="ltr">Hi Neil,<div><br></div><div>> Please not (1).<br></div><div><br></div><div>Could you please elaborate on your concern a bit more?</div><div><br></div><div>Cheers,</div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 4 Apr 2016 at 15:18 Neil Henning via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Please not (1).<br>
<br>
Cheers,<br>
-Neil.</div><div text="#000000" bgcolor="#FFFFFF"><br>
<br>
<div>On 04/04/16 14:59, James Molloy via
llvm-dev wrote:<br>
</div>
</div><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite">
<div dir="ltr"><span style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">Hi,</span>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">Clang
is currently unable to constant fold calls to math.h functions
such as logl(), expl() etc.</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">The
problem is that APFloat doesn't have these functions, so Clang
is forced to rely on the host math library. Because long
double isn't portable, we only ever query the host math
library for double or float results.</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">I
can see three methods for allowing constant folding for types
that are larger than double, some more expensive than others:</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">
1. Introduce a dependency on libMPFR, as GCC does. The
dependency could be hard or soft, with a fallback to the
current behaviour if it doesn't exist.</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">
2. Write the trancendental functions ourselves in APFloat
(yuck!)</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">
3. If the long double format on the compiler host is the same
as the target, use the host library.</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">(2)
is the hardest. (3) is the easiest, but only works in a subset
of cases and I really don't like the idea of better output
when compiling on one platform compared to another (with
equivalent targets).</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">What
do people think about (1)? Or is this completely out of the
question?</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">Cheers,</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px"><br>
</div>
<div style="color:rgb(33,33,33);font-size:13px;line-height:19.5px">James</div>
</div>
<br>
<fieldset></fieldset>
<br>
</blockquote></div><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>