Commit graph

312 commits

Author SHA1 Message Date
Elliott Hughes
afe835d540 Move math headers in with the other headers.
Keeping them separate is a pain for the NDK, and doesn't help the platform.

Change-Id: I96b8beef307d4a956e9c0a899ad9315adc502582
2016-04-02 08:36:33 -07:00
Greg Hackmann
e5c872ffb7 genversion-scripts: fix script name in autogenerated comment
Change-Id: I2a304818cfc54d08a08d2e621e4cf74e7ce465dd
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-03-23 16:25:42 -07:00
Dan Willemsen
fc1fb955b3 Android.bp: Add missing <complex.h> functions.
Android.bp port of https://android-review.googlesource.com/207658

Change-Id: I4bedd193a20f7dfb97d0a8bbb67c8472e727be87
2016-03-16 15:46:35 -07:00
Elliott Hughes
9ee6adb003 Add missing <complex.h> functions.
FreeBSD doesn't seem interested in having low-quality implementations of
these functions:

  cacoshl, cacosl, casinhl, casinl, catanhl, catanl, ccoshl, ccosl, cexpl,
  clog, clogf, clogl, cpow, cpowf, cpowl, csinhl, csinl, ctanhl, ctanl.

And they still haven't got round to writing good implementations, so for
now let's just take the NetBSD ones so we have the full set.

Bug: http://b/27555792
Change-Id: I6b72003cf749b1043f006377a01fffe5e1d659bc
2016-03-11 15:03:25 -08:00
Dan Willemsen
603acbf9ca Update Android.bp with x86 rint optimizations
Change-Id: Ie14a40301d6dd601b34b3f2341947daf6294e2cb
2016-03-11 13:01:20 -08:00
jzha136
f3ea093ebb Add x86 optimization of rint functions and tests
Change-Id: I5e7696ff9bcb1efc2625100ef8565b68dca2326c
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
2016-03-07 18:31:26 -08:00
Dimitry Ivanov
9296460bf4 libm: rename LIBC_PRIVATE to LIBC_DEPRECATED
Bug: http://b/26386014
Change-Id: Ia32411ce779f9dcf2cf7910d8658ffa753c73af9
2016-03-04 11:05:52 -08:00
Dan Willemsen
879cec2770 Update Android.bp with recent Android.mk changes
Change-Id: If9777e9ece6de1bc00c3ef86724c7bd4d437aaca
2016-02-29 10:37:56 -08:00
Stephen Hines
64955c84c0 Remove unused libm_clang variable.
Bug: http://b/21899249

As part of the cleanup here, this unset/unused variable was missed.

Change-Id: I0e0f2640e2e975f3e154f68509aa791fd22053a9
2016-02-19 01:17:18 -08:00
Chih-Hung Hsieh
63fedd76ad Enable clang for x86_64 after fp128 fix in clang-2577113.
Upstream LLVM fix was included in prebuilt clang-2577113.

BUG: 21899249
Change-Id: Ief3f3e28650c0bbf8749a5e5d26f45c39e15ed62
2016-02-08 17:07:33 -08:00
Dan Willemsen
a29ed0bbce libm: Use LOCAL_SRC_FILES_EXCLUDE_{arch}
Instead of adding the used common files to each arch that doesn't
override a file, make the architectures list the files they override.

Also updates the Android.bp file to match the Android.mk file.

Change-Id: I7d6a9c2e1c6b6cc9430aa818a89a2ccf52f62c98
2015-12-03 18:09:36 -08:00
Dimitry Ivanov
a2ead18657 libm: stop exporting __muldc3
Bug: http://b/26004493
Change-Id: I991268d5e7b59bca646da25d0ad90a1cb4a9d4b9
2015-12-03 15:25:37 -08:00
Dan Willemsen
9e6f98fe9d Update Android.bp with arch-specific version scripts
Change-Id: I59b34f21b54e8a2084bb318a08c4092064f48083
2015-11-03 14:30:57 -08:00
Dmitriy Ivanov
c176440c90 Fix mips and x86 builds
Change-Id: Idda2494876fd6bf64b3efe6de2e384da9b6a0dbc
2015-10-28 17:51:47 -07:00
Dmitriy Ivanov
e85fb580c8 Fix LDFLAGS for arm and x86
Change-Id: I5366f4499cb4da3a51b8484ab3e4ff785f0888ab
2015-10-28 17:25:34 -07:00
Dmitriy Ivanov
284b468524 Generate per-architecture version scripts.
Bug: http://b/24767418
Change-Id: I23e49d8d30c0def3215ffbd99d09f207d9483624
2015-10-28 16:40:53 -07:00
Christopher Ferris
fa7752986d Fix arm64 fenv warnings, and make warnings errors.
Even though the control registers being read/written in fenv.c only
have 32 bits that are used, the instructions take a 64 bit register.
Make sure the inline assembler in the macros use 64 bit values.

Verified that before the change and after the change, the disassembly
is exactly the same.

In addition, add -Werror to the cflags.

Change-Id: I6603779327488c23e3aab13300edf2e02b101916
2015-10-23 16:41:17 -07:00
Dmitriy Ivanov
280d54680d Fix bug number for linker related workarounds
Bug: 24425865
Change-Id: I2021674a9df0e768f312ca024d906302db1c494f
2015-09-28 10:31:12 -07:00
Dan Willemsen
208ae17e5f Add Android.bp for libc/libm/libdl
Change-Id: I3537363849ba1244348996ff17c5ace1b95dbeee
2015-09-16 16:50:01 -07:00
Elliott Hughes
a992004c9e Merge "Regenerate NOTICE files." 2015-08-29 04:00:21 +00:00
Elliott Hughes
44ead71726 Regenerate NOTICE files.
Change-Id: Ia5c340220bb75e4e3166cc483ea77d19cfb08a71
2015-08-28 20:23:52 -07:00
Elliott Hughes
8cff2f95d8 Sync with upstream FreeBSD libm.
Change-Id: I97e9b23903f1d993d84825806065e85626007d31
2015-08-28 20:21:43 -07:00
Elliott Hughes
f9f4a432ee Revert "Revert "Use compiler builtins for fabs.""
Don't enable the inlines when building libm itself. Otherwise clang gets
upset by seeing both an inline and a non-inline definition.

