Commit Graph

497 Commits

Author SHA1 Message Date
Andi Kleen
8491ed6d70 Add adaptive elision to rwlocks
This patch relies on the C version of the rwlocks posted earlier.
With C rwlocks it is very straight forward to do adaptive elision
using TSX. It is based on the infrastructure added earlier
for mutexes, but uses its own elision macros. The macros
are fairly general purpose and could be used for other
elision purposes too.

This version is much cleaner than the earlier assembler based
version, and in particular implements adaptation which makes
it safer.

I changed the behavior slightly to not require any changes
in the test suite and fully conform to all expected
behaviors (generally at the cost of not eliding in
various situations). In particular this means the timedlock
variants are not elided.  Nested trylock aborts.
2014-06-13 13:15:28 -07:00
Roland McGrath
febf6cc58c Move SPARC public headers out of nptl/ 2014-06-12 15:04:34 -07:00
Roland McGrath
e26822463f Move SPARC code out of nptl/sysdeps/sparc/. 2014-06-12 14:33:59 -07:00
David S. Miller
6b4d7a909f Update Sparc ULPS.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2014-06-01 19:19:18 -07:00
Jose E. Marchesi
834caf06f3 Fix sparc memcpy data corruption when using niagara2 optimized routines.
* sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Add missing
	membar to avoid block loads/stores to overlap previous stores.
