Commit graph

26 commits

Author SHA1 Message Date
Elliott Hughes
2d1a2aa13d libm: sync with upstream FreeBSD.
Test: ran tests
Change-Id: I16b5930b0dc652ceac60d8ed1d57c6126c74699c
2019-02-04 13:43:48 -08:00
Elliott Hughes
ab52807685 Update to FreeBSD libm r336665.
This reverts commit 253a830631 and moves
us forward to a revision that contains fixes for the problem with the
previous attempt.

This also makes sincos(3)/sincosf(3)/sincosl(3) available to `_BSD_SOURCE`
as well as `_GNU_SOURCE`.

The new FreeBSD libm code requires the FreeBSD `__CONCAT` macro, and all
our existing callers are FreeBSD too, so update that.

There's also an assumption that <complex.h> drags in <math.h> which isn't
true for us, so work around that with `-include` in the makefile. This
then causes clang to recognize a bug -- returning from a void function --
in our fake (LP32) sincosl(3), so fix that too.

Bug: http://b/111710419
Change-Id: I84703ad844f8afde6ec6b11604ab3c096ccb62c3
Test: ran tests
2018-07-24 10:36:00 -07:00
Andreas Gampe
253a830631 Revert "Update to FreeBSD libm r336523."
This reverts commit f86ee10278.

Incorrect result for fmodf(3.0f, 0f) = 1.0f breaks ART tests.

Bug: 111710419
Test: art/test/testrunner/testrunner.py -b -t 436-rem-float --target
Change-Id: I7eae68fb92740db33415d16418447bcbbd98ecba
2018-07-21 12:23:03 -07:00
Elliott Hughes
f86ee10278 Update to FreeBSD libm r336523.
This includes an ld128 powl, plus the clog* and cpow* families.

Also teach the NOTICE generator to strip SPDX-License-Identifier lines.

Bug: N/A
Test: ran tests
Change-Id: Ic8289d1253666a19468a4088884cf7540f1ec66d
2018-07-19 16:17:06 -07:00
Elliott Hughes
e332f658e0 Switch to FreeBSD's actual sincos.
Before:
  BM_math_sin_fast                48 ns         48 ns   14693053
  BM_math_sincos                  61 ns         61 ns   11470219

After:
  BM_math_sin_fast                48 ns         48 ns   14725120
  BM_math_sincos                  43 ns         43 ns   16329843

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I8693c64135233c0641af5302c38748f47ac76737
2018-05-09 12:25:12 -07:00
Elliott Hughes
0364a4b446 Switch to FreeBSD catrigl.c for complex arc trig functions.
Bug: N/A
Test: ran tests
Change-Id: I9efbc23bc101fcf04a01334748461f5467dcf85e
2018-05-09 12:24:28 -07:00
Elliott Hughes
8da8ca4528 Update libm from upstream.
Bug: N/A
Test: ran tests
Change-Id: Ifa03eb36d412a2776208cd2921936be4724e5547
2018-05-09 12:24:21 -07:00
Elliott Hughes
5ea0b0667f libm symbol cleanup.
Some of this code is used in the NDK libandroid_support now, as a static
library, so just being HIDDEN in the ELF sense isn't sufficient.

Rename digittoint to __libm_digittoint so we don't trample anyone's toes.

Also remove imprecise_powl and imprecise_tgammal. It turns out (to my
surprise) that we don't even have ld128 implementations of powl and tgammal,
so even LP64 was just using the "fake_long_double.c" hack in effect. Since
that's the case, let's *actually* do that because then we're not polluting
with the internal names in addition to the aliases.

Bug: N/A
Test: readelf
Change-Id: I273cc8fdc7ce53f9b8dfd4ef7796e358fe901837
2017-07-13 17:33:15 -07:00
Elliott Hughes
3d125175d7 Move <machine/endian.h> somewhere more private.
Bug: http://b/28519060
Change-Id: I1c7811f95f46c65d4152bcf509b6e048c45bc28b
2016-05-02 15:44:56 -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
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
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
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
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
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
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
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