This reverts commit c5deb0f883.

Change-Id: If7abdb351f5a5549d6a331b33af408e8fcfa9868
2015-08-24 16:05:48 -07:00
Elliott Hughes
c5deb0f883 Revert "Use compiler builtins for fabs."
Use of "extern inline" breaks clang build.

This reverts commit d76f16973a.

Change-Id: I995d0d38c3776f5c50b060f16770741c92a2acac
2015-08-24 21:08:13 +00:00
Elliott Hughes
d76f16973a Use compiler builtins for fabs.
Change-Id: Id3bf761d6dfc187f218b5215c53d76bddc83d50b
2015-08-24 13:32:40 -07:00
Elliott Hughes
6816d8cc69 Merge "Use __builtin_* in <math.h>." 2015-08-14 22:57:10 +00:00
Elliott Hughes
b662280aaf Use __builtin_* in <math.h>.
Also remove cruft meant to support long-obsolete compilers. More
benchmarks.

Bug: http://b/23195789
Change-Id: Ief538e41e77a77e8013b2f4f359584e8df2c47d8
2015-08-14 15:20:57 -07:00
Jake Weinstein
8d959505bc libm: ARM: reorganize a bit to match ARM64
* Cleaner naming, especially if there are more ARM-specific routines in
  the future.

Change-Id: Id29db728800ccd612a906e86ccb95c1e7620514d
2015-08-13 23:02:10 +00:00
Chih-Hung Hsieh
e79d06b0e8 Use gcc to build and test x86_64 long double code.
Clang/llvm x86_64 configuration of long double is still
incompatible with gcc.
https://llvm.org/bugs/show_bug.cgi?id=23897

BUG: 21899249
Change-Id: I47fd6d0ce2daa84ae0035e7885a4d90e4c3056f7
2015-06-23 23:13:39 +00:00
Dmitriy Ivanov
f448ef491c Merge "Add versions to libm.so symbols" 2015-06-17 20:49:44 +00:00
Dan Albert
11ea08c5cb Use new sanitizer option.
Change-Id: I21b04a1f3be3b10ee557bf9e0caa5db638686364
2015-06-16 13:57:54 -07:00
Dmitriy Ivanov
636f5ddddc Add versions to libm.so symbols
Bug: http://b/20139821
Change-Id: Ifdfcac62d59eb8f0985990aa8512046ecb87449e
2015-06-15 18:52:20 -07:00
Elliott Hughes
173ad0a53e Always build libm with clang.
Change-Id: I00df3b83dfa76a7e12f097fb622ceaec3e2bb5a4
2015-06-10 22:55:09 -07:00
Dmitriy Ivanov
41c99cdbb9 Remove LOCAL_CONLY_FLAGS it is no-op.
Change-Id: Ib52b85d176dc9d46d7550f01537b2635e873d6ad
2015-05-26 11:38:59 -07:00
Dmitriy Ivanov
9185e04f72 Apply work around b/19059885 to x86
Bug: http://b/19059885
Bug: http://b/21203348
Change-Id: Ic375e9f877d68de8f866d17362879a7dde638465
(cherry picked from commit 69a5fb951d)
2015-05-15 18:42:14 -07:00
Elliott Hughes
7e54c762fc Update NOTICE files.
(cherry-pick of f0bd92db8966b04062fda0986dacf80891e1a378.)
Change-Id: I4e170118abf452dd87ffe79d343ba1e2b53955de
2015-05-12 10:33:20 -07:00
Dmitriy Ivanov
88e777d6f4 Switch libc/libcstdc++/libm to hash-style=both
Bug: http://b/19059885
Change-Id: Ie42703d91f291fd689a1cf9c35bcab5c487b9a84
2015-05-08 12:06:20 -07:00
Christopher Ferris
6e86146b85 Fix typo in alias symbol.
Change-Id: I41d2c29bd4a9ba382bbe3440541c8e1506fc5809
2015-03-14 12:17:45 -07:00
Christopher Ferris
995b813e91 For libm, use a macro for aliasing symbols.
Change-Id: Ibd42ebc387c2bf3eba9aa96091770915b4b34184
2015-03-13 23:57:15 -07:00
Dmitriy Ivanov
d7e091efc4 Merge "Switch libc and libm to sysv-only hash style" 2015-03-13 21:04:08 +00:00
Dmitriy Ivanov
2e16d2cf1e Switch libc and libm to sysv-only hash style
Bug: 19059885
Change-Id: I60a23dc5f9c756994d566818332ca42b305b4a05
2015-03-13 19:48:03 +00:00
Christopher Ferris
f074b531d2 Merge "Add the optimized implementation of 18 math functions for x86 and x86_64 respectively" 2015-03-13 17:18:21 +00:00
Goran Jakovljevic
1156508265 Generate gnu hash for arm only
Fixes build failure caused by:
https://android-review.googlesource.com/#/c/139660

As previously discussed [1], MIPS does not support GNU-style ELF hashes.

[1] https://android-review.googlesource.com/#/c/49282/2/tests/Android.mk

Change-Id: I9a7966eebfd1ef0a587a20b71faefde38e84ab62
2015-03-10 10:01:50 -07:00
Dmitriy Ivanov
4a55c46d30 Generate sysv hash for libc, libstdc++ and libm
Bug: 19059885
Change-Id: I35e2a9cd0bb3914d9d0c82d163bfaf0fff844667
2015-03-09 19:38:56 -07:00
Jingwei Zhang
5d4f0e6a26 Add the optimized implementation of 18 math functions for x86 and x86_64 respectively
Change-Id: I31bf601448a9427f825517f3a0ff24de47f49bfa
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2015-03-09 13:19:08 -07:00
James Rose
45789b63db libm: Add hardware sqrt, ceil, floor and trunc for x86 & x86_64
Add hardware implementations for sqrt, ceil, floor and trunc for
x86 and x86_64. These routines, and in particular sqrt are much
faster than the BSD C language versions of these functions.

