llvm-project/llvm
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
..
autoconf [autoconf] Fix MinGW build 2015-11-28 00:54:12 +00:00
bindings Fix `llvm-config` to adapt to the install environment. 2015-11-09 23:15:38 +00:00
cmake [CMake] Fixing bots 2015-12-03 22:55:36 +00:00
docs Fix incorrect quote. NFC 2015-12-04 21:59:04 +00:00
examples [Orc] Fix Kaleidoscope example for change in r254693. 2015-12-04 02:32:32 +00:00
include [OperandBundles] Allow operand-specific attributes in operand bundles 2015-12-04 20:34:37 +00:00
lib [SimplifyLibCalls] Optimization for pow(x, n) where n is some constant 2015-12-04 22:00:47 +00:00
projects [CMake] Disable adding the test suite as a projects subdirectory 2015-10-28 18:36:56 +00:00
resources
test [SimplifyLibCalls] Optimization for pow(x, n) where n is some constant 2015-12-04 22:00:47 +00:00
tools [llc/opt] Add an option to run all passes twice 2015-12-04 21:56:46 +00:00
unittests [Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager. 2015-12-04 02:15:39 +00:00
utils [TableGen] Remove an assumption about the order of encodings in the MVT::SimpleValueType enum. Instead of assuming the types are sorted by size, scan the typeset arrays to find the smallest/largest type. NFC 2015-12-03 05:57:37 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO 2015-12-03 18:45:39 +00:00
CODE_OWNERS.TXT Friendly takeover of the Hexagon backend 2015-12-03 17:07:12 +00:00
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
Makefile
Makefile.common
Makefile.config.in
Makefile.rules Create Makefile variables for 'share' and 'libexec' 2015-11-09 16:10:00 +00:00
README.txt Test commit after password reset 2015-11-11 19:24:08 +00:00
configure [autoconf] Fix MinGW build 2015-11-28 00:54:12 +00:00
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.