2014-05-17 14:09:55 -07:00
David S. Miller
5331255b6e Fix v9/64-bit strcmp when string ends in multiple zero bytes.
[BZ #16885]
	* sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when
	multiple zero bytes exist at the end of a string.
	Reported by Aurelien Jarno <aurelien@aurel32.net>

	* string/test-strcmp.c (check): Add explicit test for situations where
	there are multiple zero bytes after the first.
2014-05-01 12:15:06 -07:00
David S. Miller
4fa262fa9e Add round-mode context support to sparc.
* sysdeps/sparc/fpu/fenv_private.h (HAVE_RM_CTX): Define.
	(libc_feholdexcept_setround_sparc_ctx): New function.
	(libc_fesetenv_sparc_ctx): Likewise.
	(libc_feupdateenv_sparc_ctx): Likewise.
	(libc_feholdsetround_sparc_ctx): Likewise.
	(libc_feholdexcept_setround_ctx): Define.
	(libc_feholdexcept_setroundf_ctx): Likewise.
	(libc_feholdexcept_setroundl_ctx): Likewise.
	(libc_fesetenv_ctx): Likewise.
	(libc_fesetenvf_ctx): Likewise.
	(libc_fesetenvl_ctx): Likewise.
	(libc_feupdateenv_ctx): Likewise.
	(libc_feupdateenvf_ctx): Likewise.
	(libc_feupdateenvl_ctx): Likewise.
	(libc_feresetround_ctx): Likewise.
	(libc_feresetroundf_ctx): Likewise.
	(libc_feresetroundl_ctx): Likewise.
	(libc_feholdsetround_ctx): Likewise.
	(libc_feholdsetroundf_ctx): Likewise.
	(libc_feholdsetroundl_ctx): Likewise.
2014-04-30 15:14:58 -07:00
David S. Miller
8aa583c3e0 Fix some sparc -Wundef build warnings.
* sysdeps/sparc/bits/string.h (_STRING_ARCH_unaligned): Define to
	0.
2014-04-30 11:39:47 -07:00
David S. Miller
809bd45fa9 Regenerate sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2014-04-13 18:27:19 -07:00
Joseph Myers
e6b6a85705 Don't include individual test ulps in libm-test-ulps.
As recently discussed
<https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it
doesn't seem particularly useful for libm-test-ulps files to contain
huge amounts of data on ulps for individual tests; just the global
maximum observed ulps for each function, together with the
verification of exceptions, errno and special results such as
infinities and NaNs for each test, suffices to verify that a
function's behavior on the given test inputs is within the expected
accuracy.  Removing this data reduces source tree churn caused by
updates to these files when libm tests are added, and reduces the
frequency with which testsuite additions actually need libm-test-ulps
changes at all.

Accordingly, this patch removes that data, so that individual tests
get checked against the global bounds for the given function and only
generate an error if those are exceeded.  Tested x86_64 (including
verifying that if an ulps value is artificially reduced, the tests do
indeed fail as they should and "make regen-ulps" generates the
expected changes).

	* math/libm-test.inc (struct ulp_data): Don't refer to ulps for
	individual tests in comment.
	(libm-test-ulps.h): Don't refer to test_ulps in #include comment.
	(prev_max_error): New variable.
	(prev_real_max_error): Likewise.
	(prev_imag_max_error): Likewise.
	(compare_ulp_data): Don't refer to test names in comment.
	(find_test_ulps): Remove function.
	(find_function_ulps): Likewise.
	(find_complex_function_ulps): Likewise.
	(init_max_error): Take function name as argument.  Look up ulps
	for that function.
	(print_ulps): Remove function.
	(print_max_error): Use prev_max_error instead of calling
	find_function_ulps.
	(print_complex_max_error): Use prev_real_max_error and
	prev_imag_max_error instead of calling find_complex_function_ulps.
	(check_float_internal): Take max_ulp parameter instead of calling
	find_test_ulps.  Don't call print_ulps.
	(check_float): Update call to check_float_internal.
	(check_complex): Update calls to check_float_internal.
	(START): Pass argument to init_max_error.
	* math/gen-libm-test.pl (%results): Don't include "kind"
	information.
	(parse_ulps): Don't handle ulps of individual tests.
	(print_ulps_file): Likewise.
	(output_ulps): Likewise.
	* math/README.libm-test: Update.
	* manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of
	individual tests.
	* sysdeps/aarch64/libm-test-ulps: Remove individual test ulps.
	* sysdeps/alpha/fpu/libm-test-ulps: Likewise.
	* sysdeps/arm/libm-test-ulps: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/ia64/fpu/libm-test-ulps: Likewise.
	* sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise.
	* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise.
	* sysdeps/microblaze/libm-test-ulps: Likewise.
	* sysdeps/mips/mips32/libm-test-ulps: Likewise.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
	* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
	* sysdeps/s390/fpu/libm-test-ulps: Likewise.
	* sysdeps/sh/libm-test-ulps: Likewise.
	* sysdeps/sparc/fpu/libm-test-ulps: Likewise.
	* sysdeps/tile/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

	* sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
2014-03-05 15:02:38 +00:00
Adam Conrad
105fa38156 Allow sys/auxv.h to be used from the testsuite on powerpc and sparc.
elf/tst-auxv.c includes misc/sys/auxv.h, which ends up not actually
being included due to the guard overlap, and getauxval becomes an
implicit declaration and implicit pointer conversion which means, at
best, the test isn't actually testing what it thinks it is and, at
worst, it'll crash and burn on platforms where implict pointer
conversion is a Very Bad Thing.

	* sysdeps/powerpc/bits/hwcap.h: Allow _SYSDEPS_SYSDEP_H guard as a
	synonym for _SYS_AUXV_H to allow direct inclusion.
	* sysdeps/sparc/bits/hwcap.h: Likewise.
	* sysdeps/powerpc/sysdep.h: Define _SYSDEPS_SYSDEP_H instead of
	_SYS_AUXV_H so we can include sysdep.h and sys/auxv.h together.
	* sysdeps/sparc/sysdep.h: Likewise.
2014-02-21 00:24:03 -07:00
Joseph Myers
ace614b8a5 soft-fp: support after-rounding tininess detection.
IEEE 754-2008 defines two ways in which tiny results can be detected,
"before rounding" (based on the infinite-precision result) and "after
rounding" (based on the result when rounded to normal precision as if
the exponent range were unbounded).  All binary operations on an
architecture must use the same choice of how tininess is detected.

soft-fp has so far implemented only before-rounding tininess
detection.  This patch adds support for after-rounding tininess
detection.  A new macro _FP_TININESS_AFTER_ROUNDING is added that
sfp-machine.h must define (soft-fp is meant to be self-contained so
the existing tininess.h files aren't used here, though the information
going in sfp-machine.h has been taken from them).  The soft-fp macros
dealing with raising underflow exceptions then handle the cases where
the choice matters specially, rounding a copy of the input to the
appropriate precision to see if a value that's tiny before rounding
isn't tiny after rounding.

Tested for mips64 using GCC trunk (which now uses soft-fp on MIPS, so
supporting exceptions and rounding modes for long double where not
previously supported - this is the immediate motivation for doing this
patch now) together with (a) a patch to sysdeps/mips/math-tests.h to
enable exceptions / rounding modes tests for long double for GCC 4.9
and later, and (b) corresponding changes applied to libgcc's soft-fp
and sfp-machine.h files.  In the libgcc context this is also tested on
x86_64 (also an after-rounding architecture) with testcases for
__float128 that I intend to add to the GCC testsuite when updating
soft-fp there.

