llvm-project/llvm/lib/Transforms
Weiming Zhao 8213072a45 [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
2015-12-04 22:00:47 +00:00
..
Hello Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
IPO clang-format FunctionImport after refactoring (NFC) 2015-12-03 02:58:14 +00:00
InstCombine Move EH-specific helper functions to a more appropriate place 2015-12-02 23:06:39 +00:00
Instrumentation [asan] Fix dynamic allocas unpoisoning on PowerPC64. 2015-12-04 09:19:14 +00:00
ObjCARC ObjCARC: Remove implicit ilist iterator conversions, NFC 2015-10-19 23:20:14 +00:00
Scalar [AttributeSet] Overload AttributeSet::addAttribute to reduce compile 2015-12-02 06:58:49 +00:00
Utils [SimplifyLibCalls] Optimization for pow(x, n) where n is some constant 2015-12-04 22:00:47 +00:00
Vectorize Fix a typo in LoopVectorize.cpp. NFC. 2015-12-02 21:33:47 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile