diff options
author | Weiming Zhao <weimingz@codeaurora.org> | 2015-12-04 22:00:47 +0000 |
---|---|---|
committer | Weiming Zhao <weimingz@codeaurora.org> | 2015-12-04 22:00:47 +0000 |
commit | 8213072a453bcb012b31d231dae4f44a589ddd52 (patch) | |
tree | b304e388662152ead7974a33788200a667bf0077 /lldb/packages/Python/lldbsuite/test | |
parent | b51aafd28e949f97fae9af70ca9e3ea9b683f098 (diff) | |
download | bcm5719-llvm-8213072a453bcb012b31d231dae4f44a589ddd52.tar.gz bcm5719-llvm-8213072a453bcb012b31d231dae4f44a589ddd52.zip |
[SimplifyLibCalls] Optimization for pow(x, n) where n is some constant
Summary:
In order to avoid calling pow function we generate repeated fmul when n is a
positive or negative whole number.
For each exponent we pre-compute Addition Chains in order to minimize the no.
of fmuls.
Refer: http://wwwhomes.uni-bielefeld.de/achim/addition_chain.html
We pre-compute addition chains for exponents upto 32 (which results in a max of
7 fmuls).
For eg:
4 = 2+2
5 = 2+3
6 = 3+3 and so on
Hence,
pow(x, 4.0) ==> y = fmul x, x
x = fmul y, y
ret x
For negative exponents, we simply compute the reciprocal of the final result.
Note: This transformation is only enabled under fast-math.
Patch by Mandeep Singh Grang <mgrang@codeaurora.org>
Reviewers: weimingz, majnemer, escha, davide, scanon, joerg
Subscribers: probinson, escha, llvm-commits
Differential Revision: http://reviews.llvm.org/D13994
llvm-svn: 254776
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
0 files changed, 0 insertions, 0 deletions