Bionic/libm: fast neon pow() for small x,y.

Add a fast neon version of pow() suitable for relatively small
positive x and y (between 0 and 4).  Run the standard
implementation in all other cases.  Gives approximately 60%
performance improvement to AnTuTu FPU scores

Change-Id: I97e0712daeb2740764b26a44be0caaa39c481453
(cherry picked from commit df58b162751ccad4f6a9dee1d4d8cdb5aeef39f9)
(cherry picked from commit 844736c1cd73f0118cdeb2f322c84efba0793f54)
(cherry picked from commit 8b74afbad26480891890586e811b5167f43ec28c)
Bionic/libm: Prefer branches and VFP ABI.

For internal functions set gcc attribute "aapcs-vfp" for ARM
and use -fno-if-conversion to prefer branches over predicated
instructions (improves performance on architectures with good
branch prediction).

Change-Id: I8424e0e82a19d35e7e3b6e3e122dcdecdd5426fd
(cherry picked from commit a8ed843c678e2a4019c0b88a7a11ff8e3bdb4f70)
(cherry picked from commit 7cbe6a43c3152147f581cb1423bd14582619a2af)
(cherry picked from commit 885827b36a52939f2434b19d458fc9c18680e54f)
Bionic/libm: Add precision-correct de-serialize sin/cos.

Modify sin/cos to improve performance while retaining bit-for-bit
accuracy with existing algorithm.

Change-Id: Iaba2dd731cd015732744705dad8bddb713b43067
(cherry picked from commit df55e67573e176042c5d2ae084c758bc2e9e0025)
(cherry picked from commit 6a688d7aa4512731c430673ccd4f0d6e3999d439)
(cherry picked from commit 47bb7bc2962bff835000dca016f6319c20734398)
Bionic/libm: Pow optimizations and bug fixes.

Use VFP calling convention for pow_neon handoff function by default.
Fix register usage collision between two different polynomial
coefficients in pow_neon.  Remove conditional execution in pow_neon
and replace with branching.

Change-Id: I76095f4a006e2fb01a53943b66fd69bfa1fd3033
(cherry picked from commit 5f0ee8c38363ecb99f7ceb487583b5e7152e63ce)
(cherry picked from commit f4a020fad7881195bff087b5803e4a7b528b81f1)
(cherry picked from commit 22157646da56cba346893ea17a1de5e4fd689b53)
Bionic/libm: add assembly versions of sin/cos.

Add assembly versions of sin/cos with integrated remainder pi/2
calculation.  Directly extracted from binary libm.so compiled with
__ieee754_rem_pio2 calls inlined.

Change-Id: Ia093f420e58e794635e3a5f09e8236ae7601f1f6
(cherry picked from commit 19a356a1ed6384a9161739d5833cf5cfd88a8d3b)
(cherry picked from commit 1c9bdcfa6a68cd1a13a1e3b1a51616bddffeefad)
(cherry picked from commit cdaad8ab61325e958926b57a6a726d0cfa6f7511)
libm: sqrt and sqrtf via ARM vsqrt instruction

Optimized sqrt and sqrtf for arm by using hardware
opcode for sqrt rather than generic slow portable
code.

Change-Id: I84694159577aef6418710548085d8149c45e0e3f
(cherry picked from commit 434d98cd36cdd2514a7118e69624e5d205ca849a)
(cherry picked from commit 5fe41e6f146bcadd4904da26351c646cdc90d196)
(cherry picked from commit e314f75340c8e818b17373314ceb54039fcd76ad)
libm: optimistic pow calling.

Call optimized pow optimistically and revert to full range
implementation if we detect an out-of-range input.

Change-Id: I6f3aa734adbf99484b7ff70736ef83a41e5815b8
(cherry picked from commit e7fd29685a75f1d26061ac511e7a29479fd871b5)
(cherry picked from commit 7916899916973ca5695526ae45283e54709df32a)
(cherry picked from commit d39a7f744c78409949482e3cb3c9710e8f281a33)
Bionic/libm: enable optimized math functions on more QCOM targets.

allow more QCOM targets to use optimized math functions.

