Commit Graph

997 Commits

Author SHA1 Message Date
Li-Wen Hsu
24612bfd1f Unskip test cases from netbsd-tests by defining __HAVE_FENV
This unskips:
  - lib.libc.stdlib.strtod_test.strtod_round
  - lib.msun.fe_round_test.t_nofe_round

In lib/msun/tests/Makefile only define on fe_round_test.c because
lib.msun.ilogb_test.ilogb will get wrong results and needs more examination.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-31 20:45:45 +00:00
Edward Tomasz Napierala
5a38af1fb8 Introduce <sys/qmath.h>, a fixed-point math library from Netflix.
This makes it possible to perform mathematical operations
on
fractional values without using floating point. It operates on Q
numbers, which are integer-sized, opaque structures initialized
to hold a chosen number of integer and fractional
bits.


For a general description of the Q number system, see the "Fixed Point
Representation & Fractional Math" whitepaper[1]; for the actual
API see the qmath(3) man page.

This is one of dependencies for the upcoming stats(3) framework[2]
that will be applied to the TCP stack in a later commit.

1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf
2. https://reviews.freebsd.org/D20477

Reviewed by:	bcr (man pages, earlier version), sef (earlier version)
Discussed with:	cem, dteske, imp, lstewart
Sponsored By:	Klara Inc, Netflix
Obtained from:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20116
2019-08-27 11:46:22 +00:00
Dimitry Andric
740890be23 Partially revert r271349, which disabled the msun cexp test #4 on i386.
Ensure the expected result is stored first in a volatile variable with
the desired type.  This makes all the tests succeed.

Slightly changed from the original pull request, but functionally the
same.

Obtained from:	https://github.com/freebsd/freebsd/pull/401
Submitted by:	Moritz Buhl <gh@moritzbuhl.de>
PR:		191676
MFC after:	3 days
2019-06-01 20:08:10 +00:00
Peter Jeremy
885bfcda11 Replace calls to sin(x) and cos(x) with a single call to sincos().
Replace calls to sinf(x) and cosf(x) with a single call to sincosf().

Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
Reviewed by:	bde
Approved by:	grog
MFC after:	3 days
2019-02-10 08:46:07 +00:00
Dimitry Andric
bc8fc00705 Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
trig_test.reduction test cases to fail, if the fixes from r343916 have
not yet been applied to the base compiler.

Reported by:    lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after:	1 week
2019-02-08 18:31:54 +00:00
Eric van Gyzen
50b06886a7 libm: squelch -Woverflow from gcc6
Sponsored by:	Dell EMC Isilon
2019-02-01 23:15:54 +00:00
Li-Wen Hsu
24df7b15fa Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
expected failure after clang700-import merge

PR:		234040
Reviewed by:	ngie, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18938
2019-01-25 18:48:20 +00:00
Pedro F. Giffuni
76c528d350 msun: reduce diff between src/e_j0.c and src/e_j0f.c
PR:	229501
MFC after:	1 week
2019-01-14 15:48:35 +00:00
Pedro F. Giffuni
bdd8abc6d6 pow(3): Workaround possible signed shift Undefined Behavior.
j is int32_t and thus j<<31 is undefined if j==1.

Hinted by:	muusl-lib (git 688d3da0f1730daddbc954bbc2d27cc96ceee04c)
Discussed with:	freebsd-numerics (kargl)
2019-01-07 17:35:09 +00:00
Pedro F. Giffuni
50757b1452 msun: Fix some old typos.
Seen in a posting from July 27 by "CM Graff" in musl-libc.
2018-12-31 15:43:06 +00:00
Justin Hibbits
003fdafbea libm: Include float.h to get LDBL_MANT_DIG
The long double aliases of double functions are only exposed as aliases if
LDBL_MANT_DIG is 53 (same as DBL_MANT_DIG).  Without float.h included these
files were not exposing weak aliases as expected, leading to link failures
if programs use the *l functions.  This should fix editors/calligra on
targets with 64-bit long double, which uses erfl and erfcl.  Found on
powerpc64.

Reviewed by:	kargl@
2018-12-28 01:34:08 +00:00
Mateusz Piotrowski
6d080f8660 csqrt(3): Fix some typos in the manual page
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
Reviewed by:	eadler
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17831
2018-11-04 14:11:38 +00:00
Bruce Evans
2011986f09 In C remquol() and thus also in C remainderl(), don't clobber the sign bit
of NaNs before possible returning a NaN.

The remquo*() and remainder*() functions should now give bitwise identical
results across arches and implementations, and bitwise consistent results
(with lower precisions having truncated mantissas) across precisions.  x86
already had consistency across amd64 and i386 and precisions by using the
i387 consistently and normally not using the C versions.  Inconsistencies
for C reqmquol() were first detected on sparc64.

