[LLVMdev] On calling intrinsics

Craig Topper craig.topper at gmail.com
Sun Jan 20 13:19:51 PST 2013


sqrtf is detected by code in SelectionDAGBuilder.cpp. This gets turns into
a FSQRT ISD node type that the target can handle just like any other ISD
node. If the target doesn't mark ISD::FSQRT as Legal or Custom then
ExpandNode in LegalizeDAG.cpp turns it back into a sqrtf libcall.

On Sun, Jan 20, 2013 at 11:34 AM, David Given <dg at cowlark.com> wrote:

> On 20/01/13 19:20, Caldarale, Charles R wrote:
> [...]
> > That's because there is no llvm.ceil.* intrinsic defined in
> include/llvm/Intrinsics.td for 3.2
>
> Ah. Yes, that would explain it... does this mean that I can rely on all
> the intrinsics listed existing for the common types (int, float,
> double)? Or should I be trying to follow the libc call route?
>
> I've noticed that llc is successfully turning this:
>
> define float @t(float %f) nounwind uwtable readnone {
>   %1 = tail call float @sqrtf(float %f) nounwind readnone
>   ret float %1
> }
>
> ...into this:
>
> t:
>         sqrtss  %xmm0, %xmm0
>         ret
>
> ...but I haven't figured out what pass does it yet.
>
> --
> ┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
> │ "Of course, on a sufficiently small planet, 40 km/hr is, in fact,
> │ sufficient to punt the elastic spherical cow into low orbit." ---
> │ Brooks Moses on r.a.sf.c
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130120/1de34a10/attachment.html>


More information about the llvm-dev mailing list