[llvm-dev] The most efficient way to implement an integer based power function pow in LLVM

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 9 10:19:55 PST 2017

On 1/9/2017 9:43 AM, Wei Ding via llvm-dev wrote:
> Hi,
> I want an efficient way to implement function pow in LLVM instead of 
> invoking pow() math built-in. For algorithm part, I am clear for the 
> logic. But I am not quite sure for which parts of LLVM should I 
> replace built-in pow with another efficient pow implementation. Any 
> comments and feedback are appreciated. Thanks!

The llvm.pow() intrinsic just calls pow() from libm; if you want to 
replace it with a different implementation, you can just write a 
function called pow() and link it into your program.

If you're looking for the part of LLVM which optimizes pow() calls, see 
LibCallSimplifier::optimizePow in lib/Transforms/Utils/SimplifyLibCalls.cpp.


Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

More information about the llvm-dev mailing list