Remove double second clearing of the sign bit and extra blank lines.
2018-07-24 11:50:05 +00:00
Bruce Evans
daa1e39110 Fix the conversion to use nan_mix() in r336362. fmod*(x, y),
remainder*(x, y) and remquo*(x, y, quo) were broken for y = 0 by changing
multiplication by y to addition of y.  (When y is 0, the result should be
NaN but became 1 for finite x.)

Use a new macro nan_mix_op() to give more control over the mixing, and
expand comments.

Recent re-testing missed finding this bug since I only tested the macro
version on amd64 and i386 and these arches don't use the C versions (they
use either asm versions or builtins).

Reported by:	enh via freebsd-numerics
2018-07-24 10:10:16 +00:00
Dimitry Andric
5a4c3b831b 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
2018-07-20 18:27:30 +00:00
Bruce Evans
27aa844253 Centralize the complications for special efficient rounding to integers.
This was open-coded in range reduction for trig and exp functions.  Now
there are 3 static inline functions rnint[fl]() that replace open-coded
expressions, and type-generic irint() and i64rint() macros that hide the
complications for efficiently using non-generic irint() and irintl()
functions and casts.

Special details:

ld128/e_rem_pio2l.h needs to use i64rint() since it needs a 46-bit integer
result.  Everything else only needs a (less than) 32-bit integer result so
uses irint().

Float and double cases now use float_t and double_t locally instead of
STRICT_ASSIGN() to avoid bugs in extra precision.

On amd64, inline asm is now only used for irint() on long doubles.  The SSE
asm for irint() on amd64 only existed because the ifdef tangles made the
correct method of simply casting to int for this case non-obvious.
2018-07-20 12:42:24 +00:00
Dimitry Andric
c422fbac00 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'
2018-07-19 19:07:25 +00:00
Dimitry Andric
2ae9055f49 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
2018-07-19 18:44:10 +00:00
Bruce Evans
b7092eef4d Fix spurious and extra underflows and resulting inaccuracies for some cases
with 1 huge component and 1 tiny (but nowhere near denormal) component.
Rescale earlier so that a scale factor of 2 can be combined with a non-
scale divisor of 2, so that the division doesn't shift out a bit.  In the
usual case where the scale factor is just 1, the division may shift out a
bit, but then the underflow is not spurious and the inaccuracies are harder
to fix.
2018-07-19 15:04:10 +00:00
Bruce Evans
50c8bd4e53 Oops, r336412 undid the fix of the overflow threshold in r323003. Restore
the previous overflow threshold and adjust comments.
2018-07-19 14:24:48 +00:00
Bruce Evans
1693fd03d9 Minor cleanups to csqrt*(), mostly in comments.
Remove the STDC CX_LIMITED_RANGE pragma and its verbose comment.  We still
don't have any C99 compilers (that support fenv pragmas), and if we did
then there are thousands of other places in libm that would need to use
them more than here.

The other cleanups are smaller.
2018-07-17 12:01:59 +00:00
Bruce Evans
9d7dc13615 Fix scaling bugs which gave innaccuracies and spurious underflows in csqrt()
and csqrtl().

When one component is huge and the other is tiny, scaling down the tiny
component gave spurious underflow.

When both components are denormal, not scaling them up gave inaccuracies
of 34+ ulps on not very carefully selected args.  Fixing this reduces the
maximum error to 1.6 ulps on the same set of args (mosly not denormal ones).

The scaling used multiplication of a complex variable by 2, but clang messes
this on amd64 up by losing the sign of -0.0.  Calculate the components
separately, as is well known to be needed for operations on more exceptional
values.
2018-07-17 10:44:16 +00:00
Bruce Evans
6f1b8a0792 Add a macro nan_mix() and use it to get NaN results that are (bitwise)
independent of the precision in most cases.  This is mainly to simplify
checking for errors.  r176266 did this for e_pow[f].c using a less
refined expression that often didn't work.  r176276 fixes an error in
the log message for r176266.  The main refinement is to always expand
to long double precision.  See old log messages (especially these 2)
and the comment on the macro for more general details.

Specific details:
- using nan_mix() consistently for the new and old pow*() functions was
  the only thing needed to make my consistency test for powl() vs pow()
  pass on amd64.

- catrig[fl].c already had all the refinements, but open-coded.

- e_atan2[fl].c, e_fmod[fl].c and s_remquo[fl] only had primitive NaN
  mixing.

- e_hypot[fl].c already had a different refined version of r176266.  Refine
  this further.  nan_mix() is not directly usable here since we want to
  clear the sign bit.

- e_remainder[f].c already had an earlier version of r176266.

- s_ccosh[f].c,/s_csinh[f].c already had a version equivalent to r176266.
  Refine this further.  nan_mix() is not directly usable here since the
  expression has to handle some non-NaN cases.

- s_csqrt.[fl]: the mixing was special and mostly wrong.  Partially fix the
  special version.