Fixed whitespace errors.

Revised x86 versions with respect to alignment.
Rebased for Android 5.0

Change-Id: I86bdb520ce5e589b0cf63778f353fbd3263c8f0e
Author: James Rose <james.rose@intel.com>
Signed-off-by: James Rose <james.rose@intel.com>
2015-03-06 16:48:30 -08:00
Shu Zhang
c78fa26d47 libm: arm: add arm specific sqrt and sqrtf
Add arm specific optimized sqrt and sqrtf.

Change-Id: I8ea417fc98a800c8cf4f47a0c6668c51d927b1dc
2015-03-04 14:07:35 -08:00
Amaury Le Leyzour
32936c895d Add aarch64 instructions wherever possible
fma, sqrt and various rounding functions have aarch64 instruction equivalent

Change-Id: I1284f31b9f78f914281e5563b8d44db8362b627d
2015-03-04 12:18:52 -08:00
Shu Zhang
3a629af0ad libm: arm: Add arm specific floor() optimization
Add arm specific floor() implementation which avoids VMSR and VMRS
instructions.

Change-Id: Ibd4cd7147aa2f98c9b5bbaf74948843ea619dba4
2015-02-12 18:27:58 -08:00
Duane Sand
3d535d2312 [MIPS] Fix Mips64 build of libm
Change-Id: Ib742b408d4f21d5ec8d455a3fea7c08165c7f321
2015-02-11 12:51:42 -08:00
Christopher Ferris
d40d1a08cd Cleanup the libm makefile.
Change-Id: I3d95f75da24ee3b064a9cce67586b0e6f32272d8
2015-02-09 14:09:49 -08:00
Elliott Hughes
998f2d5a50 Remove more BSD cruft from the public headers.
Change-Id: I1e3097f745b526db448bf72fbc05fb2ba23929a0
2014-12-19 19:30:11 -08:00
Elliott Hughes
6b2b5856d9 Update bionic NOTICE files.
Change-Id: Ic280872ef3137febd9d4a87d5c7662e264692071
2014-12-18 16:27:30 -08:00
Dan Albert
da194780b1 Disable ASAN for more of our libraries.
Since ASAN depends on these libraries, we need to exclude them from
being instrumented.

Change-Id: I62005b6d04ee7b2283c4bd54ace5304386c67358
2014-12-18 08:03:49 -08:00
Elliott Hughes
1b66f6e9d7 Move a private x86-64 header file out of the limelight.
Currently this is on everyone's include path and is getting exported
via the NDK.

Change-Id: Ia417839fb65c7e0afddcd9fae3438665dae8e752
2014-11-26 19:31:19 -08:00
Elliott Hughes
b8ee16f1dc Fix our <complex.h> support.
We build libm with -fvisibility=hidden, so we weren't exporting any
of the <complex.h> functions.

We also weren't building many of the functions anyway.

We were also missing the complex inverse trigonometric functions.

And because we didn't even have perfunctory "call each function once"
tests, we didn't notice that we weren't exporting any symbols, so this
patch adds at least that level of testing.

Change-Id: Ibcf2843f507126c51d134cc5fc8d67747e033a0d
2014-11-06 11:16:55 -08:00
Dan Albert
e91d9cd4ad Don't use an STL for libm.
The default is none right now, but this will be needed when the
default becomes libc++.

Change-Id: Ib022adac2b9dc08fbfae830908128043cfffb91e
2014-10-16 07:44:47 -07:00
Elliott Hughes
14538ca75e Catch up on upstream's round/roundf/roundl.
Not sure how we missed these, but better late than never...

Change-Id: Ib08d1bb6e340a1907cbeb1cbe220e33f70642bdc
2014-10-10 10:21:43 -07:00
Elliott Hughes
488268b134 Sync libm with upstream.
Change-Id: I3b4e2c9c6ce6c5934f270a51ce5eb9154c5805d5
2014-10-09 16:20:37 -07:00
Dan Albert
12e3f22c7c Add coverage flag for libm.
Change-Id: I195d38c5e1f50d1cc6d4353dc8857f11b803b7a3
2014-09-30 16:56:43 -07:00
Elliott Hughes
755318548d Fix lgamma_r/lgammaf_r/lgammal_r for -0.
Upstream has implemented lgammal/lgammal_r for ld128, and fixed the
sign problem we reported with all the lgamma*_r functions and -0.

Bug: 17471883
Change-Id: Ibb175d9cab67efae75f1010796fd44c9ba6ce4fc
2014-09-18 11:23:58 -07:00
Elliott Hughes
c729d4f237 Get new coshl, sinhl, and tanhl implementations from upstream.
Change-Id: I92f9cd53d12efb2e0f4f8a9590b9fe42398233f6
2014-09-12 16:09:40 -07:00
Elliott Hughes
460ad7454a Sync libm with upstream.
Change-Id: I8ac8ee52122ee19a2e423c3211092023cb4896eb
2014-09-12 14:00:02 -07:00
Chih-Hung Hsieh
356a6249d8 Disable Clang, due to x86 LDBL_MANT_DIG errors.
Clang -m32 has incorrect sizeof(long double) = 12.
With -m64, LDBL_MANT_DIG is incorrect 64.

