aboutsummaryrefslogtreecommitdiff
path: root/lib/msun/tests
Commit message (Collapse)AuthorAgeFilesLines
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* lib/msun: Cleanup after $FreeBSD$ removalSteve Kargl2024-01-281-1/+0
| | | | | | | Remove no longer needed explicit inclusion of sys/cdefs.h. PR: 276669 MFC after: 1 week
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2710-10/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1618-36/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* msun: Remove a double word in a source code commentGordon Bergling2022-09-041-1/+1
| | | | | | - s/the the/the/ MFC after: 3 days
* Fix failures in libm's lround_test after clang 12 importDimitry Andric2021-06-221-6/+1
| | | | | | | | | | | | | | | | | | | | | It turned out that the (type)DTYPE_MAX conversions at the top of s_lround.c are now emitted as cvtsi2sd instructions, at least on SSE capable CPUs. This caused the FE_INEXACT flag to always be set, at least for the double and float variants. Under clang 11, the whole INRANGE() comparisons were still optimized away, but this has "improved" in clang 12, due to stricter adherence to the -ffp-exception-behavior=maytrap compiler flag. To avoid run-time integer to float conversions, use static constants instead, so they are computed at compile time, and the INRANGE() statements are optimized away again, if applicable. While here, use an integer instead of a floating type to store the test results in lround_test.c, as this is more appropriate, and we can also drop the volatile hack. Reported by: arichardson MFC after: 3 days
* Allow lib/msun/logarithm_test to pass on ld128 platformsAlex Richardson2021-04-201-1/+17
| | | | | | | | | | | | For some reason the ld128 log1pl() implementation is less accurate than logl(), but does at least guarantee precision >= the ld80 implementation. Mark log1p_accuracy_tests as XFAIL for ld128 and increase the log1p tolerance to the ld80 equivalent in accuracy_tests to avoid losing test coverage for the other functions. PR: 253984 Reviewed By: ngie, dim Differential Revision: https://reviews.freebsd.org/D29039
* Remove XFAIL from tests/lib/msun/lround_test:mainAlex Richardson2021-04-151-1/+0
| | | | | | | This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c. PR: 205451 MFC after: 1 week
* Remove amd64 XFAIL from tests/lib/msun/fma_test:infinitiesAlex Richardson2021-04-151-4/+0
| | | | | | | This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c. PR: 205448 MFC after: 1 week
* lib/msun: Exclude ignored-pragmas from -WerrorAlex Richardson2021-04-151-0/+6
| | | | | | | | | | | | | | 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
* lib/msun/tests: Drop WARNS=6Alex Richardson2021-03-221-2/+0
| | | | | | This is the default already, so there is no need to override it. Reported by: kevans
* lib/msun/tests: Re-enable csqrt_test on AArch64Alex Richardson2021-03-221-4/+0
| | | | | | | | The LLVM bug was fixed a long time ago and with D29076 this test actually passes now. Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D29092
* Fix lib/msun/tests/csqrt_test on platforms with 128-bit long doubleAlex Richardson2021-03-221-9/+17
| | | | | | | | | | If long double has more than 64 mantissa bits, using uint64_t to hold the mantissa bits will truncate the value and result in test failures. To fix this problem use __uint128_t since all platforms that have __LDBL_MANT_DIG__ > 64 also have compiler support for 128-bit integers. Reviewed By: rlibby Differential Revision: https://reviews.freebsd.org/D29076
* Fix unused functions in invtrig_test.cAlex Richardson2021-03-221-2/+8
| | | | | | | | | | | | | | I only tested the WARNS=6 change on AArch64 and AMD64, but this file has unused functions for architectures with LDBL_PREC == 53. While touching this file change the LDBL_PREC == 53 checks to i386 checks. The long double tests should only be disabled for i386 (due to the rather odd rounding mode that it uses) not all architectures where long double is the same as double. PR: 205449 Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6") Reported by: Jenkins
* lib/msun/tests: Add more debug output to fenv_test.cAlex Richardson2021-03-222-2/+7
| | | | | Output a hex dump of the current fenv and the expected value to allow comparing them without having to resort to interactive use of GDB.
* lib/msun/tests: Skip fenv_test:masking if exceptions can't be trappedAlex Richardson2021-03-221-1/+21
| | | | | | | | | | | Some CPUs (e.g. AArch64 QEMU) cannot trap on floating point exceptions and therefore ignore the writes to the floating point control register inside feenableexcept(). If no exceptions are enabled after feenableexcept(FE_ALL_EXCEPT), we can assume that the CPU does not support exceptions and we can then skip the test. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D29095
* lib/msun: Allow building tests with WARNS=6Alex Richardson2021-03-221-1/+1
| | | | The only change needed is to mark a few variables as static.
* Improve test messages for msun testsAlex Richardson2021-03-2216-106/+102
| | | | | | | Also print the mismatched values when numbers compare not equal. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D29091
* Remove XFAILs from fmaxmin testAlex Richardson2021-03-221-19/+0
| | | | | | | | | These appears to have been resolved by compiling the test with -fno-builtin and/or using a newer compiler. PR: 208703 Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28884
* Convert the msun tests to ATFAlex Richardson2021-03-2222-846/+845
| | | | | | | | This provides better error messages that just an assertion failure and also makes it easier to mark individual tests as XFAIL. It was also helpful when coming up with D28786 and D28787. Differential Revision: https://reviews.freebsd.org/D28798
* Build lib/msun tests with compiler builtins disabledDimitry Andric2021-02-231-0/+4
| | | | | | | | | | This forces the compiler to emit calls to libm functions, instead of possibly substituting pre-calculated results at compile time, which should help to actually test those functions. Reviewed by: emaste, arichardson, ngie Differential Revision: https://reviews.freebsd.org/D28577 MFC after: 3 days
* lib/msun/ctrig_test: Print the mismatched values on failureAlex Richardson2021-02-231-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This test fails on aarch64 but debugging it is difficult without the results being printed. Now the failing AArch64 test prints: root@freebsd-aarch64:/nfsroot/usr/tests/lib/msun # kyua debug ctrig_test:test_nan_inputs *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctan)(_d) (0 + -1 I) != expected (-0 + -1 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctan fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctan)(_d) (0 + 1 I) != expected (-0 + 1 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctan fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctanf)(_d) (0 + -1 I) != expected (-0 + -1 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctanf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctanf)(_d) (0 + 1 I) != expected (-0 + 1 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctanf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanh)(_d) (1 + 0 I) != expected (1 + -0 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanh fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanhf)(_d) (1 + 0 I) != expected (1 + -0 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanhf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanh)(_d) (-1 + 0 I) != expected (-1 + -0 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanh fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanhf)(_d) (-1 + 0 I) != expected (-1 + -0 I) *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanhf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0 ctrig_test:test_nan_inputs -> failed: 16 checks failed; see output for more details Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28788
* Update libm tests from NetBSDAlex Richardson2021-02-221-0/+2
| | | | | | | | | I did this without a full vendor update since that would cause too many conflicts. Since these files now almost match the NetBSD sources the next git subtree merge should work just fine. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D28797
* msun: ctanh/ctanhf: Import fix from musl libcAlex Richardson2021-02-151-15/+8
| | | | | | | | | | | | | | | | | | | This applies musl commit b02eed9c4841913d690a2d0029737d72615384fe by Szabolcs Nagy and updates the tests accordingly. This also allows removing an XFAIL from the test. musl commit message: complex: fix ctanh(+-0+i*nan) and ctanh(+-0+-i*inf) These cases were incorrect in C11 as described by http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm PR: 217528 Reviewed By: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28578
* Fix incorrect hypotl(3) result with subnormal numbersDimitry Andric2021-02-101-0/+1
| | | | | | | | | | | This adjusts the factor used to scale the subnormal numbers, so it becomes the right value after adjusting its exponent. Thanks to Steve Kargl for finding the most elegant fix. Also enable the hypot tests, and add a test case for this bug. PR: 253313 MFC after: 1 week
* Fix lib/msun's ctrig_test/test_inf_inputs test case with clang >= 10Dimitry Andric2021-02-091-3/+0
| | | | | | | | | | This sprinkles a few strategic volatiles in an attempt to defeat clang's optimization interfering with the expected floating-point exception flags. Reported by: lwhsu PR: 244732 MFC after: 3 days
* Avoid double output in fenv_testAlex Richardson2021-01-291-0/+2
| | | | | | | | | This tests fork()s, so if there is still data in the stdout buffer on fork it will print it again in the child process. This was happening in the CheriBSD CI and caused the test to complain about malformed TAP output. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28397
* test_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()Alex Richardson2021-01-291-1/+1
| | | | | Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D28396
* Update comment missed in 83ff5d5d98cbcf9b66dccd70022358aec8918a14Alex Richardson2021-01-291-1/+1
| | | | Reported by: jrtc27
* Un-XFAIL two tests with Clang > 10Alex Richardson2021-01-281-1/+1
| | | | | | | | SVN r343917 fixed this for in-tree clang, but when building with a newer out-of-tree clang the test was still marked as XFAIL. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D28390
* msun tests: use standard floating-point exception flags on lrint and fenv testsAlfredo Dal'Ava Junior2020-11-182-9/+12
| | | | | | | | | | | | | | | Some platforms have additional architecture-specific floating-point flags. Msun test cases lrint and test_fegsetenv (fenv) expects only standard flags, so make sure to mask them appropriately. This makes test pass on PowerPC64. Reviewed by: jhibbits, ngie Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27202 Notes: svn path=/head/; revision=367811
* Don't explicitly specify c99 or gnu99 as the default is now gnu99.Xin LI2020-08-171-2/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=364292
* Enable long double tests on RISC-VMitchell Horne2020-06-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Some of the NetBSD contributed tests are gated behind the __HAVE_LONG_DOUBLE flag. This flag seems to be defined only for platforms whose long double is larger than their double. I could not find this explicitly documented anywhere, but it is implied by the definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the following assertion from the UBSAN code: #ifdef __HAVE_LONG_DOUBLE long double LD; ASSERT(sizeof(LD) > sizeof(uint64_t)); #endif RISC-V has 128-bit long doubles, so enable the tests on this platform, and update the comments to better explain the purpose of this flag. Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25419 Notes: svn path=/head/; revision=362576
* Temporarily skip 2 failing tests after llvm10 importLi-Wen Hsu2020-03-111-0/+3
| | | | | | | | PR: 244732 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=358887
* Unskip test cases from netbsd-tests by defining __HAVE_FENVLi-Wen Hsu2019-08-311-0/+2
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=351648
* Partially revert r271349, which disabled the msun cexp test #4 on i386.Dimitry Andric2019-06-011-11/+15
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=348500
* Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl andDimitry Andric2019-02-081-1/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=343917
* Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}Li-Wen Hsu2019-01-251-0/+4
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=343442
* Resolve conflicts between macros in fenv.h and ieeefp.hDimitry Andric2018-05-311-4/+0
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=334445
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* lib/msun: add more csqrt unit tests for precision and overflowRyan Libby2017-08-291-19/+100
| | | | | | | | | Reviewed by: bde Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323004
* Revert r321457Enji Cooper2017-08-261-5/+0
| | | | | | | | | | | It doesn't fail after ^/head@r322855 (the releng_50 clang merge). PR: 220989 MFC after: 2 months MFC with: r321369, r322855 Notes: svn path=/head/; revision=322921
* Re-add #endif accidentally deleted in r321484Enji Cooper2017-07-251-0/+1
| | | | | | | | MFC after: 1 month MFC with: r321455, r321484 Notes: svn path=/head/; revision=321486
* Only test ld_pi_odd with LDBL_MANT_DIG == 64 to fix the buildEnji Cooper2017-07-251-6/+1
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=321484
* Mask issues with duplicate definitions for __fnstcw, __fldenv, and __fldcw onEnji Cooper2017-07-251-0/+4
| | | | | | | | | i386 by ignoring -Wmacro-redefined. This is a bandaid until the code is fixed and will be reverted before MFC. Notes: svn path=/head/; revision=321483
* Mark :reduction as an expected failureEnji Cooper2017-07-251-0/+5
| | | | | | | | | | | | It fails with clang 5.0+. PR: 220989 MFC after: 2 months MFC with: r321369 Reported by: Jenkins Notes: svn path=/head/; revision=321457
* Convert lib/msun/trig_test from TAP to ATF formatEnji Cooper2017-07-252-69/+73
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=321456
* Raise WARNS to 1Enji Cooper2017-07-251-2/+2
| | | | | | | | | This will enable warnings with the msun tests. MFC after: 1 month Notes: svn path=/head/; revision=321455