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.2Ah. 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130120/e493ae93/attachment.sig>
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>
On 20/01/13 21:19, Craig Topper wrote:> 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.Solved! It turns out that the secret is that SelectionDAGBuilder only converts such libcalls into intrinsics *if they are marked readnone*. Which, of course, I wasn't doing in my JIT. Anyway, ta. I'm producing much better code now. -- ┌─── 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130121/2a3184ef/attachment.sig>