BUG: 17163651
Change-Id: I4b157aa1a8572c3a10aece6070e119a292ab8e83
2014-09-04 12:35:19 -07:00
Elliott Hughes
e0c56efddf Use __GNUC_PREREQ rather than __GNUC_PREREQ__ to match glibc.
Bug: 16874785
Change-Id: I8512f8be3fd149d8720c5c3b4657bedd5ce2b1d1
2014-08-29 15:54:11 -07:00
Elliott Hughes
f4c948a9e9 Move the meat of <features.h> into <sys/cdefs.h>.
This way it's a lot harder for us to screw up (since we should always
be including <sys/cdefs.h> anyway).

Bug: 14659579
Change-Id: I23070fff3296b0d1c683bb5e3a6e214146327d53
2014-08-19 11:18:20 -07:00
Elliott Hughes
5f5cc45cf0 Fix <features.h> (_BSD_SOURCE and _GNU_SOURCE).
<features.h> is supposed to take user-settable stuff like _GNU_SOURCE
and _BSD_SOURCE and turn them into __USE_GNU and __USE_BSD for use in
the C library headers. Instead, bionic used to unconditionally define
_BSD_SOURCE and _GNU_SOURCE, and then test _GNU_SOURCE in the header
files (which makes no sense whatsoever).

Bug: 14659579
Change-Id: Ice4cf21a364ea2e559071dc8329e995277d5b987
2014-08-18 16:04:03 -07:00
Elliott Hughes
1e83245bae Revert "Switch libm to building with clang."
This reverts commit aadc4b2ff0.

The patch broke x86.

Change-Id: I0cda903732a685838bbd1877f94e1593a2a32acc
2014-07-11 01:24:15 +00:00
Elliott Hughes
aadc4b2ff0 Switch libm to building with clang.
Bug: 16211965
Change-Id: I81ec9706a4f2b5e8a840508a0f711cd25a5826ca
2014-07-10 16:58:07 -07:00
Dan Albert
71f9b34fbe Revert "Revert "Prevent symbols from libgcc from being reexported.""
This reverts commit 4e4e1a5d78.

Change-Id: I8e78c3a59598e052e02965dd37b3fba8f567eed9
2014-06-24 04:31:08 +00:00
Dan Albert
4e4e1a5d78 Revert "Prevent symbols from libgcc from being reexported."
This reverts commit 65e80cf622.

Change-Id: I5f94b123f73db8d0b03cd71a5cffa0662776a017
2014-06-23 20:12:05 +00:00
Dan Albert
65e80cf622 Prevent symbols from libgcc from being reexported.
Since this was not done earlier, there are binary compatibility concerns
that prevent us from being able to apply this to LP32.

Bug: 11156955
Change-Id: Ie717c3ae4b81c749548a45a993c834e109700b27
2014-06-21 00:09:31 -07:00
Elliott Hughes
b6ca747402 Merge "Add a flag control that PRIVATE libm can be chosen" 2014-06-17 20:56:23 +00:00
Elliott Hughes
4779a11a3d Merge "Move mips fenv implementation details into fenv.c." 2014-06-09 22:27:30 +00:00
Elliott Hughes
89d61243f2 Move mips fenv implementation details into fenv.c.
Change-Id: I2415e4808e40c2981d016c01969ba14ea22bf82e
2014-06-09 15:25:15 -07:00
Elliott Hughes
43bf81e544 Move x86 fenv implementation details into fenv.c.
Change-Id: I6cb8c730483c325dc3cb75c2b2fbdd2d8455a54c
2014-06-09 15:20:59 -07:00
Elliott Hughes
9812a0233c Clean up the ARM fenv.h, moving implementation details into fenv.c.
Change-Id: I919d35db27ec16a6f54a7a5c3c070f33f03d9bb9
2014-06-09 13:57:57 -07:00
Serban Constantinescu
a147a1da5c AArch64: libm: Fix ARM64 fenv_t and refactor ARM64 libm implementation.
This patch fixes the ARM64 ABI for libm. fenv_t is now split in 32bit status
and 32bit control. This mirrors the AArch64 FPU control and status
registers (FPCR, FPSR).

The patch also refactors the libm implementation for ARM64 into a finer
grained control over the FPU registers.

Bionic-benchmarks has been expanded with 3 more benchmarks for floating
point operations. The new libm implementation for ARM64 performs better
over all the math benchmarks available.

Change-Id: I2a7f81d6b4e55c91f8a63a4c69614fc8b1bcf2db
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-06-09 13:52:28 -07:00
Ben Cheng
ff00dc8565 Workaround the GCC "(long)fn -> lfn" optimization bug.
Pass "-fno-builtin-rint -fno-builtin-rintl -fno-builtin-rintf" to avoid
generating self recursions in lrint, lrintl, and lrintf.

BUG: 14225968
Change-Id: Iffc4d8f0692580d636a529f4c8aa9a7a10d7acd8
2014-05-29 16:32:00 -07:00
Elliott Hughes
de9ac71053 Use -fvisibility=hidden to build libm.
Bug: 11156955
Change-Id: I77b7772a44313a1eb3970f5d2c8e2af63690efa4
2014-05-19 16:58:52 -07:00
Elliott Hughes
b4f2f28054 Declare sincos/sincosf/sincosl in <math.h>.
Change-Id: If7b98f98c7ab4d3d77d310be082bff64512d51a8
2014-05-08 21:19:12 -07:00
Elliott Hughes
9a5a3e8e74 Fix <math.h> to quieten most of our warnings.
I've reported the wcsftime bug upstream, but we really just want to use -D
to ensure the buggy code isn't built. (I've also brought our strftime a bit
closer to upstream now we have the right define.)

I don't think upstream is likely to fix all their sign-compare and
uninitialized warnings, so let's just silence them.

As for libm, again upstream isn't likely to fix all their warnings, and
silencing those made the ones that were our fault stand out. I've fixed
our <math.h> to fix the warnings caused by our lack of definitions for
the non-imprecise long-double functions. I checked the C99 standard, and
all these functions are there.