- s_ctanh[f].c already had a version of r176266.
2018-07-17 07:42:14 +00:00
Matt Macy
6813d08ff5 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
2018-07-15 00:23:10 +00:00
Mark Johnston
7525d42f70 Reduce diff between msun/src/e_pow.c and msun/src/e_powf.c.
Remove unnecessary casts, use integer literal constants instead of
floating point constants where possible, and introduce three const
static variables to hold 0.5, 0.25, and 1/3.

PR:		229420
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	1 week
2018-07-08 16:33:58 +00:00
Mark Johnston
46a846f791 Fix whitespace issues in bessel function routines.
PR:		229423
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	3 days
2018-07-08 16:26:13 +00:00
Conrad Meyer
bc5356c5a8 clog.3, complex.3: Fix typos and igor style issues
PR:		228783
Reported by:	Karsten <freebsd-bugzilla AT kkoenig.net>
2018-06-06 16:25:00 +00:00
Dimitry Andric
b451efbedc Resolve conflicts between macros in fenv.h and ieeefp.h
This is a follow-up to r321483, which disabled -Wmacro-redefined for
some lib/msun tests.

If an application included both fenv.h and ieeefp.h, several macros such
as __fldcw(), __fldenv() were defined in both headers, with slightly
different arguments, leading to conflicts.

Fix this by putting all the common macros in the machine-specific
versions of ieeefp.h.  Where needed, update the arguments in places
where the macros are invoked.

This also slightly reduces the differences between the amd64 and i386
versions of ieeefp.h.

Reviewed by:	kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D15633
2018-05-31 20:22:47 +00:00
Konstantin Belousov
0c0288a218 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
2018-05-13 09:54:34 +00:00
Brooks Davis
3b05ffaf6f Replace SOFTFLOAT with __riscv_float_abi_*.
With SOFTFLOAT, libc and libm were built correctly, but any program
including fenv.h itself assumed it was on a hardfloat systen and emitted
inline fpu instructions for fedisableexcept() and friends.

Unlike r315424 which did this for MIPS, I've used riscv_float_abi_soft
and riscv_float_abi_double macros as appropriate rather than using
__riscv_float_abi_soft exclusively.  This ensures that attempts to use an
unsupported hardfloat ABI will fail.

Reviewed by:	br
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10039
2018-04-19 20:36:15 +00:00
Eitan Adler
f5ce166436 msun: signed overflow in atan2
As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

Note that while there are three different e_atan* files in the
relevant directory, only this one needs fixing. e_atan2f.c already
compares against the full bit pattern encoding 1.0f, while
e_atan2l.cuses bitwise-ands/ors/nots and so doesn't require a change.

Closes #130

