I'm working on a simple embedded language which runs via the JIT. I've reached the point of calling external functions. I'm finding that when the docs say that not all intrinsics are supported on all architectures, they're not kidding. For example, on my vanilla amd64 box running Linux, if I try to use llvm.ceil.f64, I get an unresolved symbol error ("Program used external function 'llvm.ceil.f64' which could not be resolved!"). What's the best way around this? AFAICT, I have two options: - test for the presence of the intrinsic before emitting it, and call out to libc if it's not - always generate a libc function call, and trust to some optimisation pass to convert it to an intrinsic if the target supports it Any suggestions? I'm tending towards the second, as it involves less target-specific knowledge, but I haven't found such an optimisation pass 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/3d49b86a/attachment.sig>
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of David Given > Subject: [LLVMdev] On calling intrinsics> if I try to use llvm.ceil.f64, I get an unresolved symbol errorThat's because there is no llvm.ceil.* intrinsic defined in include/llvm/Intrinsics.td for 3.2; one for floor exists, but not ceil. However, ceil is defined in trunk, so you could download that from svn. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
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>