Change-Id: Iee8e1182c1db375058fb2c451eceb212bab47a37
2014-05-05 21:19:47 -07:00
Elliott Hughes
bfa582d032 Update the NOTICE files and improve the script slightly.
Change-Id: Ia131634cd97ca9523e1b63dce41f66247cbaa311
2014-05-05 16:23:15 -07:00
Calin Juravle
1abc9ff6a5 Clean-up _fpmath and fake_long_doubles
- promoted IEEEld2bits to fpmath since most of the where the same for
diffrent archs
- removed _fpmath
- reinstated weak_references
- moved isfinite and isnormal to libc
- clean up fake_long_doubles
- clean up some useless ifdefs
- added missing nexttoward* tests

Bug: 14134235
Change-Id: I95639c4885653fe47fd7dc0570ee5bb3389bbc6b
2014-04-23 19:03:06 +01:00
Elliott Hughes
acbe322e82 Regenerate the NOTICE files.
Change-Id: Iac666f69b930e31bbeac3438812d544c6af55b0f
2014-04-16 17:01:12 -07:00
Elliott Hughes
0f95a55322 Fix arm64 floating point definitions.
Change-Id: I6836da8fc9f66465435a21c51cb18851e20e9645
2014-04-14 15:33:32 -07:00
Elliott Hughes
02c78a3867 Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.

Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.

Also add some missing aliases. We now have all of:

  isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
  isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
  __fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.

Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-14 14:35:47 -07:00
Calin Juravle
f723b70fe0 Emit warnings when linking against imprecise math functions
Change-Id: I3da7b8396a64d7899fcb89452c879806a8a511ff
2014-04-02 19:16:54 +01:00
Calin Juravle
4d77c1151c Fix LP64 libm for 128-bit long doubles
* reworked amd64/_fpmath.h and arm64/_fpmath.h to support 128-bit long
doubles.
* improved tests to cover long double cases
* made modfl an alias for LP32

Tests pass on x86, x86_64, arm, arm64 and mips.

Bug: 12921273

Change-Id: Ibe39acde57972447a8950fa45b1e702acc68ebeb
2014-03-24 11:48:42 +00:00
Calin Juravle
bd3155dc5d Update libm to the upstream head (2014.03.13)
The most relevant changes are the ones in s_erff.c which should improve
the overall speed of exececution and the maximum error in ULP.

Change-Id: I7bd867f902db418db67f02cd58578624357b1ee8
2014-03-13 16:20:36 +00:00
Elliott Hughes
4e54b114f9 Update the NOTICE files.
Change-Id: Ie72a01cddd5b813393656f603689e497b0f88ddd
2014-03-06 15:06:11 -08:00
Pavel Chupin
7ba84d3108 Fix x86_64 build
Fix types after recent update:
https://android-review.googlesource.com/#/c/83435/

Change-Id: I17ed28af84b7adeb8572e18834e66f3264ec061d
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-02-28 00:52:09 +04:00
Calin Juravle
26349d8c2e Fix mips build
Change-Id: Ica843d387e115d0b27afd961af73237ec9109ed9
2014-02-26 21:33:36 +00:00
Calin Juravle
2d367905a2 Moved to a more openbsd-like fenv.h
Factored out common declarations to include/fenv.h and pushed
the implementation to .c files.

Bug: 11050744
Change-Id: I446b13cc4bc599d328343a8d392b07de280f6304
2014-02-26 12:30:44 +00:00
Elliott Hughes
a38cb08861 Clean up various warnings in bionic.
Change-Id: Ic57541d0a567fd4ae79f0ad59b2ffde1130eb7d2
2014-02-18 12:04:54 -08:00
Elliott Hughes
c16a453291 Merge "Remove <sys/_types.h>." 2014-02-08 00:23:50 +00:00
Elliott Hughes
9f87a0b285 Remove <sys/_types.h>.
Bug: 12213562
Change-Id: I0d10664f9da60739bdbad0408be0dd61eea3c1fe
2014-02-07 14:55:58 -08:00
Chris Dearman
645d0312c2 [MIPS64] libc/libm support
libc/libm support for MIPS64 targets

Change-Id: I8271941d418612a286be55495f0e95822f90004f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
2014-02-06 16:22:20 -08:00
Ying Wang
609526f97f Use arch-specific LOCAL_ variables to build libm.
Use arch-specific LOCAL_ variables to build libm for both
TARGET_ARCH and TARGET_2ND_ARCH.

Bug: 11654773
Change-Id: I6da794ba722bb68e7484d8869c6eb0425b7d17cb
2014-02-03 17:19:41 -08:00
Colin Cross
d1973ca513 bionic: rename aarch64 target to arm64
Rename aarch64 build targets to arm64.  The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
2014-01-23 18:35:39 -08:00
Elliott Hughes
54a7494f17 Regenerate the NOTICE files.
Also standardize the orthography in a few places to reduce near-duplicates
in the NOTICE files.

Change-Id: I347c75e817be61ec1b9c5b4b96226feedc8d09ab
2014-01-07 13:46:11 -08:00
Elliott Hughes
28ddd91c49 Fix __isnanl on aarch64.
This fixes the math.__isnanl, math.powl, and math.fdiml tests.

Change-Id: I0086e4a1a82d0e2708fa07cf580a6d9778c548f2
2013-12-19 17:13:56 -08:00
Elliott Hughes
20adf52cf2 We actually have modfl.
Change-Id: I22bb4d14f99a418819f2941c2dfec49094807c5f
2013-12-19 11:30:51 -08:00
Elliott Hughes
241608e9ce Don't use weak aliases in libm.
The aarch64 toolchain doesn't support them, and we were already implementing
most of the fake long-double functions differently anyway.

Change-Id: I4a2f2df81972ee9c34ddfe96cec81b126506d881
2013-12-18 17:18:53 -08:00
Serban Constantinescu
1c4f101a9b AArch64: Initial AArch64 port of libm
This patch adds intial support for AArch64 to bionic's libm.