(To be clear: this patch does not fix any glibc bugs that were
user-visible in past releases, since after-rounding architectures
didn't use soft-fp in any affected case with support for
floating-point exceptions - so there is no corresponding Bugzilla bug.
Rather, it works together with the GCC changes to use soft-fp on MIPS
to allow previously absent long double functionality to work properly,
and allows soft-fp to be used in glibc on after-rounding architectures
in cases where it couldn't previously be used.)

	* soft-fp/op-common.h (_FP_DECL): Mark exponent as possibly
	unused.
	(_FP_PACK_SEMIRAW): Determine tininess based on rounding shifted
	value if _FP_TININESS_AFTER_ROUNDING and unrounded value is in
	subnormal range.
	(_FP_PACK_CANONICAL): Determine tininess based on rounding to
	normal precision if _FP_TININESS_AFTER_ROUNDING and unrounded
	value has largest subnormal exponent.
	* soft-fp/soft-fp.h [FP_NO_EXCEPTIONS]
	(_FP_TININESS_AFTER_ROUNDING): Undefine and redefine to 0.
	* sysdeps/aarch64/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): New macro.
	* sysdeps/alpha/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/arm/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
	Likewise.
	* sysdeps/mips/mips64/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/mips/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/powerpc/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/sh/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
	Likewise.
	* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
	(_FP_TININESS_AFTER_ROUNDING): Likewise.
	* sysdeps/tile/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
	Likewise.
2014-02-12 18:27:12 +00:00
Ondřej Bílka
a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
David S. Miller
ae2f53e1eb Adjust sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update for some 64-bit differences from
	32-bit.
