Hi Ciao, <br>
<br>
Another benefit I can imagine is that using llvm.pow.* will make code more effective than using @pow.<br>
As llvm began to support apfloat, and as the llvm LangRef says "You can use <tt>llvm.pow</tt> on any
floating point or vector of floating point type. Not all targets support all
types however", we may get chance to optimize the lR code by using llvm.pow.* .<br>
<br>
For example, That will avoid code like:<br>
<br>
%tmp1 = fpext %x to double<br>
%tmp2 = fpext %y to double<br>
%tmp3 = call @pow(%tmp1, %tmp2)<br>
%result = fptrunc %tmp3 to SomeSmallFloatingType //<br>
<br>
The above code (the fpext/fptrunc stuff) also might block other optimizations.<br>
And in optimization pass, we may have chance to minimize the fp size.<br>
<br>
<br>
Sheng.<br>
<br>
<br>
<br><br><div><span class="gmail_quote">2007/11/23, Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Sheng,<br><br>> Here is the patch to make llvm-gcc/llvm-g++ emit llvm.pow.* when errno<br>> disabled.<br><br>thanks for doing this. Yet I have to wonder whether there's any point<br>to using the llvm.pow.* intrinsic, or for that intrinsic to exist.
<br>LLVM doesn't seem to do anything with it, so presumably the only<br>reason for it is so that LLVM knows that it is "pure". But nowadays<br>gcc tells LLVM that directly. Look:<br><br>#include <math.h
><br>double f(double x, double y) {<br> return pow(x,y);<br>}<br><br>If you compile it with -fno-math-errno then pow gets declared as<br><br>declare double @pow(double, double) nounwind readonly<br><br>[I'm not sure why it is marked readonly rather than readnone].
<br>[If you don't use -fno-math-errno then it is not declared readonly,<br>which is correct because it can set errno].<br>Since yesterday, alias analysis knows how to deal with readonly<br>and readnone functions. So all the benefit you would get from
<br>the intrinsic is already there!<br><br>So how about removing the llvm.pow.* intrinsic and other ones like it<br>instead?<br><br>Ciao,<br><br>Duncan.<br></blockquote></div><br>