In the following example with gcc style builtins, in once case llvm.powi.f64 is emitted
and in the other just a call to library function powf.
~/llvm/build/Debug+Asserts/bin/clang -S -emit-llvm pow1.c
Why is that?
Is there a way to force the call to an llvm style builtin?
Tia.
Reed
pow1.c (269 Bytes)
pow1.ll (2.47 KB)
rnk
February 5, 2015, 12:23am
#2
Should be fixed in to always use the LLVM builtin in r228240.
I'm at tip of tree:
rkotler@ubuntu-rkotler:~/testmips/rt-rk-llvm-tests/tests-c$ ~/llvm/build/Debug+Asserts/bin/clang -S -emit-llvm pow1.c --version
clang version 3.6.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix
commit 629438448670d1ad6d6345a782f6ca70c625e574
Merge: 7b8a410 56756c4
Author: Reed Kotler <rkotler@mips.com >
Sorry. I did not realize you just fixed it today.
Thanks!
Reed
There are a lot of similar builtin issues.
I was just giving a single example.
Ditto for sqrt, sin, cos, exp, .....
I think at least the same issue applies to the following:
sqrt, sin, cos, exp, exp2, log, log10, log2, fabs, floor,
copysign, ceil, trunc, rint, round...
I'm testing my code for all of this in mips fast-isel and realized that I could not force the llvm.zzz... path for builtins without
explicitly writing llvm assembly.
Besides "make check" tests I like to always have executable tests.
In the latest sync from tip of tree this llvm.pow.f32 and f64 works but not any of the other builtins.
shouldn't all these gcc __builtin_xxx be mapping to the corresponding llvm ir function, if available?
otherwise how do you make C code use the desired llvm IR function?