Change-Id: I76ee1bf951ae1c8397fef3af6e9937ed8cad9b62
(cherry picked from commit a7b5a06b144c96324db2370bd63b83c81d41ddc3)
(cherry picked from commit 8ccd613ff555349e0751659ebe03c182dae9a2eb)
(cherry picked from commit ccd4b1db5b225b0b4913b80b014f1c2f99c6fdff)
Bionic/libm: Remove extra vmov from sin/cos.

Move integer representations of x bits on the integer side rather
than moving them to and from the FP registers.

Change-Id: I1895db385c9616cdae9ab6403f392dfbae292adc
(cherry picked from commit 1d0c5a9fe67141515fa54403d985828590f9c206)
(cherry picked from commit ca46b68c30cf470464ffac530b8bdba242cc5c17)
(cherry picked from commit d7acb8827620ab7331995e843fd79015aed84996)
libm: krait: Fix build warning for e_pow.o

e_pow.o given more than once in the same rule. Remove extra arm/e_pow.S
reference in libm/Android.mk.

(cherry picked from commit a730ffa1195ad85a0e77afc9bf2cb78754b5985c)

Change-Id: I5a4c38e838978e0538697c8a5df1e97f1175e39e
(cherry picked from commit 1002139bee177b90dc011b8ac9f24c4696cf82b6)
(cherry picked from commit 99146f7c6c1ee984608ad705b67f562fb9006cd0)
libc: krait: Re-factor high-performance memcpy for thumb2

The majority of libc under bionic is built for thumb2.  Refactor the
high performance memcpy used in previous builds for thumb2, including
information that can be used for stack-unwinding.

Change-Id: Ib5f7ab354f39313758402ec02b0aea27b15d45fa

Conflicts:
	libc/arch-arm/krait/bionic/memcpy_base.S
(cherry picked from commit cdeb493351044c3116fc0d42a64f33f8215a5886)
(cherry picked from commit 0c524faa937b40178915c9478599b754b6f8f78d)
bionic: Detect userspace memory leak

When process is consuming memory beyond the limit specified by
property, it will print all the allocations of the same process.
To enable this feature, do following steps:
1. libc.debug.malloc 40
2. libc.debug.malloc.program <PROCESS_NAME>
3. libc.debug.malloc.maxprocsize <VALUE_IN_BYTES>
4. libc.malloc.minalloclim <VALUE_IN_BYTES>

Change-Id: I03a4de9643ec954802b26443ce5685975ea30f89
libc: arm: Allow optional optimization of memmove and bcopy

The libc functions memmove and bcopy are not configurable target-by-
target.  This change allows per-target optimization for best perfor-
mance.

Change-Id: Id684672fbf0bcffbe68c36a28b64186a6c2554f3
libc: krait: Implement optimized versions of memmove and bcopy

Restore a jellybean optimization for memmove and bcopy on krait.
Code has been refactored to thumb2 for consistency with the rest of
bionic libc, as well as performance and correctness.

Change-Id: I8f2f77dce4534fbce1bdf0188ab353bf34ab8637
libc: krait: support KINGFISHER optimized memcpy

When defined use the KINGFISHER optimized
cortex-a9 memcpy instead to improve performance.

Change-Id: Idcfb94cc1e10d8326d7a9e623baed91125d7caf6
libc: krait: Fix memmove half-word atomicity

In tailing case of less than 7, if even number of bytes are left, then
use half word load/store to make sure the whole routine is half-word
atomic

Change-Id: I54948ac050ff866986a7e144d4240652981ea87a
libc: Add cortex-a53 bionic code

Add cortex-a53 makefile. Currently it
uses cortex-a15 bionic code.

Change-Id: I1401b54b6c61d17782dff827d69f92b35a4f5c4f
msm8916: Enable QCOM bionic optimizations

Enable QCOM bionic optimizations for 8916.
Define QCOM_NEON_OPTIMIZATION for using QCOM specific
bionic optimizations.

Change-Id: I77cb7380ed2eed42a94cdf8f2ff04e800ff75092
bionic: Fix aliasing violations

This makes bionic compile with compilers enforcing
strict adherence to aliasing rules (e.g. gcc 4.6+
with -Wstrict-aliasing=2 -Werror=strict-aliasing).

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
remove typos and multiple declarations

Change-Id: Iff32874c2f801519b57f19a3cc1c2c76b7c7f6fa
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>