[LLVMdev] On calling intrinsics
dg at cowlark.com
Sun Jan 20 10:30:26 PST 2013
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
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── 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...
Size: 262 bytes
Desc: OpenPGP digital signature
More information about the llvm-dev