Revision tags: release/13.3.0 |
|
#
e38f2308 |
| 01-Mar-2024 |
Mark Murray <markm@FreeBSD.org> |
lib/msun: Fix tgammal(3) on IEEE 128-bit platforms
Undo the 80-bit "stub" implementation of the 128-bit long double tgammal(3) function. The latest (as of Feb 2024) version of the src/contrib/arm-op
lib/msun: Fix tgammal(3) on IEEE 128-bit platforms
Undo the 80-bit "stub" implementation of the 128-bit long double tgammal(3) function. The latest (as of Feb 2024) version of the src/contrib/arm-optimised-routines library includes a standalone, full 128-bit replacement. This needs a small bit of wrapping to fit it in, but is otherwise a drop-in replacement.
Testing this is hard, as most maths packages blow up as soon as their 80-bit floating-point capability is exceeded. With 128-bit tgammal(), this is easy to do, and this is the range that needs to be checked the most carefully. Using my copy of Maple, I was able to check that the output was within a few ULP of the correct answer, right up to the point of 128-bit over- and underflow. Additionally, the results are no worse, and indeed better than the 80-bit version.
Steve Kargl sent me his libm testing code, which I used to verify that the excpetions for certain key values were correct. Tested in this case were +-Inf, +-NaN, +-1 and +-0.
Differential Revision: https://reviews.freebsd.org/D44168 Reviewed by: theraven, andrew, imp
show more ...
|
#
d04e03c1 |
| 27-Jan-2024 |
Dimitry Andric <dim@FreeBSD.org> |
msun: remove fabs from Symbol.map, and adjust comment
We have s_fabs.c, but fabs(3) is already provided by libc due to historical reasons, so it is not compiled into libm. When the linker does not u
msun: remove fabs from Symbol.map, and adjust comment
We have s_fabs.c, but fabs(3) is already provided by libc due to historical reasons, so it is not compiled into libm. When the linker does not use --undefined-version, this leads to a complaint about the symbol being nonexistent, so remove it from Symbol.map.
While here, adjust the comment about some functions being supplied by libc: while it is true that all these are indeed in libc, libm still includes its own versions of frexp(3), isnan(3), isnanf(3), and isnanl(3).
Reported by: Steve Kargl <sgk@troutmask.apl.washington.edu> MFC after: 3 days
show more ...
|
#
dc36d6f9 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
lib: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
lib: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
Revision tags: release/14.0.0 |
|
#
b19d8afe |
| 05-Sep-2023 |
Warner Losh <imp@FreeBSD.org> |
msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead
LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the Makefile than the line:
.if exists(${LIBCSRCDIR}/${MACHINE_AR
msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead
LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the Makefile than the line:
.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})
so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't (but did for me since I mounted 13.2R SD image there). Move to defining our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily.
Sponsored by: Netflix Reviewed by: sjg Differential Revision: https://reviews.freebsd.org/D41661
show more ...
|
#
d0b2dbfa |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
c44ca4c2 |
| 09-Sep-2022 |
Gleb Popov <arrowd@FreeBSD.org> |
msun/Makefile: Fix conditional and unbreak the build. Approved by: imp Fixes: 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10
|
#
20adba8b |
| 08-Aug-2022 |
Gleb Popov <arrowd@FreeBSD.org> |
src.conf: Introduce WITHOUT_MACHDEP knob.
Summary: This knob can be used to make buildsystem prefer generic C implentations of various functions, instead of machine-specific assembler ones.
Test Pl
src.conf: Introduce WITHOUT_MACHDEP knob.
Summary: This knob can be used to make buildsystem prefer generic C implentations of various functions, instead of machine-specific assembler ones.
Test Plan: `make buildworld` on amd64
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36076
MFC after: 3 days
show more ...
|
Revision tags: release/13.1.0 |
|
#
03a88e3d |
| 14-Dec-2021 |
Mark Murray <markm@FreeBSD.org> |
* lib/msun/Makefile b/lib/msun/Makefile: . Disconnect imprecise.c from the build. This file can be deleted. . Add b_tgammal.c to the build for ld80 and ld128 targets. The ld128 is a 'git mv
* lib/msun/Makefile b/lib/msun/Makefile: . Disconnect imprecise.c from the build. This file can be deleted. . Add b_tgammal.c to the build for ld80 and ld128 targets. The ld128 is a 'git mv' of imprecise.c to ld128/b_tgammal.c.
* lib/msun/ld80/b_expl.c: . New file. Implement __exp__D for ld80 targets. This is based on bsdsrc/b_exp.c.
* lib/msun/ld80/b_logl.c: . New file. Implement __log__D for ld80 targets. This is based on bsdsrc/b_log.c.
* lib/msun/ld80/b_tgammal.c b/lib/msun/ld80/b_tgammal.c . New file. Implement tgammal(x) for ld80 targets.
Submitted by: Steve Kargl Differential Revision: https://reviews.freebsd.org/D33444 Reviewed by: pfg
show more ...
|
#
455b2ccd |
| 14-Dec-2021 |
Mark Murray <markm@FreeBSD.org> |
* lib/msun/Makefile: . Disconnect b_exp.c and b_log.c from the build.
* lib/msun/bsdsrc/b_exp.c: . Replace scalb() usage with C99's ldexp(). . Replace finite(x) usage with C99's isfinite().
* lib/msun/Makefile: . Disconnect b_exp.c and b_log.c from the build.
* lib/msun/bsdsrc/b_exp.c: . Replace scalb() usage with C99's ldexp(). . Replace finite(x) usage with C99's isfinite(). . Whitespace changes towards style(9). . Remove include of "mathimpl.h". It is no longer needed. . Remove #if 0 ... #endif code, which has been present since svn r93211 (2002-03-26). . New minimax polynomial coefficients. . Add comments to explain origins of some constants. . Use ansi-C prototype. Remove K&R prototype. Add static to prototype.
* lib/msun/bsdsrc/b_log.c: . Remove include of "mathimpl.h". It is no longer needed. . Fix comments to actually describe the code. . Reduce minimax polynomial from degree 4 to degree 3. This uses newly computed coefficients. . Use ansi-C prototype. Remove K&R prototype. Add static to prototype. . Remove volatile in declaration of u1. . Alphabetize decalaration list. . Whitespace changes towards style(9). . In argument reduction of x to g and m, replace use of logb() and ldexp() with a single call to frexp(). Add code to get 1 <= g < 2. . Remove #if 0 ... #endif code, which has been present since svn r93211 (2002-03-26). . The special case m == -1022, replace logb() with ilogb().
* lib/msun/bsdsrc/b_tgamma.c: . Update comments. Fix comments where needed. . Add float.h to get LDBL_MANT_DIG for weak reference of tgammal to tgamma. . Remove include of "mathimpl.h". It is no longer needed. . Use "math.h" instead of <math.h>. . Add '#include math_private.h" . Add struct Double from mathimpl.h and include b_log.c and b_exp.c. . Remove forward declarations of neg_gam(), small_gam(), smaller_gam, large_gam() and ratfun_gam() by re-arranging the code to move these function above their first reference. . New minimax coefficients for polynomial in large_gam(). . New splitting of a0 into a0hi nd a0lo, which include additional bits of precision. . Use ansi-C prototype. Remove K&R prototype. . Replace the TRUNC() macro with a simple cast of a double entities to float before assignment (functional changes). . Replace sin(M_PI*z) with sinpi(z) and cos(M_PI*(0.5-z)) with cospi(0.5-z).
Submitted by: Steve Kargl Differential Revision: https://reviews.freebsd.org/D33444 Reviewed by: pfg
show more ...
|
Revision tags: release/12.3.0 |
|
#
b2e84316 |
| 02-Nov-2021 |
Andrew Turner <andrew@FreeBSD.org> |
Use a builtin where possible in msun
Some of the functions in msun can be implemented using a compiler builtin function to generate a small number of instructions. Implement this support in fma, fma
Use a builtin where possible in msun
Some of the functions in msun can be implemented using a compiler builtin function to generate a small number of instructions. Implement this support in fma, fmax, fmin, and sqrt on arm64.
Care must be taken as the builtin can be implemented as a function call on some architectures that lack direct support. In these cases we need to use the original code path.
As we don't set errno on failure build with -fno-math-errno so the toolchain doesn't convert a builtin into a function call when it detects a failure, e.g. gcc will add a call to sqrt when the input is negative leading to an infinite loop.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32801
show more ...
|
#
046e2d5d |
| 05-Nov-2021 |
Steve Kargl <kargl@FreeBSD.org> |
Implementations of cexpl()
The change implements cexpl() for both ld80 and ld128 architectures. Testing was done on x86_64 and aarch64 systems.
Along the way sincos[fl]() use an optimization that r
Implementations of cexpl()
The change implements cexpl() for both ld80 and ld128 architectures. Testing was done on x86_64 and aarch64 systems.
Along the way sincos[fl]() use an optimization that reduces the argument to being done one rather than twice. This optimization actually pointed to a bug in the ld128 version of sincosl(), which is now fixed. In addition, the minmax polynomial coefficients for sincosl() have been updated.
A concise log of the file-by-file changes follows.
* include/complex.h: . Add a prototype for cexpl().
* lib/msun/Makefile: . Add s_cexpl.c to the build. . Setup a link for cexpl.3 to cexp.3.
* lib/msun/Symbol.map: . Expose cexpl symbol in libm shared library.
* lib/msun/ld128/s_cexpl.c: * Implementation of cexpl() for 128-bit long double architectures. Tested on an aarch64 system.
* lib/msun/ld80/s_cexpl.c: * Implementation of cexpl() for Intel 80-bit long double.
* lib/msun/man/cexp.3: . Document cexpl().
* lib/msun/man/complex.3: . Add a BUGS section about cpow[fl].
* lib/msun/src/s_cexp.c: . Include float.h for weak references on 53-bit long double targets. . Use sincos() to reduce argument reduction cost.
* lib/msun/src/s_cexpf.c: . Use sincosf() to reduce argument reduction cost.
* lib/msun/src/k_sincosl.h: . Catch up with the new minmax polynomial coefficients for the kernel for the 128-bit cosl() implementation. . BUG FIX: *cs was used where *sn should have been. This means that sinl() was no computed correctly when iy != 0.
* lib/msun/src/s_cosl.c: . Include fpmath.h to get access to IEEEl2bits. . Replace M_PI_4 with pio4, a 64-bit or 113-bit approximation for pi / 4.
PR: 216862 MFC after: 1 week
show more ...
|
#
ca3d8cb0 |
| 26-Oct-2021 |
Steve Kargl <kargl@FreeBSD.org> |
lib/msun: Move the files to appropriate locations in the Makefile
Fixes: dce5f3abed7181cc533ca5ed PR: 218514 MFC after: 1 week
|
#
dce5f3ab |
| 25-Oct-2021 |
Steve Kargl <kargl@FreeBSD.org> |
[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]
Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle trignometric functions cospi, sinpi, and tanpi. The attached patch impl
[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]
Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle trignometric functions cospi, sinpi, and tanpi. The attached patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited testing on the cospi and sinpi reveal a max ULP less than 0.89; while tanpi is more problematic with a max ULP less than 2.01 in the interval [0,0.5]. The algorithms used in these functions are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c.
Note. I no longer have access to a system with ld128 and adequate support to compile and test the ld128 implementations of these functions. Given the almost complete lack of input from others on improvements to libm, I doubt that anyone cares. If someone does care, the ld128 files contain a number of FIXME comments, and in particular, while the polynomial coefficients are given I did not update the polynomial algorithms to properly use the coefficients.
PR: 218514 MFC after: 2 weeks
show more ...
|
#
168234fa |
| 15-Apr-2021 |
Alex Richardson <arichardson@FreeBSD.org> |
lib/msun: Exclude ignored-pragmas from -Werror
This avoids build failures due to the clang 12 warning: '#pragma FENV_ACCESS' is not supported on this target - ignored
Clang 12 currently emits t
lib/msun: Exclude ignored-pragmas from -Werror
This avoids build failures due to the clang 12 warning: '#pragma FENV_ACCESS' is not supported on this target - ignored
Clang 12 currently emits this warning for all non-x86 architectures. While this can result in incorrect code generation (e.g. on AArch64 some exceptions are not raised as expected), this is a pre-existing issue and we should not fail the build due to this warning.
Reviewed By: dim, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29743
show more ...
|
#
bae9fd0b |
| 10-Apr-2021 |
Dimitry Andric <dim@FreeBSD.org> |
Only use -fp-exception-behavior=maytrap on x86, for now
After 3b00222f156d, it turns out that clang only supports strict floating point semantics for SystemZ and x86 at the moment, while for other a
Only use -fp-exception-behavior=maytrap on x86, for now
After 3b00222f156d, it turns out that clang only supports strict floating point semantics for SystemZ and x86 at the moment, while for other architectures it is still experimental.
Therefore, only use -fp-exception-behavior=maytrap on x86 for now, otherwise this option results in "error: overriding currently unsupported use of floating point exceptions on this target [-Werror,-Wunsupported-floating-point-opt]" on other architectures.
Fixes: 3b00222f156d PR: 254911 MFC after: 1 week
show more ...
|
#
3b00222f |
| 10-Apr-2021 |
Dimitry Andric <dim@FreeBSD.org> |
Avoid raising unexpected floating point exceptions in libm
When using clang with x86_64 CPUs that support AVX, some floating point transformations may raise exceptions that would not have been raise
Avoid raising unexpected floating point exceptions in libm
When using clang with x86_64 CPUs that support AVX, some floating point transformations may raise exceptions that would not have been raised by the original code. To avoid this, use the -fp-exception-behavior=maytrap flag, introduced in clang 10.0.0.
In particular, this fixes a number of test failures with ctanhf(3) and ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID exception is then raised, because clang emits vdivps instructions to perform certain divides. (The vdivps instruction operates on multiple single-precision float operands simultaneously, but the exceptions may be influenced by unused parts of the XMM registers. In this particular case, it was calculating 0 / 0, which results in FE_INVALID.)
If -fp-exception-behavior=maytrap is specified however, clang uses vdivss instructions instead, which work on one operand, and should not raise unexpected exceptions.
Reported by: olivier Reviewed by: arichardson PR: 254911 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29686
show more ...
|
Revision tags: release/13.0.0, release/12.2.0, release/11.4.0 |
|
#
fac6dee9 |
| 12-May-2020 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
Remove tests for obsolete compilers in the build system
Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree. Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions f
Remove tests for obsolete compilers in the build system
Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree. Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions for older compilers.
Reviewed by: imp (earlier version), emaste, jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24802
show more ...
|
Revision tags: release/12.1.0, release/11.3.0 |
|
#
c2c227a5 |
| 03-Feb-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r343571 through r343711.
|
#
50b06886 |
| 02-Feb-2019 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
libm: squelch -Woverflow from gcc6
Sponsored by: Dell EMC Isilon
|
Revision tags: release/12.0.0 |
|
#
5a4c3b83 |
| 20-Jul-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
This is a follow-up to r336299.
* lib/msun/Makefile: . Remove polevll.c
* lib/msun/ld80/e_powl.c: . Copy contents of pol
Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
This is a follow-up to r336299.
* lib/msun/Makefile: . Remove polevll.c
* lib/msun/ld80/e_powl.c: . Copy contents of polevll.c to here. This is the only consumer of these functions. Make functions 'static inline'. . Make reducl a 'static inline' function.
* lib/msun/man/exp.3: . Remove BUGS section that no longer applies.
* lib/msun/src/math_private.h: . Remove prototypes of __p1evll() and __polevll()
* lib/msun/src/s_cpow.c: * lib/msun/src/s_cpowf.c: * lib/msun/src/s_cpowl.c . Include math_private.h. . Use the CMPLX macro from either C99 or math_private.h (depends on compiler support) instead of the problematic use of complex I.
Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> PR: 229876 MFC after: 1 week
show more ...
|
#
c422fbac |
| 19-Jul-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Revert r336497 for now, as it breaks on architectures using gcc, with:
cc1: warnings being treated as errors /usr/src/lib/msun/src/s_cpow.c: In function 'cpow': /usr/src/lib/msun/src/s_cpow.c:63: wa
Revert r336497 for now, as it breaks on architectures using gcc, with:
cc1: warnings being treated as errors /usr/src/lib/msun/src/s_cpow.c: In function 'cpow': /usr/src/lib/msun/src/s_cpow.c:63: warning: implicit declaration of function 'CMPLX'
show more ...
|
#
2ae9055f |
| 19-Jul-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
This is a follow-up to r336299.
* lib/msun/Makefile: . Remove polevll.c
* lib/msun/ld80/e_powl.c: . Copy contents of polevll.c to here. T
Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
This is a follow-up to r336299.
* lib/msun/Makefile: . Remove polevll.c
* lib/msun/ld80/e_powl.c: . Copy contents of polevll.c to here. This is the only consumer of these functions. Make functions 'static inline'. . Make reducl a 'static inline' function.
* lib/msun/man/exp.3: . Remove BUGS section that no longer applies.
* lib/msun/src/math_private.h: . Remove prototypes of __p1evll() and __polevll()
* lib/msun/src/s_cpow.c: * lib/msun/src/s_cpowf.c: * lib/msun/src/s_cpowl.c . Use the CMPLX macro from either C99 or math_private.h (depends of compiler support) instead of the problematic use of complex I.
Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu> PR: 229876 MFC after: 1 week
show more ...
|
#
6813d08f |
| 15-Jul-2018 |
Matt Macy <mmacy@FreeBSD.org> |
msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
This corresponds to the latest status (hasn't changed in 9+ years) from openbsd of ld80/ld128 powl, and source cpowf, cpow, cpowl (the comp
msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
This corresponds to the latest status (hasn't changed in 9+ years) from openbsd of ld80/ld128 powl, and source cpowf, cpow, cpowl (the complex power functions for float complex, double complex, and long double complex) which are required for C99 compliance and were missing from FreeBSD. Also required for some numerical codes using complex numbered Hamiltonians.
Thanks to jhb for tracking down the issue with making weak_reference compile on powerpc.
When asked to review, bde said "I don't like it" - but provided no actionable feedback or superior implementations.
Discussed with: jhb Submitted by: jmd Differential Revision: https://reviews.freebsd.org/D15919
show more ...
|
Revision tags: release/11.2.0 |
|
#
0c0288a2 |
| 13-May-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Add implementations for clog(3), clogf(3), and clog(3).
PR: 216863 Submitted by: bde, Steven G. Kargl <sgk@troutmask.apl.washington.edu> MFC after: 2 weeks
|
Revision tags: release/10.4.0 |
|
#
1409e715 |
| 21-Aug-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r322398 through r322746.
|