2014-02-04 20:54:58 -08:00
David S. Miller
6e697ff746 Rebuild sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Regenerate.
2014-01-24 18:32:53 -08:00
Allan McRae
d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers
3c1c46a64a Fix dbl-64 e_sqrt.c for non-default rounding modes (bug 16271). 2013-11-28 16:50:38 +00:00
David S. Miller
7ddace62b0 Fix sparc 64-bit GMP ifunc resolution in static builds.
[BZ #16150]
	* sysdeps/sparc/sparc64/multiarch/add_n.S: Resolve to the correct generic
	symbol in the non-vis3 case in static builds.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/mul_1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/sub_n.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/submul_1.S: Likewise.
2013-11-12 12:48:01 -08:00
David S. Miller
8d6bb57c44 Fix build on pre-v9 32-bit Sparc.
We cannot use fnegd in this code, as fnegd was added in v9.
Only fnegs exists in v8 and earlier.

	[BZ #15985]
	* sysdeps/sparc/sparc32/fpu/s_fdim.S (__fdim): Do not use fnegd
	on pre-v9 cpus, use a fnegs+fmovs sequence instead.
2013-11-06 13:23:36 -08:00
Mike Frysinger
cb8a6dbd17 rename configure.in to configure.ac
Autoconf has been deprecating configure.in for quite a long time.
Rename all our configure.in and preconfigure.in files to .ac.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-10-30 17:32:08 +10:00
David S. Miller
3bf78b7174 Update sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-10-10 14:42:58 -07:00
Joseph Myers
2ae21ed2d2 soft-fp: fix negation NaN handling (bug 16034). 2013-10-10 11:38:56 +00:00
Carlos O'Donell
c61b4d41c9 BZ #15754: CVE-2013-4788
The pointer guard used for pointer mangling was not initialized for
static applications resulting in the security feature being disabled.
The pointer guard is now correctly initialized to a random value for
static applications. Existing static applications need to be
recompiled to take advantage of the fix.

The test tst-ptrguard1-static and tst-ptrguard1 add regression
coverage to ensure the pointer guards are sufficiently random
and initialized to a default value.
2013-09-23 00:52:09 -04:00
Ondřej Bílka
c0c3f78afb Fix typos. 2013-08-21 19:48:48 +02:00
David S. Miller
da2d62df77 Update Sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update ULPs to handle minor
	difference between 32-bit and 64-bit.
2013-07-20 16:47:28 -07:00
David S. Miller
c61f8513f7 Full from-scratch rebuild of sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Regenerate from scratch.
2013-07-07 22:15:36 -07:00
David S. Miller
3aaeeca7a9 Update sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-07-02 16:41:17 -07:00
Ryan S. Arnold
1ae8bfe07c Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type. 2013-06-28 16:50:48 -05:00
Ondrej Bilka
350635a59a Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
Joseph Myers
9c84384cc1 Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
Siddhesh Poyarekar
b937534868 Avoid crashing in LD_DEBUG when program name is unavailable
Resolves: #15465

The program name may be unavailable if the user application tampers
with argc and argv[].  Some parts of the dynamic linker caters for
this while others don't, so this patch consolidates the check and
fallback into a single macro and updates all users.
2013-05-29 21:34:12 +05:30
Joseph Myers
b50a71810b Don't include expected results in libm-test test names. 2013-05-22 11:49:36 +00:00
Joseph Myers
db62a90753 Handle sincos with generic libm-test logic. 2013-05-19 14:45:41 +00:00
Maciej W. Rozycki
2848b10585 MIPS: soft-fp NaN representation corrections
[BZ #15442] This adds support for the inverse interpretation of the
quiet bit of IEEE 754 floating-point NaN data that some processors
use.  This includes in particular MIPS architecture processors; the
payload used for the canonical qNaN encoding is updated accordingly
so as not to interfere with the quiet bit.
2013-05-16 23:33:55 +01:00
David S. Miller
781fd74820 Update Sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-05-14 15:44:29 -07:00
David S. Miller
d422395e31 Update Sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-05-02 12:25:28 -07:00
David S. Miller
eb66fd21bf Update sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-03-22 13:29:31 -07:00
Joseph Myers
bef0b50749 Move system-specific settings out of toplevel configure.in and config.make.in. 2013-03-20 22:37:06 +00:00
David S. Miller
cd18e90aa6 Update Sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-03-17 08:38:10 -07:00
Joseph Myers
daaa7713e9 Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
Joseph Myers
70d9946a44 Remove __ptrvalue, __bounded and __unbounded. 2013-02-13 23:30:40 +00:00
David S. Miller
c51ebd9c78 Add long-double sparc ULPs updates missing in previous commit. 2013-02-04 12:06:42 -08:00
David S. Miller
b83bbec4cc Update sparc ULPs after Joseph's casin fixes.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-02-04 10:31:18 -08:00
Joseph Myers
6277fdabc0 Remove CHECK_STRING, CHECK_STRING_NULL_OK and __ubp_memchr. 2013-02-04 16:29:39 +00:00
Joseph Myers
e782a927c2 Remove BOUNDED_N and BOUNDED_1. 2013-02-01 06:35:29 +00:00
David S. Miller
bae8e7f5ed Add a minor 'cas' atomic optimization on sparc.
* sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
	(__arch_compare_and_exchange_val_32_acq): Use %g0 as second
	argument of CAS if possible.
	* sysdeps/sparc/sparc64/bits/atomic.h
	(__arch_compare_and_exchange_val_32_acq): Likewise.
	(__arch_compare_and_exchange_val_64_acq): Likewise.
2013-01-23 11:27:24 -08:00
David S. Miller
7c1e01aabc Use libgcc unwinder for sparc backtraces, if available.
* sysdeps/sparc/backtrace.c: New file.
	* sysdeps/sparc/sparc32/backtrace.h: New file.
	* sysdeps/sparc/sparc32/sparcv9/backtrace.h: New file.
	* sysdeps/sparc/sparc64/backtrace.h: New file.
	* sysdeps/sparc/sparc64/backtrace.c: Delete.
	* sysdeps/sparc/Makefile (CFLAGS-backtrace.c): Add
	-funwind-tables.
2013-01-21 14:15:30 -08:00
David S. Miller
1dbaee3c12 Update sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-01-17 20:45:04 -08:00
David S. Miller
1aa6176780 Optimize trunc{,f} on sparc.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add vis3
	trunc{,f} to libm-sysdep_routes.
	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_trunc.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_truncf.S: New file.
2013-01-16 00:00:54 -08:00
David S. Miller
c42d5e9862 Optimize nearbyint{,f} on sparc.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add vis3
	nearbyint{,f} to libm-sysdep_routes.
	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S: New
	file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S: New
	file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_nearbyint.S: New file.
	* sysdeps/sparc/sparc64/fpu/s_nearbyintf.S: New file.
2013-01-15 20:59:54 -08:00