Submitted by:	Jeff Walden (@jswalden github PR #130)
Reviewed by:	bde
MFC After:	1 month
2018-02-14 07:59:30 +00:00
Eitan Adler
d592c356d3 cacos(3): correct spelling of 'I'
In some cases we had 'i' instead of 'I'.

PR:		195517
Submitted by:	stephen
2017-12-31 00:55:00 +00:00
Eitan Adler
d52a982ea8 lib: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:41 +00:00
Dimitry Andric
45b8a101e7 Correct r326748, indicating that tgammal(3) is mapped to tgamma(3), not
to itself.

Noticed by:	jilles
MFC after:	3 days
2017-12-10 23:03:13 +00:00
Dimitry Andric
240076e595 Document the existence and precision of the remaining long double
functions for which an imprecise stub implementation was added in
r255294, namely powl(3) and tgammal(3).

Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-10 16:42:59 +00:00
Dimitry Andric
95708dbcae Remove an unused incude from lib/msun/bsdsrc/b_log.c.
Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-07 20:41:23 +00:00
Dimitry Andric
dfd6ede5f9 Remove the sentence in math(3) about some long double math functions not
being available.

Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-07 20:38:37 +00:00
Ed Maste
a71393e7d3 lib/msun: remove trailing whitespace from e_pow.c
Submitted by:	Steve Kargl
MFC after:	1 week
2017-12-03 01:56:03 +00:00
Pedro F. Giffuni
5e53a4f90f lib: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-26 02:00:33 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Ryan Libby
fca37d4727 lib/msun: add more csqrt unit tests for precision and overflow
Reviewed by:	bde
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-29 22:37:24 +00:00
Ryan Libby
cf551d94ef lib/msun: avoid referring to broken LDBL_MAX
LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'".  Avoid this by
referring to proxy values instead.

Reviewed by:	bde
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-29 22:32:29 +00:00
Enji Cooper
b92e8635f9 Revert r321457
It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

PR:	220989
MFC after:	2 months
MFC with:	r321369, r322855
2017-08-26 06:44:50 +00:00
Enji Cooper
d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Enji Cooper
9f27375481 Re-add #endif accidentally deleted in r321484
MFC after:	1 month
MFC with:	r321455, r321484
2017-07-25 16:57:25 +00:00
Enji Cooper
db92647731 Only test ld_pi_odd with LDBL_MANT_DIG == 64 to fix the build
The empty (unimplemented) test inputs for sparc64 trigger a -Wtype-limits build
failure because nitems of an empty array is always false, i.e., deadcode.

MFC after:	1 month
MFC with:	r321455
Reported by:	Jenkins (sparc64 job)
2017-07-25 16:21:22 +00:00
Enji Cooper
82482c7c1f Mask issues with duplicate definitions for __fnstcw, __fldenv, and __fldcw on
i386 by ignoring -Wmacro-redefined.

This is a bandaid until the code is fixed and will be reverted before MFC.
2017-07-25 16:11:36 +00:00
Enji Cooper
bc82a381be Mark :reduction as an expected failure
It fails with clang 5.0+.

PR:	220989
MFC after:	2 months
MFC with:	r321369
Reported by:	Jenkins
2017-07-25 03:56:42 +00:00
Enji Cooper
4580a78efd Convert lib/msun/trig_test from TAP to ATF format
Only expose :accuracy and :reduction if !i386, similar to before,
but more holistically to avoid future -Wunused issue with the unused
functions.

MFC after:	1 month
2017-07-25 03:55:44 +00:00
Enji Cooper
fd5e9c331e Raise WARNS to 1
This will enable warnings with the msun tests.

MFC after:	1 month
2017-07-25 03:54:35 +00:00
Enji Cooper
b97ee15f62 logarithm_test: assert that feclearexcept succeeds
This helps ensure that test preconditons are fulfilled.

MFC after:	3 days
Reported by:	Coverity
CID:		1346572
Sponsored by:	Dell EMC Isilon
2017-05-29 18:49:28 +00:00
Enji Cooper
2dd512c37f fma_test: mute a warning about unreachable code on amd64 by restructuring
the #ifdef block to only handle the rest of the logic in the loop in the
#else case.

MFC after:	3 days
Reported by:	Coverity
CID:		1346844
Sponsored by:	Dell EMC Isilon
2017-05-29 18:45:10 +00:00
Michal Meloun
e1b98d0774 Implement sincos, sincosf, and sincosl.
The primary benefit of these functions is that argument
reduction is done once instead of twice in independent
calls to sin() and cos().

* lib/msun/Makefile:
  . Add s_sincos[fl].c to the build.
  . Add sincos.3 documentation.
  . Add appropriate MLINKS.

* lib/msun/Symbol.map:
  . Expose sincos[fl] symbols in dynamic libm.so.

* lib/msun/man/sincos.3:
  . Documentation for sincos[fl].

* lib/msun/src/k_sincos.h:
  . Kernel for sincos() function.  This merges the individual kernels
    for sin() and cos().  The merger offered an opportunity to re-arrange
    the individual kernels for better performance.

* lib/msun/src/k_sincosf.h:
   . Kernel for sincosf() function.  This merges the individual kernels
     for sinf() and cosf(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/k_sincosl.h:
   . Kernel for sincosl() function.  This merges the individual kernels
     for sinl() and cosl(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/math.h:
  . Add prototytpes for sincos[fl]().

* lib/msun/src/math_private.h:
  . Add RETURNV macros.  This is needed to reset fpsetprec on I386
    hardware for a function with type void.

* lib/msun/src/s_sincos.c:
  . Implementation of sincos() where sin() and cos() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosf.c:
  . Implementation of sincosf() where sinf() and cosf() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosl.c:
  . Implementation of sincosl() where sinl() and cosl() were merged into
    one routine and possibly re-arranged for better performance.

PR:		215977, 218300
Submitted by:	Steven G. Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10765
2017-05-28 06:13:38 +00:00
Dimitry Andric
3a462c983d Silence a -Wunused warning about the junk variable being used to raise
an inexact floating point exception.  The variable cannot be eliminated,
unfortunately, otherwise the desired addition triggering the exception
will be emitted neither by clang, nor by gcc.

Reviewed by:	Steve Kargl, bde
MFC after:	3 days
2017-05-13 22:36:54 +00:00
Pedro F. Giffuni
6002d46737 msun: Remove trailing space in Sunsoft copyright statement.
Submittedby:	kargl
2017-04-23 22:31:12 +00:00
Brooks Davis
d6aa8a03f2 Replace SOFTFLOAT with __mips_soft_float, which gcc/clang define for us.
D8376 extended softfloat/hardfloat support, but used a macro that never
actually gets set except in libc and msun's Makefile.inc.  So libc and libm
got built correctly, but any program including fenv.h itself assumed it was
on a hardfloat systen and emitted inline fpu instructions for
fedisableexcept() and friends.

Using __mips_soft_float makes everything work in all cases, since it's a
compiler-internal macro that is always set correctly for the target

PR:		217845
Submitted by:	Dan Nelson <dnelson_1901@yahoo.com>
MFC after:	1 week
2017-03-16 21:05:21 +00:00
Alan Somers
a55051c487 Document that the msun tests require WARNS=0
ATF tests have a default WARNS of 0, unlike other usermode programs.  This
change is technically a noop, but it documents that the msun tests don't
work with any warnings enabled, at least not on all architectures.

Reviewed by:  ngie
MFC after:    3 weeks
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933
2017-03-11 00:04:59 +00:00
Enji Cooper
6cddacd039 Expect :test_zero_input to fail on amd64
The clang 4.x+ upgrade now causes this testcase to fail, but
only on amd64.

More investigation will be done to determine the cause.

MFC after:	1 week
Reported by:	Jenkins
PR:		217528
Sponsored by:	Dell EMC Isilon
2017-03-09 06:58:47 +00:00
Enji Cooper
b97b0df681 Don't expect :test_large_inputs to fail with i386 anymore
Recent changes (maybe a side-effect of the ATF-ification in r314649)
invalidate the failure expectation.

PR:		205446
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-09 06:56:44 +00:00
Enji Cooper
abe427af75 Fix warnings in lib/msun/tests/... to help pave way for WARNS?= 6.
- Staticize variables.
- Use nitems liberally. Wherever nitems is used, use unsigned integers
- Remove unused variables (argc, argv, etc)

This fixes most issues -- some issues remain in logarithm_test though.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-04 10:07:46 +00:00
Enji Cooper
5c47281893 Convert lib/msun/ctrig_test from TAP to ATF
This is being done as a precursor for work needed to annontate failing
testcases with clang 4.0+.

MFC after:	1 week
PR:	217528
Sponsored by:	Dell EMC Isilon
2017-03-04 09:16:51 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Mahdi Mokhtari
1fdfb24aa7 Add documentations related to new APIs of r313761
PR:		216850 216851 216852 216856 216857 216858
Submitted by:	sgk@troutmask.apl.washington.edu
Reported by:	sgk@troutmask.apl.washington.edu
Reviewed by:	bde emaste hselasky
Approved by:	bde emaste hselasky
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-17 08:25:48 +00:00
Mahdi Mokhtari
a287735349 Fix building of r313761 on platforms that
`long double` is alias of `double` (MIPS, etc)

PR:		216850 216851 216852 216856 216857 216858
Reported by:	emsate
Reviewed by:	bde emaste hselasky
Approved by:	bde emaste hselasky
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-17 08:22:32 +00:00
Mahdi Mokhtari
a11c507775 Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.

PR:		216850 216851 216852 216856 216857 216858
Submitted by:	mmokhi
Reported by:	sgk@troutmask.apl.washington.edu
Reviewed by:	bde, mat, theraven
Approved by:	bde (src committer), mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-15 07:59:54 +00:00
Enji Cooper
87dc0e9bc9 Handle clang 4.x+ with the compile-time exception added in r312213
It also fails the assertions noted in bug 208703

PR:	208703
PR:	217084
Submitted by:	jbeich
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-14 00:54:48 +00:00
Enji Cooper
5bd43b0033 Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
of the clang version

This works around breakage on ^/stable/10 when running installworld from
a ^/stable/10 host where the test wouldn't be compiled on the first
go-around and would be missing when make installworld is run.

MFC after:	1 week
PR:		208703
Reported by:	emaste
Sponsored by:	Dell EMC Isilon
2017-01-15 09:05:26 +00:00
Enji Cooper
ee5d5813c0 fmaxmin_test still fails with clang 3.9.x.. bypass the test
MFC after:	3 days
PR:		208703
Sponsored by:	Dell EMC Isilon
2017-01-13 04:21:09 +00:00
Enji Cooper
cdebaff820 Upgrade NetBSD tests to 01.11.2017_23.20 snapshot
This contains some new testcases in /usr/tests/...:

- .../lib/libc
- .../lib/libthr
- .../lib/msun
- .../sys/kern

Tested on:	amd64, i386
MFC after:	1 month
2017-01-13 03:33:57 +00:00
Ed Maste
2737721014 libm: remove duplicate version script entries
These symbols already appear in the common lib/msun/Symbol.map.
Duplicate entries produce an error with LLVM's LLD linker.

Reviewed by:	br
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8627
2016-11-29 18:40:24 +00:00
Ruslan Bukin
7804dd5212 Add full softfloat and hardfloat support for RISC-V.
Hardfloat is now default (use riscv64sf as TARGET_ARCH
for softfloat).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8529
2016-11-16 15:21:32 +00:00
Ruslan Bukin
2ad1d09f16 o Add support for long double.
o Add support for latest RISC-V GNU toolchain.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-11-03 13:06:17 +00:00
Ed Maste
dba5d1ca17 libm: add braces around initialization of subobjects
This cleans up a warning when building libm at higher WARNS levels and
makes the intent more clear. By the C standard the values are assigned
to subobject members in order so this change introduces no functional
change. (6.7.9 20)

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8333
2016-11-01 15:11:10 +00:00
Ruslan Bukin
5bca221511 Add full softfloat and hardfloat support for MIPS.
This adds new target architectures for hardfloat:
mipselhf mipshf mips64elhf mips64hf.

Tested in QEMU only.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8376
2016-10-31 15:33:58 +00:00
Justin Hibbits
dc9b124d66 Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU.  The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive.  Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement.  setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).

Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.

Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.

Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used.  However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.

Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI.  Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.

Reviewed By:	bdrewery, imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
Ruslan Bukin
fae95359ee Don't use fmaxl/fminl on platforms with no long double support,
use fmax/fmin instead.

This fixes fmaxmin test failure on MIPS64.

Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8216
2016-10-11 20:31:59 +00:00
Ed Maste
a01a51a352 libm: remove unused variables
Sponsored by:	The FreeBSD Foundation
2016-10-05 17:04:58 +00:00
Ed Maste
cf825f93cc libm: remove unused variables for LDBL_MANT_DIG != 113
Sponsored by:	The FreeBSD Foundation
2016-09-30 20:20:07 +00:00
Ed Maste
d6e65178c6 libm: simplify i387 subdir logic with make's :S substitution 2016-09-28 17:44:03 +00:00
Ed Maste
dcdfa506cc libm: fix some unused variable (rcsid) and dangling else warnings
s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
WARNS setting.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8061
2016-09-28 14:48:34 +00:00
Bruce Evans
f776d19f07 Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
actually the amd64 version.
2016-09-04 15:08:14 +00:00
Bruce Evans
5432c3bec3 Disconnect the "optimized" asm variants of cos(), sin() and tan() from
the build on i386.  Leave them in the source tree for regression tests.

The asm functions were always much less accurate (by a factor of more
than 10**18 in the worst case).  They were faster on old CPUs.  But
with each new generation of CPUs they get relatively slower.  The
double precision C version's average advantage is about a factor of 2
on Haswell.

The asm functions were already intentionally avoided in float and long
double precision on i386 and in all precisions on amd64.  Float
precision and amd64 give larger advantages to the C version.  The long
double precision C code and compilers' understanding of long double
precision are not so good, so the i387 is still slightly faster for
long double precision, except for the unimportant subcase of huge args
where the sub-optimal C code now somehow beats the i387 by about a
factor of 2.
2016-09-04 14:12:19 +00:00
Bruce Evans
83e449a402 Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm
versions of fmodf() amd fmodl() on i387.

fmod is similar to remainder, and the C versions are 3 to 9 times
slower than the asm versions on x86 for both, but we had the strange
mixture of all 6 variants of remainder in asm and only 1 of 6
variants of fmod in asm.
2016-09-04 12:22:14 +00:00
Bruce Evans
a4c138885e Fix missing fmodl() on arches with 53-bit long doubles.
PR:		199422, 211965
MFC after:	1 week
2016-09-04 12:01:32 +00:00
Enji Cooper
637cce3a32 MFhead @ r305314 2016-09-03 00:50:18 +00:00
Enji Cooper
7a83ecc454 Skip :test_large on i386
More assertions are failing on ^/head now.

PR:	205446
Sponsored by:	EMC / Isilon Storage Division
2016-09-02 08:17:43 +00:00
Enji Cooper
09797f9dce Adjust CFLAGS for fmod_test so it can find isqemu.h
Sponsored by: EMC / Isilon Storage Division
2016-08-13 01:40:08 +00:00
Bryan Drewery
2af16ec8f2 Revert r298434 which should be fixed by r301287, r301394, and r301403.
PR:	208703, 208963
2016-08-08 17:59:59 +00:00
Edward Tomasz Napierala
b8f41779a2 Fix frexpl() declaration to not include the field name.
MFC after:	1 month
2016-06-09 20:49:26 +00:00
Warner Losh
2c0e9e2a09 Make armv6 hard float abi by default. Kill armv6hf.
Allow CPUTYPE=soft to build the current soft-float abi libraries.
Add UPDATING entry to announce this.

Approved by: re@ (gjb)
2016-05-18 06:01:18 +00:00
Enji Cooper
430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Pedro F. Giffuni
75f46cf6c8 lib: minor spelling fixes in comments.
No functional change.
2016-05-01 19:37:33 +00:00
Enji Cooper
ca3ce56474 Completely disable fmaxmin_test (follow up to r297952)
COMPILER_TYPE/COMPILER_VERSION doesn't get passed down properly at
buildworld/installworld with older build hosts

MFC after: never
PR: 208703, 208963
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division
2016-04-21 19:59:55 +00:00
Glen Barber
0edd2576c0 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-16 02:32:12 +00:00
Enji Cooper
47754aa240 Disable fmaxmin_test when compiling it with clang 3.8.0
The testcase always fails today due to how C11 7.6.1/2 is interpreted
with clang 3.8.0 when combined with "#pragma STDC FENV_ACCESS ON".

This testcase passes with clang <3.8.0 and gcc, so continue testing it
with those compiler combinations

More intelligent discussion on the issue is in the PR

MFC after: never
PR: 208703
Sponsored by: EMC / Isilon Storage Division
2016-04-14 04:40:31 +00:00
Glen Barber
a123f26e92 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-12 17:00:13 +00:00
Enji Cooper
306c3c4d90 Fix appending -O0 to CFLAGS
The previous method would completely nerf CFLAGS once bsd.progs.mk had
recursed into the per-PROG logic and make the CFLAGS for tap testcases
to -O0, instead of appending to CFLAGS for all of the tap testcases.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2016-04-11 21:15:48 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Bryan Drewery
59f6130d2a Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally.
Sponsored by:	EMC / Isilon Storage Division
2016-03-26 03:46:12 +00:00
Glen Barber
7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery
15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber
b655ec9752 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-06 04:13:17 +00:00
Dimitry Andric
82aa34e6fa Merge ^/head r296007 through r296368. 2016-03-03 23:15:46 +00:00
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Nathan Whitehorn
f0e6a4d318 Make FPSCR definition endian clean.
PR:		207526
Submitted by:	Simon Byrne
Obtained from:	Julia
MFC after:	1 month
2016-02-26 20:25:26 +00:00
Glen Barber
c389411c8a Remove libc, librtld_db, libthr packages, and further increase
the constraints on what needs to be installed in a specific to
maintain consistency during upgrades.

Create a new clibs package containing libraries that are needed
as a bare minimum for consistency.

With much help and input from:	kib
Sponsored by:	The FreeBSD Foundation
2016-02-05 21:01:08 +00:00
Glen Barber
a70cba9582 First pass through library packaging.
Sponsored by:	The FreeBSD Foundation
2016-02-04 21:16:35 +00:00
Glen Barber
43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Dimitry Andric
752d00608c Merge ^/head r294777 through r294960. 2016-01-27 22:52:20 +00:00
Ruslan Bukin
4bf1032a04 Add fenv.c for RISC-V. Copied from MIPS. 2016-01-26 14:40:41 +00:00
Andrew Turner
1637b1642d Disable building the csqrt_test test on arm64, it hits an assert in
llvm 3.8.
2016-01-11 21:29:36 +00:00
Enji Cooper
194b8d633f Use j instead of a hardcoded index (9) and increment it after
running the NaNs testcases

MFC after: 3 days
Pointyhat to: ngie
Sponsored by: EMC / Isilon Storage Division
2015-12-23 09:11:18 +00:00
Enji Cooper
8a7d0e8ce3 Integrate the remaining tools/regression/lib/msun testcases into the
FreeBSD test suite under lib/msun/tests

MFC after: 3 weeks
X-MFC with: r292328
Sponsored by: EMC / Isilon Storage Division
2015-12-20 05:06:44 +00:00
Enji Cooper
4dc607e7f2 Integrate a number of testcases from tools/regression/lib/msun
into the FreeBSD test suite

There's no functional change with these testcases; they're purposely
being left in TAP format for the time being

Other testcases which crash on amd64/i386 as-is have not been
integrated yet (they need to be retested on a later version of
CURRENT, as I haven't used i386 in some time)

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2015-12-16 09:11:11 +00:00
Ruslan Bukin
1fdcc5e5c0 Start support for the RISC-V 64-bit architecture developed by UC Berkeley.
RISC-V is a new ISA designed to support computer research and education, and
is now become a standard open architecture for industry implementations.

This is a minimal set of changes required to run 'make kernel-toolchain'
using external (GNU) toolchain.

The FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv.

Reviewed by:	andrew, bdrewery, emaste, imp
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4445
2015-12-11 22:55:23 +00:00
Bryan Drewery
3c89d6b0e3 Don't override LIB*DIR variables from src.libnames.mk.
In some cases switch to the LIB*SRCDIR value.

These recently were defined in r291327 and r291619.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 22:20:04 +00:00
Bryan Drewery
7b3ea376a2 META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.
This both avoids some dependencies on xinstall.host and allows
bootstrapping on older releases to work due to lack of at least 'install -l'
support.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:10:28 +00:00
Enji Cooper
fdb319ca66 Bump .Dd 2015-11-09 10:41:27 +00:00
Enji Cooper
6922f80018 Document powl(3)
PR: 191751
Sponsored by: EMC / Isilon Storage Division
2015-11-09 10:40:16 +00:00
Andrew Turner
2dac22dcf3 We have long double on arm64, and the tests pass so enable them.
Sponsored by:	ABT Systems Ltd
2015-10-31 10:16:44 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Dimitry Andric
a679d056de In libm's exp2(3), avoid left-shifting a negative integer, which is
undefined.  Replace it with the intended value, in a defined way.

Reviewed by:	bde
MFC after:	3 days
2015-08-09 10:00:13 +00:00
Baptiste Daroussin
59a046067a .ie is not supposed to be used in manpages
Submitted by:	carsten.kunze@arcor.de
2015-07-14 15:21:00 +00:00
Ian Lepore
cbc120b22c Fix compilation when the armv6 world is being compiled without hw floating
point support.  The fenv-vfp.c file overrides -mfloat-abi so it can use
floating point instructions if it detects support at runtime.  Make it also
override -mfpu in case the user has set -mfpu=none.
2015-06-24 18:29:34 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Tijl Coosemans
65c323f2ac Follow up to r284427: fix NaN mixing for ctanhf too. 2015-06-15 20:47:26 +00:00
Tijl Coosemans
68b433d790 - Change comments to be more consistent with s_ccosh.c and s_csinh.c.
- Fix a case where NaNs were not mixed correctly and signalling NaNs were
  not converted to quiet NaNs.
- Eliminate two negations from ctan(z).

In collaboration with:	bde
2015-06-15 20:40:44 +00:00
Tijl Coosemans
f0f050e0f9 Fix some exceptional cases where the sign of the result is unspecified
but must still satisfy csinh(conj(z)) == conj(csinh(z)) and csinh(-z) ==
-csinh(z).  This allows eliminating two negations from csin(z).

In collaboration with:	bde
2015-06-15 20:16:53 +00:00
Tijl Coosemans
db7548d040 Fix some exceptional cases where the sign of the result is unspecified
but must still satisfy ccosh(conj(z)) == conj(ccosh(z)) and ccosh(-z) ==
ccosh(z).

In collaboration with:	bde
2015-06-15 20:11:06 +00:00
Baptiste Daroussin
18b2ee82db Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
Baptiste Daroussin
4232f82668 Enforce overwritting SHLIBDIR
Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by:	many
2015-06-15 15:34:20 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
bd831db65c Misc fixes from projects/bmake
Differential Revision:       D2748
Reviewed by: brooks imp
2015-06-11 21:13:05 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Steve Kargl
5b3a5f8343 In r279493, the functions pzero[f](), qzero[f], pone[f](),
and qone[f]() were marked as __inline, but their forward
declarations were not updated.  Fix the forward declarations
to match the actual function declarations.

Requested by:	 bde
2015-05-17 16:27:06 +00:00
Warner Losh
c6b992ed3a The presence/absence of CPU features should be tested with
MACHINE_CPUARCH or MACHINE_ARCH, not MACHINE. The latter is for kernel
only things. Also, I think this should be unconditional since all our
architectures have long double support, but I don't have time to test
that thoroughly so just add a comment to that effect.
2015-04-28 14:14:06 +00:00
Enji Cooper
b18bade8c2 Remove per-architecture checks for enabling HAVE_FENV_H
The conditional came from NetBSD, where only select architectures have this
header/support

All architectures on FreeBSD have the necessary support though, so the
conditional's completely unnecessary

make tinderbox done on all architectures (including arm64, where the issue
occurred before) this time

X-MFC with: r282057, r282092
MFC after: 6 days
2015-04-27 18:01:52 +00:00
Andrew Turner
4e78be73ba Correct the spelling of MACHINE_CPUARCH, MACHINE_CPU is not set on arm64. 2015-04-27 13:57:39 +00:00
Enji Cooper
1119ece4d3 Build/install libc, librt, libthr, and msun NetBSD test suites on all
architectures

MFC after: 1 week
2015-04-27 06:49:27 +00:00
Baptiste Daroussin
0af928e203 mdoc: fix function declaration 2015-04-26 11:35:36 +00:00
Baptiste Daroussin
fbe7ee53da mdoc: remove empty line 2015-04-26 11:35:07 +00:00
Baptiste Daroussin
84413e5425 Remove end of line whitespace 2015-04-26 11:30:27 +00:00
Andrew Turner
f734628543 Add the fe* symbols to libm for arm64.
Sponsored by:	The FreeBSD Foundation
2015-03-31 19:07:28 +00:00
Ed Maste
58853f4fb9 Correct mrs_fpcr and mrs_fpsr macros in arm64 fenv.h
Submitted by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-03-30 16:42:08 +00:00
Andrew Turner
8daa81674e Start to import support for the AArch64 architecture from ARM. This change
only adds support for kernel-toolchain, however it is expected further
changes to add kernel and userland support will be committed as they are
reviewed.

As our copy of binutils is too old the devel/aarch64-binutils port needs
to be installed to pull in a linker.

To build either TARGET needs to be set to arm64, or TARGET_ARCH set to
aarch64. The latter is set so uname -p will return aarch64 as existing
third party software expects this.

Differential Revision:	https://reviews.freebsd.org/D2005
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-03-19 13:53:47 +00:00
Steve Kargl
186f620727 According to POSIX.1-2008, the Bessel functions of second kind
should raise a divide-by-zero floating point exception for x = +-0
and an invalid floating point exception for x < 0 including x = -Inf.
Update the code to raise the exception and update the documentation
with hopefully better description of the behavior.

Reviewed by:	bde (code only)
2015-03-10 17:10:54 +00:00