[LLVMdev] question about llvm.powi and reassociation

Kyle Davis kylesspambucket at gmail.com
Sun Jul 26 13:53:40 PDT 2009


Hello, all. To get my feet wet and hopefully make a small contribution, I
was looking for something small to start with. I settled on one of the
suggestions from the CodeGen readme:

> Reassociate should turn things like:
>
> int factorial(int X) {
>  return X*X*X*X*X*X*X*X;
> }
>
> into llvm.powi calls, allowing the code generator to
> produce balanced multiplication trees.

I started getting familiar with the relevant parts of the code and see two
problems with this as things currently stand:

 - llvm.powi, in both the documentation and the code, is a
floating-point-only intrinsic.

 - the reassociate pass avoids doing anything to floating point operands
regardless of the state of the "enable-unsafe-fp-math" flag.

Both of these are adjustable, but as I'm trying to ramp up I figured it
would be good to ask to make sure I'm understanding what I'm seeing
correctly. If I am, I feel like perhaps I've chosen poorly for a starting
project.

 - Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090726/3a00003a/attachment.html>


More information about the llvm-dev mailing list