Change-Id: I9ae0f895bbdd7fe67815e6ca1ead627581163a27
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2013-12-16 17:05:37 -08:00
Elliott Hughes
ab61eb366a Switch to upstream sleep(3) and usleep(3).
Also fix the signature of usleep, and the definition of useconds_t which
should be unsigned, as the 'u' in its name implies.

This patch also cleans up the existing FreeBSD hacks by moving the libm
stuff from <sys/cdefs.h> to a libm-private header, and adding comments
about the hacks we use to build FreeBSD source.

Change-Id: Ibe5067a380502df94a0a3a7901969b35411085b6
2013-11-20 16:24:16 -08:00
Elliott Hughes
361847f9ac Fix the x86_64 fenv.h.
We should clean all the fenv.h files up, but not now. I've raised
bug 11050744 as a reminder.

Change-Id: I640c15b0f0477ec1a7891c031860404875bbe4b5
2013-10-02 17:02:58 -07:00
Elliott Hughes
770a349560 Fix libm build for x86_64.
Change-Id: If89da2d5c3d9a88f78ffd8b260ad0f2fd391c608
2013-10-01 17:57:19 -07:00
Pavel Chupin
ce7add19d8 x86_64: libm fixes
* Makefile update for x86_64 target
* amd64 arch files

Change-Id: I8f17e3338bffd89a3086fbddd1e91bb4619eac1b
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-10-01 11:38:54 -07:00
Elliott Hughes
78419467a2 Take upstream libm changes.
Mostly workarounds for GCC and Clang bugs.

Change-Id: I4ef428a42d4ac6d622659053711a8cc416925727
2013-06-12 16:37:58 -07:00
Elliott Hughes
0493a6f7be Regenerate NOTICE files.
Also clean up some obsolete cruft.

Change-Id: Iec3b36f6607f7a08b72de99294ed5b6cd910dd5f
2013-03-07 11:51:10 -08:00
Elliott Hughes
6260553d48 Revert "Pull the pthread_key_t functions out of pthread.c."
This reverts commit ad59322ae4

somehow my unfinished libm/Android.mk change got into here.

Change-Id: I46be626c5269d60fb1ced9862f2ebaa380b4e0af
2013-02-11 20:18:16 +00:00
Elliott Hughes
ad59322ae4 Pull the pthread_key_t functions out of pthread.c.
This was originally motivated by noticing that we were setting the
wrong bits for the well-known tls entries. That was a harmless bug
because none of the well-known tls entries has a destructor, but
it's best not to leave land mines lying around.

Also add some missing POSIX constants, a new test, and fix
pthread_key_create's return value when we hit the limit.

Change-Id: Ife26ea2f4b40865308e8410ec803b20bcc3e0ed1
2013-02-11 12:00:48 -08:00
Elliott Hughes
170dbe25d6 Add a few more missing libm long double stubs.
Change-Id: I6c44b9f3eee730253a958d6cefdac99e6f79da3e
2013-02-07 17:45:11 -08:00
Elliott Hughes
926a307ce1 Add a missing logbl stub.
This doesn't usually matter because there's a weak reference; you'd
miss this if you stopped using s_logb.c though.

Change-Id: I912fceae327a378031cd24a64aefa9dfd84f7f90
2013-02-06 16:07:54 -08:00
Elliott Hughes
ef545a29ad Remove the currently-unused i387 assembler to make way for the new.
Change-Id: I37e4e8fce881246b9b028f9e1619247b1ac25261
2013-02-06 11:50:19 -08:00
Elliott Hughes
9b05df325c Make sincosl call sinl and cosl.
Bug: 2748728
Change-Id: Id18070963b91b144758c567ad7ac80758e3a638b
2013-02-01 16:32:50 -08:00
Elliott Hughes
d65bd8400e Update the libm/NOTICE file after the upgrade.
Change-Id: Icf9c44402d6f86117d61307219bb1cccd288854d
2013-02-01 16:16:54 -08:00
Elliott Hughes
a0ee07829a Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.

It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).

All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.

Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-02-01 14:51:19 -08:00
Elliott Hughes
448080d372 Bring the NOTICE files back up to date.
Change-Id: I978275cf6604b90595ee79d897c0460eeadc7dc8
2013-01-29 16:25:06 -08:00
Xiaokang, Qin
d97d1ca7d9 Add a flag control that PRIVATE libm can be chosen
Change-Id: I080456a2c45ac870965c25552c5821875568fe9b
Author: Xiaokang, Qin <xiaokang.qin@intel.com>
Signed-off-by: Xiaokang, Qin <xiaokang.qin@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 63396
2013-01-14 10:49:39 +08:00
Raghu Gandham
d199017101 [MIPS] Rewrite fenv.h for Android
Change-Id: I4d1e2f0b37b587426ccc9f26c525ec0d36637c7d
2013-01-04 16:32:54 -08:00
Elliott Hughes
90e10d41c4 Rewrite <fenv.h> for ARM.
The old code was one big no-op.

Bug: http://code.google.com/p/android/issues/detail?id=38196
Change-Id: I201a6ffa477385b2629f45e8c948bdfbd47b5bf1
2012-11-05 08:50:19 -08:00
Elliott Hughes
0f7809d5c3 Start cleaning up libm.
We have two copies of fenv.h for every architecture, one of which
isn't used. We also have unused makefiles and files for architectures
we don't support.

This patch removes all the obviously useless files.

Bug: http://code.google.com/p/android/issues/detail?id=38196
Change-Id: I1919b6621ba513aa24aa947a34815bc51191487c
2012-10-31 13:32:34 -07:00
Andrew Hsieh
2f7d7c6538 Enclosed functions in fenv.h with __BEGIN_DECLS/__END_DECLS
Those are C funcitons

Related CL: https://android-review.googlesource.com/#/c/41833/

Change-Id: I4386bcf948ad31c3690c9b7a145103088133d041
2012-08-21 15:41:34 +08:00
Elliott Hughes
32dbc03c73 Regenerate all NOTICE files with the latest version of the script.
This sorts every entry, so we should have more stability and fewer
merge conflicts in future.

