[LLVMdev] Pow and PowI Intrinsics

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Mar 10 12:19:44 PDT 2014


In principle, powi could use a series of multiplications to compute the result more efficiently than replacing the pow(x,y) with exp(y * log(x)).
(I implemented this once in a different compiler.)  Whether it's worthwhile for any particular exponent depends on the details of the target, although you could expect that powi(x, 2) would be better done as x * x than as a true exponentiation pretty much everywhere.
For a non-constant exponent one could argue for a runtime switch.
(I don't know whether LLVM itself does any of these things, I'm just going on the principles.)
--paulr

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of William Moses
Sent: Sunday, March 09, 2014 9:52 PM
To: LLVM Developers Mailing List
Subject: [LLVMdev] Pow and PowI Intrinsics

All,

When one is trying to take a floating-point value to an integer power, what is the difference between casting the int to a float and using the pow intrinsic and using the powi intrinsic directly on the values?

Thanks,
Billy Moses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140310/d9a0da9c/attachment.html>


More information about the llvm-dev mailing list