[LLVMdev] llvm-gcc cannot emit @llvm.pow.* ?

Duncan Sands baldrick at free.fr
Thu Nov 22 01:48:25 PST 2007


> Sure. But now the question is the llvm-gcc will not emit llvm.pow.* anytime.

indeed there seems to be no code in llvm-gcc to do so, though there is code for
raising to an integer power (in llvm-convert).  Please feel free to investigate
and add some.  Presumably it should turn gcc's BUILT_IN_POW into llvm.pow.*.
That said, as far as I can see the C front-end doesn't generate BUILT_IN_POW
at all, though the fortran and java front-ends do.  It is true that the gcc
constant folder can fold x*x to pow(x, 2.0) but this has been turned off in
llvm-gcc (PR1631); in any case this is not what you are looking for.  So it
seems to me that the first question to answer is: why doesn't gcc itself use
the gcc pow builtin for C?

> Also, don't forget that the llvm intrinsics
> > don't set errno, so using them is only valid on systems/for languages
> > for which errno is ignored.  That said, llvm.pow.* is for raising
> > to an integer power, and here you raise to a double power.
> I don't understand. why we  can't  use llvm.pow.f64 for double power?

Sorry, I was confusing with powi.



More information about the llvm-dev mailing list