Change-Id: Ifc5347dc53352da22c82d41ca59b483966fcfc6b
2012-08-15 15:43:13 -07:00
Elliott Hughes
ae5c64413b Add dependencies on all the makefiles.
This should help prevent broken builds next time I'm messing with
assembler/compiler/linker flags...

Change-Id: I30f15a3ce3c3f3c60cad7bc59aaba9f42d792224
2012-08-13 14:06:05 -07:00
Elliott Hughes
387d4b7de9 Auto-generate a complete NOTICE file.
Remove the hand-collated ones, and switch to a script that pulls the
copyright headers out of every file and collects the unique ones.

Change-Id: Ied3b98b3f56241df97166c410ff81de4e0157c9d
2012-08-09 16:05:31 -07:00
Shih-wei Liao
4e86ebb4b6 Had include/arm/fenv.h, but missed include/mips/fenv.h.
Needed for the device-build for LLVM's constant folding pass.

Change-Id: I412a98d52458231650801a8b59fe3159a789b8b9
Author: fu@mips.com
2012-07-30 20:12:46 -07:00
xqian6
29aa009924 Enable sqrtf() x86 assembly code
This patch can improve the sqrtf() performance.

Change-Id: Ic9d11d6a9ecd9b263f54d4878e13595e136b95ce
2012-06-25 16:20:09 +08:00
Elliott Hughes
e33af61c70 Remove the last references to SuperH.
Change-Id: Icb44c1f94cb178d90b4c2b1e8f6d175586aec4e1
2012-05-15 17:08:41 -07:00
Chris Dearman
726800e8f4 MIPS support to libm, libdl and libthread_db
Change-Id: I9106721af7fe0cd45df82976250db0d300a20117
Signed-off-by: Raghu Gandham <raghu@mips.com>
2012-05-04 11:34:40 -07:00
Elliott Hughes
7735a38935 Update s_fabsl.c to upstream head.
Bug: http://code.google.com/p/android/issues/detail?id=29539
Change-Id: I843dcfcbfe49e8e9f43c49aae6ade1edb57a3053
2012-04-30 16:12:43 -07:00
Jack Ren
bd0383acf8 libm: fix invalid result of function remquo/remquof
Currently we will get the wrong result as follows:
remquof(0x7bb33336, 0x63000000) = -671088640, 0x00000000
remquo(0xbff0000000000003, 0x3ff0000000000003) = 1, 0x8000000000000000
remquo(0x9120000000000001, 0x0000000000000005) = -1288490188, 0x0000000000000004
while the correct one should be:
remquof(0x7bb33336, 0x63000000) = 1476395008, 0x00000000
remquo(0xbff0000000000003, 0x3ff0000000000003) = -1, 0x8000000000000000
remquo(0x9120000000000001, 0x0000000000000005) = -1288490189, 0x0000000000000001

Fixed in this patch.

Change-Id: I540b348cd10a539f3b39b1753945c893c4c7ec46
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-10 12:55:43 +08:00
Jack Ren
1fa7b45df8 libm: cherry-pick one patch from freebsd to fix logb() denormals issue
from http://svnweb.freebsd.org/base?view=revision&revision=176101
"
Oops, fix the fix in rev.1.10.  logb() and logbf() were broken on
 denormals, and logb() remained broken after 1.10 because the fix for
 logbf() was incompletely translated.

Convert to __FBSDID().
"

Change-Id: I54f33648db7c421b06eee1ea8e63c57a179fae0d
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-02-28 12:28:05 +08:00
David 'Digit' Turner
70b1668a76 remove obsolete SuperH support
We don't have a toolchain anymore, we don't have working original
kernel headers, and nobody is maintaining this so there is really
no point in keeping this here. Details of the patch:

- removed code paths from Android.mk files related to the SuperH
  architecture ("sh")

- removed libc/arch-sh, linker/arch-sh, libc/kernel/arch-sh

- simplified libc/SYSCALLS.TXT

- simplified the scripts in libc/tools/ and libc/kernel/tools

Change-Id: I26b0e1422bdc347489e4573e2fbec0e402f75560

Signed-off-by: David 'Digit' Turner <digit@android.com>
2012-01-31 20:28:23 +01:00
David 'Digit' Turner
0a1b306fe1 am 32ca348e: am ce0d646c: resolved conflicts for merge of 6cda7b62 to gingerbread-plus-aosp
* commit '32ca348eecb114b9b2a9393f178c82310f590ddb':
  Bionic: x86: Fix libm macro definitions
2011-09-29 21:09:08 -07:00
David 'Digit' Turner
ce0d646cc0 resolved conflicts for merge of 6cda7b62 to gingerbread-plus-aosp
Change-Id: I85bd5291c2a9cd29bff538b6d5a4dcd73f85a1fd
2011-09-30 05:56:51 +02:00
Bruce Beare
6cda7b6249 Bionic: x86: Fix libm macro definitions
http://code.google.com/p/android/issues/detail?id=19276

GCC would remove inline asm due to lack of knowledge
of FPU register changes.

Change-Id: I9f9e8623fa6580843b7cd8178439ace8c2db2d51
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Author: Jingwei Zhang <jingwei.zhang@intel.com>
2011-09-29 17:35:33 +02:00
Jing Yu
d50225ad20 Disable sincos optimization for sincos calls.
sincos() functions would be turned into infinite calls to
itself if sincos optimization is applied to itself. See
gcc bugzilla http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46926

arm-linux-androideabi-4.4.3 toolchain does not have this problem
because sincos optimization is entirely disabled. Starting
from arm-linux-androideabi-4.6 toolchain, we enable sincos optimization
in gcc.

This patch simply enforce -O0 on this function to minimize the
change.

Change-Id: I0fc00b5f1dd71c0a024943bdedfed29b0d195e82
2011-08-17 10:29:41 -07:00
Bruce Beare
18142abc06 Remove extra/unneeded copy of fenv.h
Orig-Change-Id: I80da2521c50df7e8967af48164cc834abf499c50
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-07-07 22:46:15 +02:00
Bruce Beare
4029e0e7cb Use proper variable typing
Orig-Change-Id: If5c33d90b33f538448ac12e7bee94b4b9173d39c
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-07-07 22:46:15 +02:00
David 'Digit' Turner
8e2ff164cc libm: Add nanf() and tgammaf() implementations.
Requested by b/3370708 to export these through RenderScript.

Change-Id: I1ae69f87a1ad4765b2dee8e4a6f2f3a6eb7c5ad4
2011-01-25 17:07:26 +01:00
Chih-Wei Huang
b9aedb2c57 android-x86: use proper variable typing
Change-Id: Iff99932acd2f6cb482fc5da9ff586d7ab2a8b209
2010-12-23 09:32:12 +08:00
David Turner
572fced5b0 am 9691ecc9: Merge "Remove extra/unneeded copy of fenv.h"
* commit '9691ecc9a768e7e08cb6af0b454029195ffc285f':
  Remove extra/unneeded copy of fenv.h
2010-12-14 07:19:17 -08:00
David Turner
9691ecc9a7 Merge "Remove extra/unneeded copy of fenv.h" 2010-12-14 07:09:35 -08:00
David Turner
48bebaeca8 am 4efbf95d: Merge "Use proper variable typing"
* commit '4efbf95d8c88a3a203d687d9048b51e256ef3641':
  Use proper variable typing
2010-12-07 06:38:26 -08:00
David Turner
4efbf95d8c Merge "Use proper variable typing" 2010-12-07 06:27:23 -08:00
Rodrigo Obregon
fddaafceda Bionic: Aliasing problems with frexpf
This patch fixes a known bug in bionic libm
due to aliasing issues in gcc 4.2 and 4.4; more
specifically in frexpf.

The function frexpf is used to extract the
mantissa and exponent from a double precision number.

The bug has already been reported here:
https://code.google.com/p/android/issues/detail?id=6697

Change-Id: I2e1f2e0a45906642d2225b9d150ed391d2bf331c
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
2010-11-05 12:15:26 -05:00
Bruce Beare
52eed0aeb7 Remove extra/unneeded copy of fenv.h
Change-Id: I80da2521c50df7e8967af48164cc834abf499c50
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2010-10-11 12:34:26 -07:00
Bruce Beare
58f2b7ed66 Use proper variable typing
Change-Id: If5c33d90b33f538448ac12e7bee94b4b9173d39c
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2010-10-11 12:34:10 -07:00
David 'Digit' Turner
ce2ebf8d73 libm: remove aliasing issue.
See http://code.google.com/p/android/issues/detail?id=6697
for details about this change.

Change-Id: I516f00c6f3bc99b22be51669e4573246bdd6e33d
2010-09-27 17:35:48 +02:00
David 'Digit' Turner
2beac0f5c6 DO NOT MERGE - add sincos.c to libm compilation
For some reason, a previous backport from master didn't get this.

Change-Id: I59eb96ad9de495a659808fdfb557033476c3d123
2010-06-09 15:49:35 -07:00
David 'Digit' Turner
410b2ae7fb Add sincosl() function to bionic. So that sincos optimization can - DO NOT MERGE
be enabled.

Change-Id: I672cb319689aa4fb3f1f7cd868dda76842bebae9
2010-06-09 14:35:29 -07:00
Jean-Baptiste Queru
c3581dc78a Merge "Sometimes the compiler is very right! Found bug in bessel routines for float." 2010-05-11 10:43:56 -07:00
David Turner
7911e057a5 Merge "Reduce compiler anxiety." 2010-05-11 10:20:15 -07:00
Scott Turner
c1f8dd9f0b Sometimes the compiler is very right! Found bug in bessel routines for float.
Original compiler error:

target arm C: libm <= bionic/libm/src/e_j0f.c
bionic/libm/src/e_j0f.c: In function 'j0f':
bionic/libm/src/e_j0f.c:66: warning: comparison between signed and unsigned integer expressions
bionic/libm/src/e_j0f.c: In function 'y0f':
bionic/libm/src/e_j0f.c:140: warning: comparison between signed and unsigned integer expressions
target arm C: libm <= bionic/libm/src/e_j1.c

It's subtle but ix is masked with 0x7f000000 so it can never ever have a value
greater than 0x80000000. So I switched to using the unmasked hx and added a
cast as a reward to the compiler for being right.

I checked the original routines that e_j0f.c was ported from (in e_j0.c) and
the double's don't use 0x80000000 so this issue didn't exist there.

Let that be a warning to those that just slap on casts to shut up the compiler,
sometimes it's sniffed out a bug for you. :-)

Similar fixes in the other functions.

Change-Id: I7a776e5d4721fc3a9e3bd89179b67e9af3a2ebfa
2010-05-07 15:02:36 -07:00
Scott Turner
72d3489612 Reduce compiler anxiety.
Warning from compiler:

target arm C: libm <= bionic/libm/src/e_atan2.c
bionic/libm/src/e_atan2.c: In function 'atan2':
bionic/libm/src/e_atan2.c:71: warning: suggest parentheses around arithmetic in operand of '|'
target arm C: libm <= bionic/libm/src/e_atan2f.c
2010-01-16 10:39:00 -05:00
Scott Turner
fb02ec25e9 Reversed order of const and static to hush warning from compiler. 2010-01-16 10:23:18 -05:00
Shin-ichiro KAWASAKI
d87945b4e7 added and modified libm to support SuperH architecture 2009-08-31 16:25:42 +09:00
The Android Open Source Project
4e468ed2eb Code drop from //branches/cupcake/...@124589 2008-12-17 18:03:48 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00