about summary refs log tree commit diff
path: root/sysdeps/powerpc
Commit message (Collapse)AuthorAgeFilesLines
...
* powerpc64: strrchr optimization for power8Rajalakshmi Srinivasaraghavan2017-04-185-1/+510
| | | | | | | P7 code is used for <=32B strings and for > 32B vectorized loops are used. This shows as an average 25% improvement depending on the position of search character. The performance is same for shorter strings. Tested on ppc64 and ppc64le.
* powerpc: Optimized strncat for POWER8Rajalakshmi Srinivasaraghavan2017-04-134-2/+40
| | | | | | | | | | | | | | | | | | With new optimized strnlen for POWER8 [1], this patch adds strncat for power8 to make use of optimized strlen and strnlen. This is faster than POWER7 current implementation for larger strings. Tested on powerpc64 and powerpc64le. [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00491.html * sysdeps/powerpc/powerpc64/multiarch/Makefile (sysdep_routines): Add strncat-power8. * sysdeps/powerpc/powerpc64/multiarch/strncat.c (strncat): Add __strncat_power8 to ifunc list. * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c (strncat): Add __strncat_power8 to list of strncat functions. * sysdeps/powerpc/powerpc64/multiarch/strncat-power8.c: New file.
* powerpc: refactor memcmp and memmove IFUNC.Wainer dos Santos Moschetta2017-04-116-52/+19
| | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
* powerpc: refactor memcpy and mempcpy IFUNC.Wainer dos Santos Moschetta2017-04-1114-119/+46
| | | | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/a2/memcpy.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
* powerpc: refactor memchr, memrchr, and rawmemchr IFUNC.Wainer dos Santos Moschetta2017-04-116-48/+21
| | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memchr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
* powerpc: refactor memset IFUNC.Wainer dos Santos Moschetta2017-04-1110-85/+32
| | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memset-power4.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memset-power6.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/memset.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
* powerpc: refactor strcasestr and strstr IFUNC.Wainer dos Santos Moschetta2017-04-114-34/+14
| | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S: Define the strcasestr implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define strstr implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/power7/strstr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
* powerpc: refactor strchr, strchrnul, and strrchr IFUNC.Wainer dos Santos Moschetta2017-04-1111-97/+44
| | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strchr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise. * sysdeps/powerpc/powerpc64/strchr.S: Likewise.
* powerpc: refactor strnlen and strlen IFUNC.Wainer dos Santos Moschetta2017-04-118-64/+28
| | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S: Define the strlen implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S: Define the strnlen implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/power7/strlen.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/strlen.S: Likewise.
* powerpc: refactor strcasecmp, strcmp, and strncmp IFUNC.Wainer dos Santos Moschetta2017-04-1119-171/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/power4/strncmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* powerpc: refactor stpcpy, stpncpy, strcpy, and strncpy IFUNC.Wainer dos Santos Moschetta2017-04-119-99/+39
| | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncpy.S: Set a default function name if not defined. * sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
* Consolidate pthreadtype.h placementConsolidate pthreadtype.h placementAdhemerval Zanella2017-04-101-0/+249
| | | | | | | | | | | | | | | | | | | | | This patch moves all arch specific pthreadtypes.h to a similar path for all architectures (sysdeps/unix/sysv/<arch>/bits). No functional or build change is expected. The idea is mainly to organize the header placement for all architectures. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). * sysdeps/unix/sysv/linux/x86/Implies: New file. * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ... * sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here. * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ... * sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here. * sysdeps/x86/bits/pthreadtypes.h: Move to ... * sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
* Build divdi3 only for architecture that required itAdhemerval Zanella2017-04-061-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in [1], divdi3 object is only exported in a handful ABIs (i386, m68k, powerpc32, s390-32, and ia64), however it is built for all current architectures regardless. This patch refact the make rules for this object to so only the aforementioned architectures that actually require it builds it. Also, to avoid internal PLT calls to the exported symbol from the module, glibc uses an internal header (symbol-hacks.h) which is unrequired (and in fact breaks the build for architectures that intend to get symbol definitions from libgcc.a). The patch also changes it to create its own header (divdi3-symbol-hacks.h) and adjust the architectures that require it accordingly. I checked the build/check (with run-built-tests=no) on the following architectures (which I think must cover all supported ABI/builds) using GCC 6.3: aarch64-linux-gnu alpha-linux-gnu arm-linux-gnueabihf hppa-linux-gnu ia64-linux-gnu m68k-linux-gnu microblaze-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips64-linux-gnu nios2-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 powerpc64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu s390-linux-gnu sh4-linux-gnu sh4-linux-gnu-soft sparc64-linux-gnu sparcv9-linux-gnu tilegx-linux-gnu tilegx-linux-gnu-32 tilepro-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32 i686-linux-gnu I only saw one regression on sparcv9-linux-gnu (extra PLT call to .udiv) which I address in next patch in the set. It also correctly build SH with GCC 7.0.1 (without any regression from c89721e25d). [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html * sysdeps/i386/symbol-hacks.h: New file. * sysdeps/m68k/symbol-hacks.h: New file. * sysdeps/powerpc/powerpc32/symbol-hacks.h: New file. * sysdeps/s390/s390-32/symbol-hacks.h: New file. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/wordsize-32/Makefile: Remove file. * sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ... * sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
* powerpc64: Add POWER8 strnlenWainer dos Santos Moschetta2017-04-055-5/+473
| | | | | | | | | | | | | | | | | | | | | | | | Added strnlen POWER8 otimized for long strings. It delivers same performance as POWER7 implementation for short strings. This takes advantage of reasonably performing unaligned loads and bit permutes to check the first 1-16 bytes until quadword aligned, then checks in 64 bytes strides until unsafe, then 16 bytes, truncating the count if need be. Likewise, the POWER7 code is recycled for less than 32 bytes strings. Tested on ppc64 and ppc64le. * sysdeps/powerpc/powerpc64/multiarch/Makefile (sysdep_routines): Add strnlen-power8. * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c (strnlen): Add __strnlen_power8 to list of strnlen functions. * sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S: New file. * sysdeps/powerpc/powerpc64/multiarch/strnlen.c (__strnlen): Add __strnlen_power8 to ifunc list. * sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.
* Miscellaneous low-risk changes preparing for _ISOMAC testsuite.Zack Weinberg2017-03-012-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are a grab bag of changes where the testsuite was using internal symbols of some variety, but this was straightforward to fix, and the fixed code should work with or without the change to compile the testsuite under _ISOMAC. Four of these are just more #include adjustments, but I want to highlight sysdeps/powerpc/fpu/tst-setcontext-fpscr.c, which appears to have been written before the advent of sys/auxv.h. I think a big chunk of this file could be replaced by a simple call to getauxval, but I'll let someone who actually has a powerpc machine to test on do that. dlfcn/tst-dladdr.c was including ldsodefs.h just so it could use DL_LOOKUP_ADDRESS to print an additional diagnostic; as requested by Carlos, I have removed this. math/test-misc.c was using #ifndef NO_LONG_DOUBLE, which is an internal configuration macro, to decide whether to do certain tests involving 'long double'. I changed the test to #if LDBL_MANT_DIG > DBL_MANT_DIG instead, which uses only public float.h macros and is equivalent on all supported platforms. (Note that NO_LONG_DOUBLE doesn't mean 'the compiler doesn't support long double', it means 'long double is the same as double'.) tst-writev.c has a configuration macro 'ARTIFICIAL_LIMIT' that the Makefiles are expected to define, and sysdeps/unix/sysv/linux/Makefile was using the internal __getpagesize in the definition; changed to sysconf(_SC_PAGESIZE) which is the POSIX equivalent. ia64-linux doesn't supply 'clone', only '__clone2', which is not defined in the public headers(!) All the other clone tests have local extern declarations of __clone2, but tst-clone.c doesn't; it was getting away with this because include/sched.h does declare __clone2. * nss/tst-cancel-getpwuid_r.c: Include nss.h. * string/strcasestr.c: No need to include config.h. * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include sys/auxv.h. Don't include sysdep.h. * sysdeps/powerpc/tst-set_ppr.c: Don't include dl-procinfo.h. * dlfcn/tst-dladdr.c: Don't include ldsodefs.h. Don't use DL_LOOKUP_ADDRESS. * math/test-misc.c: Instead of testing NO_LONG_DOUBLE, test whether LDBL_MANT_DIG is greater than DBL_MANT_DIG. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c): Use sysconf (_SC_PAGESIZE) instead of __getpagesize in definition of ARTIFICIAL_LIMIT. * sysdeps/unix/sysv/linux/tst-clone.c [__ia64__]: Add extern declaration of __clone2.
* Allow direct use of math_ldbl.h in testsuite.Zack Weinberg2017-02-251-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few 'long double'-related tests include math_private.h just for their variety of math_ldbl.h, which contains macros for assembling and disassembling the binary representation of 'long double'. math_ldbl.h insists on being included from math_private.h, but if we relax this restriction (and fix some portability sloppiness) we can use it directly and not have to expose all of math_private.h to the testsuite. * sysdeps/generic/math_private.h: Use __BIG_ENDIAN and __LITTLE_ENDIAN, not BIG_ENDIAN and LITTLE_ENDIAN. * sysdeps/generic/math_ldbl.h * sysdeps/ia64/fpu/math_ldbl.h * sysdeps/ieee754/ldbl-128/math_ldbl.h * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h * sysdeps/ieee754/ldbl-96/math_ldbl.h * sysdeps/powerpc/fpu/math_ldbl.h * sysdeps/x86_64/fpu/math_ldbl.h: Allow direct inclusion. Use uintNN_t instead of u_intNN_t. Use __BIG_ENDIAN and __LITTLE_ENDIAN, not BIG_ENDIAN and LITTLE_ENDIAN. Include endian.h and/or stdint.h if necessary. Add copyright notices. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_canonicalize_int): Don't use EXTRACT_WORDS64. * sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c * sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c: Include math_ldbl.h, not math_private.h.
* powerpc: Update powerpc-fpu libm-test-ulpsTulio Magno Quites Machado Filho2017-02-211-98/+106
| | | | * sysdeps/powerpc/fpu/libm-test-ulps: Update.
* powerpc: Add tests for __ppc_set_ppr_* functions.Wainer dos Santos Moschetta2017-02-212-0/+104
| | | | | | | | | | | | | The sys/platform/ppc.h header defines a class of __ppc_set_ppr functions used to set the Program Priority Register (PPR) in PowerPC. This patch implements test cases for these functions. Tested on ppc64le, ppc64, and ppc. * sysdeps/powerpc/tst-set_ppr.c: New file. Implement test cases for __ppc_set_ppr_* functions. * sysdeps/powerpc/Makefile ($(subdir),misc): Add tst-set_ppr in the list of tests.
* powerpc: Convert tests to the new support test-driverWainer dos Santos Moschetta2017-02-213-21/+8
| | | | | | | | | | | | | | | | Change the powerpc tests to use <support/test-driver.c>. Also replace some of pthread calls to its xpthread equivalent. Tested on ppc64le. * sysdeps/powerpc/test-get_hwcap.c: Use <support/test-driver.c> instead of test-skeleton.c. (do_test): Replaced pthread_create and pthread_join with xpthread_create and xpthread_join. Use TEST_VERIFY_EXIT macro. Removed unneeded status variable. * sysdeps/powerpc/test-gettimebase.c: Use <support/test-driver.c> instead of test-skeleton.c. * sysdeps/powerpc/tst-tlsopt-powerpc.c: Likewise.
* Update arm, mips, powerpc-nofpu libm-test-ulps.Joseph Myers2017-02-171-104/+112
| | | | | | | * sysdeps/arm/libm-test-ulps: Update. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
* powerpc: Use latest optimizations for internal function callsRajalakshmi Srinivasaraghavan2017-02-072-3/+3
| | | | | Some of the power8 strings optimizations are not updated to use the latest version of other string optimizations
* powerpc: Improve strcmp performance for shorter stringsRajalakshmi Srinivasaraghavan2017-02-072-44/+16
| | | | | | | | | | For strings >16B and <32B existing algorithm takes more time than default implementation when strings are placed closed to end of page. This is due to byte by byte access for handling page cross. This is improved by following >32B code path where the address is adjusted to aligned memory before doing load doubleword operation instead of loading bytes. Tested on powerpc64 and powerpc64le.
* Remove i686, x86_64, and powerpc strtok implementationsAdhemerval Zanella2017-02-062-250/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on comments on previous attempt to address BZ#16640 [1], the idea is not support invalid use of strtok (the original bug report proposal). This leader to a new strtok optimized strtok implementation [2]. The idea of this patch is to fix BZ#16640 to align all the implementations to a same contract. However, with newer strtok code it is better to get remove the old assembly ones instead of fix them. For x86 is a gain in all cases since the new implementation can potentially use sse2/sse42 implementation for strspn and strcspn. This shows a better performance on both i686 and x86_64 using the string benchtests. On powerpc64 the gains are mixed, where only for larger inputs or keys some gains are showns (based on benchtest it seems that it shows some gains for keys larger than 10 and inputs larger than 32). I would prefer to remove the optimized implementation based on first code simplicity and second because some more gain could be optimized using a better optimized strcspn/strspn code (as for x86). However if powerpc arch maintainers prefer I can send a v2 with the assembly code adjusted instead. Checked on x86_64-linux-gnu, i686-linux-gnu, and powerpc64le-linux-gnu. [BZ #16640] * sysdeps/i386/i686/strtok.S: Remove file. * sysdeps/i386/i686/strtok_r.S: Likewise. * sysdeps/i386/strtok.S: Likewise. * sysdeps/i386/strtok_r.S: Likewise. * sysdeps/powerpc/powerpc64/strtok.S: Likewise. * sysdeps/powerpc/powerpc64/strtok_r.S: Likewise. * sysdeps/x86_64/strtok.S: Likewise. * sysdeps/x86_64/strtok_r.S: Likewise. [1] https://sourceware.org/ml/libc-alpha/2016-10/msg00411.html [2] https://sourceware.org/ml/libc-alpha/2016-12/msg00461.html
* powerpc: Regenerate ULPsTulio Magno Quites Machado Filho2017-01-131-14/+14
| | | | | | | After this update, math/test-ildouble, math/test-ldouble and math/test-ldouble-finite pass on hard float, POWER < 7 builds. Tested on powerpc, powerpc64 and powerpc64le.
* Move wrappers to libm-compat-calls-autoGabriel F. T. Gomes2017-01-0412-15/+12
| | | | | | | | | | This commit moves one step towards the deprecation of wrappers that use _LIB_VERSION / matherr / __kernel_standard functionality, by adding the suffix '_compat' to their filenames and adjusting Makefiles and #includes accordingly. New template wrappers that do not use such functionality will be added by future patches and will be first used by the float128 wrappers.
* Remove duplicate strcat implementationsAdhemerval Zanella2017-01-034-36/+3
| | | | | | | | | | | | | | | | | Since commit 6e46de42fe16 default strcat implementation is essentially the same for specialized ia64 and powerpc ones. This patch removes the redundant implementation and adjust powerpc64 ifunc code to use the default one. Checked on powerpc32-linux-gnu (default and power4) and ia64-linux build and on powerpc64le-linux-gnu. * sysdeps/ia64/strcat.c: Remove file. * sysdeps/powerpc/strcat.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcat-power7.c: Use default C implementation. * sysdeps/powerpc/powerpc64/multiarch/strcat-power8.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcat-ppc64.c: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-01796-796/+796
|
* powerpc: Fix powerpc32/power7 memchr for large input sizesTulio Magno Quites Machado Filho2016-12-281-1/+10
| | | | | | | | | The same error fixed in commit b224637928e9fc04e3cef3e10d02ccf042d01584 happens in the 32-bit implementation of memchr for power7. This patch adopts the same solution, with a minimal change: it implements a saturated addition where overflows sets the maximum pointer size to UINTPTR_MAX.
* powerpc64: strchr/strchrnul optimization for power8Rajalakshmi Srinivasaraghavan2016-12-288-2/+483
| | | | | | | The P7 code is used for <=32B strings and for > 32B vectorized loops are used. This shows as an average 25% improvement depending on the position of search character. The performance is same for shorter strings. Tested on ppc64 and ppc64le.
* powerpc: Remove f{max,min}{f} assembly implementationsAdhemerval Zanella2016-12-278-176/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the powerpc assembly implementation of fmax/fmin. Based on benchtests, the assembly ones shows: $ ./testrun.sh benchtests/bench-fmax "fmax": { "": { "duration": 5.07586e+09, "iterations": 2.01676e+09, "max": 1350.39, "min": 2.073, "mean": 2.51684 }, "qNaN": { "duration": 5.09315e+09, "iterations": 8.4568e+08, "max": 2788, "min": 5.806, "mean": 6.02255 }, "sNaN": { "duration": 5.09073e+09, "iterations": 8.42316e+08, "max": 4215.84, "min": 5.737, "mean": 6.04373 } And $ ./testrun.sh benchtests/bench-fmin "fmin": { "": { "duration": 5.07711e+09, "iterations": 2.02982e+09, "max": 497.094, "min": 2.073, "mean": 2.50126 }, "qNaN": { "duration": 5.09134e+09, "iterations": 8.46968e+08, "max": 2255.14, "min": 5.807, "mean": 6.01125 }, "sNaN": { "duration": 5.09122e+09, "iterations": 8.4746e+08, "max": 1969.38, "min": 5.729, "mean": 6.00763 } } The default implementation (math/s_f{max.min}_template.c) shows slight better latency for all cases: $ ./testrun.sh benchtests/bench-fmax "fmax": { "": { "duration": 5.07044e+09, "iterations": 2.38695e+09, "max": 2048.58, "min": 2.073, "mean": 2.12423 }, "qNaN": { "duration": 5.09004e+09, "iterations": 9.45428e+08, "max": 3306.93, "min": 5.138, "mean": 5.38385 }, "sNaN": { "duration": 5.08458e+09, "iterations": 1.15959e+09, "max": 972.008, "min": 3.321, "mean": 4.3848 } } And: $ ./testrun.sh benchtests/bench-fmin "fmin": { "": { "duration": 5.06817e+09, "iterations": 2.3913e+09, "max": 1177.9, "min": 2.073, "mean": 2.11942 }, "qNaN": { "duration": 5.08857e+09, "iterations": 9.45656e+08, "max": 2658.83, "min": 5.09, "mean": 5.38099 }, "sNaN": { "duration": 5.08093e+09, "iterations": 1.16725e+09, "max": 1030.74, "min": 3.323, "mean": 4.3529 } } Both were run with GCC 5.4 (ubuntu 16 default installation) using default compiler flags on POWER8E 3.4GHz (powerpc64le-linux-gnu).
* Do not stack-protect ifunc resolvers [BZ #7065]Nick Alcock2016-12-261-0/+2
| | | | | | | | | | | When dynamically linking, ifunc resolvers are called before TLS is initialized, so they cannot be safely stack-protected. We avoid disabling stack-protection on large numbers of files by using __attribute__ ((__optimize__ ("-fno-stack-protector"))) to turn it off just for the resolvers themselves. (We provide the attribute even when statically linking, because we will later use it elsewhere too.)
* Fix powerpc64/power7 memchr for large input sizesAdhemerval Zanella2016-12-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | Current optimized powercp64/power7 memchr uses a strategy to check for p versus align(p+n) (where 'p' is the input char pointer and n the maximum size to check for the byte) without taking care for possible overflow on the pointer addition in case of large 'n'. It was triggered by 3038145ca23 where default rawmemchr (used to created ppc64 rawmemchr in ifunc selection) now uses memchr (p, c, (size_t)-1) on its implementation. This patch fixes it by implement a satured addition where overflows sets the maximum pointer size to UINTPTR_MAX. Checked on powerpc64le-linux-gnu. [BZ# 20971] * sysdeps/powerpc/powerpc64/power7/memchr.S (__memchr): Avoid overflow in pointer addition. * string/test-memchr.c (do_test): Add an argument to pass as the size on memchr. (test_main): Add check for SIZE_MAX.
* Fix powerpc fmax, fmin sNaN handling (bug 20947).Joseph Myers2016-12-152-2/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Various fmax and fmin function implementations mishandle sNaN arguments: (a) When both arguments are NaNs, the return value should be a qNaN, but sometimes it is an sNaN if at least one argument is an sNaN. (b) Under TS 18661-1 semantics, if either argument is an sNaN then the result should be a qNaN (whereas if one argument is a qNaN and the other is not a NaN, the result should be the non-NaN argument). Various implementations treat sNaNs like qNaNs here. This patch fixes the powerpc versions of these functions (shared by float and double, 32-bit and 64-bit). The structure of those versions is that all ordered cases are already handled before anything dealing with the case where the arguments are unordered; thus, this patch causes no change to the code executed in the common case (neither argument a NaN). Tested for powerpc (32-bit and 64-bit), together with tests to be added along with the x86_64 / x86 fixes. [BZ #20947] * sysdeps/powerpc/fpu/s_fmax.S (__fmax): Add the arguments when either is a signaling NaN. * sysdeps/powerpc/fpu/s_fmin.S (__fmin): Likewise.
* Refactor long double information into bits/long-double.h.Joseph Myers2016-12-141-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Information about whether the ABI of long double is the same as that of double is split between bits/mathdef.h and bits/wordsize.h. When the ABIs are the same, bits/mathdef.h defines __NO_LONG_DOUBLE_MATH. In addition, in the case where the same glibc binary supports both -mlong-double-64 and -mlong-double-128, bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with __NO_LONG_DOUBLE_MATH if this particular compilation is with -mlong-double-64. As part of the refactoring I proposed in <https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this patch puts all that information in a single header, bits/long-double.h. It is included from sys/cdefs.h alongside the include of bits/wordsize.h, so other headers generally do not need to include bits/long-double.h directly. Previously, various bits/mathdef.h headers and bits/wordsize.h headers had this long double information (including implicitly in some bits/mathdef.h headers through not having the defines present in the default version). After the patch, it's all in six bits/long-double.h headers. Furthermore, most of those new headers are not architecture-specific. Architectures with optional long double all use the ldbl-opt sysdeps directory, either in the order (ldbl-64-128, ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt). Thus a generic header for the case where long double = double, and headers in ldbl-128, ldbl-96 and ldbl-opt, suffices to cover every architecture except for cases where long double properties vary between different ABIs sharing a set of installed headers; fortunately all the ldbl-opt cases share a single compiler-predefined macro __LONG_DOUBLE_128__ that can be used to tell whether this compilation is -mlong-double-64 or -mlong-double-128. The two cases where a set of headers is shared between ABIs with different long double properties, MIPS (o32 has long double = double, other ABIs use ldbl-128) and SPARC (32-bit has optional long double, 64-bit has required long double), need their own bits/long-double.h headers. As with bits/wordsize.h, multiple-include protection for this header is generally implicit through the include guards on sys/cdefs.h, and multiple inclusion is harmless in any case. There is one subtlety: the header must not define __LONG_DOUBLE_MATH_OPTIONAL if __NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines __NO_LONG_DOUBLE_MATH itself before including system headers. Subject to keeping that working, it would be reasonable to move these macros from defined/undefined #ifdef to always-defined 1/0 #if semantics, but this patch does not attempt to do so, just rearranges where the macros are defined. After this patch, the only use of bits/mathdef.h is the alpha one for modifying complex function ABIs for old GCC. Thus, all versions of the header other than the default and alpha versions are removed, as is the include from math.h. Tested for x86_64 and x86. Also did compilation-only testing with build-many-glibcs.py. * bits/long-double.h: New file. * sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise. * sysdeps/mips/bits/long-double.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise. * math/Makefile (headers): Add bits/long-double.h. * misc/sys/cdefs.h: Include <bits/long-double.h>. * stdlib/strtold.c: Include <bits/long-double.h> instead of <bits/wordsize.h>. * bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. [!__NO_LONG_DOUBLE_MATH]: Remove conditional code. * math/math.h: Do not include <bits/mathdef.h>. * sysdeps/aarch64/bits/mathdef.h: Remove file. * sysdeps/alpha/bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. * sysdeps/ia64/bits/mathdef.h: Remove file. * sysdeps/m68k/m680x0/bits/mathdef.h: Likewise. * sysdeps/mips/bits/mathdef.h: Likewise. * sysdeps/powerpc/bits/mathdef.h: Likewise. * sysdeps/s390/bits/mathdef.h: Likewise. * sysdeps/sparc/bits/mathdef.h: Likewise. * sysdeps/x86/bits/mathdef.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Remove conditional code. * sysdeps/s390/s390-64/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise.
* powerpc: remove _dl_platform_string and _dl_powerpc_platformsAndreas Schwab2016-12-132-62/+11
|
* powerpc: strncmp optimization for power9Rajalakshmi Srinivasaraghavan2016-12-135-1/+422
| | | | | | | Vectorized loops are used for strings > 32B when compared to power8 optimization. Tested on power9 ppc64le simulator.
* Fix hypot sNaN handling (bug 20940).Joseph Myers2016-12-072-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 generally defines libm functions taking sNaN arguments to return qNaN and raise "invalid", even for the cases where a corresponding qNaN argument would not result in a qNaN return. This includes hypot with one argument being an infinity and the other being an sNaN. This patch duly fixes hypot implementatations in glibc (generic and powerpc) to ensure qNaN, computed by arithmetic on the arguments, is returned in that case. Various implementations do their checks for infinities and NaNs inline by manipulating the representations of the arguments. For simplicity, this patch just uses issignaling to check for sNaN arguments. This could be inlined like the existing code (with due care about reversed quiet NaN conventions, for implementations where that is relevant), but given that all these checks are in cases where it's already known at least one argument is not finite, which should be the uncommon case, that doesn't seem worthwhile unless performance issues are observed in practice. Tested for x86_64, x86, mips64 and powerpc. [BZ #20940] * sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Do not return Inf for arguments Inf and sNaN. * sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Likewise. * sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/powerpc/fpu/e_hypot.c (TEST_INF_NAN): Do not return Inf for arguments Inf and sNaN. When returning a NaN, compute it by arithmetic on the arguments. * sysdeps/powerpc/fpu/e_hypotf.c (TEST_INF_NAN): Likewise. * math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
* powerpc: Remove stpcpy internal clash with IFUNCAdhemerval Zanella2016-12-011-3/+3
| | | | | | | | | | | | | | | | | | | | | Commit c7debbdfacb redirected the internal strrch to default powerpc64 implementation by redefining the weak_alias at sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.c: #undef weak_alias #define weak_alias(name, aliasname) \ extern __typeof (__strrchr_ppc) aliasname \ __attribute__ ((weak, alias ("__strrchr_ppc"))); This creates a __GI_strchr alias that clashes with the IFUNC symbol in stprchr.os. There is not need to define the default version for internal version, since ifunc should work internally for powerpc64. This patch removes the weak_alias indirection. Checked on powerpc64le. * sysdeps/powerpc/powerpc64/multiarch/strrchr-ppc64.c (weak_alias): Remove redirection to __strrchr_ppc.
* powerpc: strcmp optimization for power9Rajalakshmi Srinivasaraghavan2016-12-015-1/+326
| | | | | | | Vectorized loops are used for strings > 32B when compared to power8 optimization. Tested on power9 ppc64le simulator.
* Refactor FP_ILOGB* out of bits/mathdef.h.Joseph Myers2016-12-011-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the refactoring of bits/mathdef.h, this patch stops it defining FP_ILOGB0 and FP_ILOGBNAN, moving the required information to a new header bits/fp-logb.h. There are only two possible values of each of those macros permitted by ISO C. TS 18661-1 adds corresponding macros for llogb, and their values are required to correspond to those of the ilogb macros in the obvious way. Thus two boolean values - for which the same choices are correct for most architectures - suffice to determine the value of all these macros, and by defining macros for those boolean values in bits/fp-logb.h we can then define the public FP_* macros in math.h and avoid the present duplication of the associated feature test macro logic. This patch duly moves to bits/fp-logb.h defining __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. Default definitions of those to 0 are correct for both architectures, while ia64, m68k and x86 get their own versions of bits/fp-logb.h to reflect their use of values different from the defaults. The patch renders many copies of bits/mathdef.h trivial (needed only to avoid the default __NO_LONG_DOUBLE_MATH). I'll revise <https://sourceware.org/ml/libc-alpha/2016-11/msg00865.html> accordingly so that it removes all bits/mathdef.h headers except the default one and the alpha one, and arranges for the header to be included only by complex.h as the only remaining use at that point will be for the alpha ABI issues there. Tested for x86_64 and x86. Also did compile-only testing with build-many-glibcs.py (using glibc sources from before the commit that introduced many build failures with undefined __GI___sigsetjmp). * bits/fp-logb.h: New file. * sysdeps/ia64/bits/fp-logb.h: Likewise. * sysdeps/m68k/m680x0/bits/fp-logb.h: Likewise. * sysdeps/x86/bits/fp-logb.h: Likewise. * math/Makefile (headers): Add bits/fp-logb.h. * math/math.h: Include <bits/fp-logb.h>. [__USE_ISOC99] (FP_ILOGB0): Define based on __FP_LOGB0_IS_MIN. [__USE_ISOC99] (FP_ILOGBNAN): Define based on __FP_LOGBNAN_IS_MIN. * bits/mathdef.h (FP_ILOGB0): Remove. (FP_ILOGBNAN): Likewise. * sysdeps/aarch64/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/alpha/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/ia64/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/m68k/m680x0/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/mips/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/powerpc/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/s390/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/sparc/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise. * sysdeps/x86/bits/mathdef.h (FP_ILOGB0): Likewise. (FP_ILOGBNAN): Likewise.
* powerpc: Remove stpcpy internal clash with IFUNCAdhemerval Zanella2016-11-301-3/+1
| | | | | | | | | | | | | | | | | | | | | Commit 142e0a99530 redirected the internal stpcpy to default powerpc64 implementation by redefining the weak_alias at sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: #undef weak_alias #define weak_alias(name, aliasname) \ extern __typeof (__stpcpy_ppc) aliasname \ __attribute__ ((weak, alias ("__stpcpy_ppc"))); This creates a __GI_stpcpy alias that clashes with the IFUNC symbol in stpcpy.os. There is not need to define the default version for internal version, since ifunc should work internally for powerpc64. This patch removes the weak_alias indirection. Checked on powerpc64le. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c (weak_alias): Remove redirection to __stpcpy_ppc.
* powerpc: Add hidden definition for __sigsetjmpFlorian Weimer2016-11-293-0/+13
| | | | | There already is a hidden prototype for __sigsetjmp, but the architecture-specific definition was missing.
* powerpc: Remove unintended __longjmp symbol from ABIFlorian Weimer2016-11-291-3/+1
| | | | | | | | The __longjmp symbol was left in accidentally. It is not exported through a Versions file, but through a .symver assembler directive. The corresponding exported symbol was removed from the non-fpu powerpc64 targets in commit 9b9ef823581ecee546653d6ac3fd335f7b79faca.
* Refactor FP_FAST_* into bits/fp-fast.h.Joseph Myers2016-11-292-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the refactoring of bits/mathdef.h, this patch moves the FP_FAST_* definitions into a new bits/fp-fast.h header. Currently this is only for FP_FAST_FMA*, but in future it would be the appropriate place for the FP_FAST_* macros from TS 18661-1 as well. The generic bits/mathdef.h header defines these macros based on whether the compiler defines __FP_FAST_*. Most architecture-specific headers, however, fail to do so, meaning that if the architecture (or some particular processors) does in fact have fused operations, and GCC knows to use them inline, the FP_FAST_* macros will still not be defined. By refactoring, this patch causes the generic version (based on __FP_FAST_*) to be used in more cases, and so the macro definitions to be more accurate. Architectures that already defined some or all of these macros other than based on the predefines have their own versions of fp-fast.h, which are arranged so they define FP_FAST_* if either the architecture-specific conditions are true or __FP_FAST_* are defined. After this refactoring, various bits/mathdef.h headers for architectures with long double = double are semantically identical to the generic version. The patch removes those headers that are redundant. (In fact two of the four removed were already redundant before this patch because they did use __FP_FAST_*.) Tested for x86_64 and x86, and compilation-only with build-many-glibcs.py. * bits/fp-fast.h: New file. * sysdeps/aarch64/bits/fp-fast.h: Likewise. * sysdeps/powerpc/bits/fp-fast.h: Likewise. * math/Makefile (headers): Add bits/fp-fast.h. * math/math.h: Include <bits/fp-fast.h>. * bits/mathdef.h (FP_FAST_FMA): Remove. (FP_FAST_FMAF): Likewise. (FP_FAST_FMAL): Likewise. * sysdeps/aarch64/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. * sysdeps/powerpc/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. * sysdeps/x86/bits/mathdef.h (FP_FAST_FMA): Likewise. (FP_FAST_FMAF): Likewise. (FP_FAST_FMAL): Likewise. * sysdeps/arm/bits/mathdef.h: Remove file. * sysdeps/hppa/fpu/bits/mathdef.h: Likewise. * sysdeps/sh/sh4/bits/mathdef.h: Likewise. * sysdeps/tile/bits/mathdef.h: Likewise.
* Remove cached PID/TID in cloneAdhemerval Zanella2016-11-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch remove the PID cache and usage in current GLIBC code. Current usage is mainly used a performance optimization to avoid the syscall, however it adds some issues: - The exposed clone syscall will try to set pid/tid to make the new thread somewhat compatible with current GLIBC assumptions. This cause a set of issue with new workloads and usecases (such as BZ#17214 and [1]) as well for new internal usage of clone to optimize other algorithms (such as clone plus CLONE_VM for posix_spawn, BZ#19957). - The caching complexity also added some bugs in the past [2] [3] and requires more effort of each port to handle such requirements (for both clone and vfork implementation). - Caching performance gain in mainly on getpid and some specific code paths. The getpid performance leverage is questionable [4], either by the idea of getpid being a hotspot as for the getpid implementation itself (if it is indeed a justifiable hotspot a vDSO symbol could let to a much more simpler solution). Other usage is mainly for non usual code paths, such as pthread cancellation signal and handling. For thread creation (on stack allocation) the code simplification in fact adds some performance gain due the no need of transverse the stack cache and invalidate each element pid. Other thread usages will require a direct getpid syscall, such as cancellation/setxid signal, thread cancellation, thread fail path (at create_thread), and thread signal (pthread_kill and pthread_sigqueue). However these are hardly usual hotspots and I think adding a syscall is justifiable. It also simplifies both the clone and vfork arch-specific implementation. And by review each fork implementation there are some discrepancies that this patch also solves: - microblaze clone/vfork does not set/reset the pid/tid field - hppa uses the default vfork implementation that fallback to fork. Since vfork is deprecated I do not think we should bother with it. The patch also removes the TID caching in clone. My understanding for such semantic is try provide some pthread usage after a user program issue clone directly (as done by thread creation with CLONE_PARENT_SETTID and pthread tid member). However, as stated before in multiple discussions threads, GLIBC provides clone syscalls without further supporting all this semantics. I ran a full make check on x86_64, x32, i686, armhf, aarch64, and powerpc64le. For sparc32, sparc64, and mips I ran the basic fork and vfork tests from posix/ folder (on a qemu system). So it would require further testing on alpha, hppa, ia64, m68k, nios2, s390, sh, and tile (I excluded microblaze because it is already implementing the patch semantic regarding clone/vfork). [1] https://codereview.chromium.org/800183004/ [2] https://sourceware.org/ml/libc-alpha/2006-07/msg00123.html [3] https://sourceware.org/bugzilla/show_bug.cgi?id=15368 [4] http://yarchive.net/comp/linux/getpid_caching.html * sysdeps/nptl/fork.c (__libc_fork): Remove pid cache setting. * nptl/allocatestack.c (allocate_stack): Likewise. (__reclaim_stacks): Likewise. (setxid_signal_thread): Obtain pid through syscall. * nptl/nptl-init.c (sigcancel_handler): Likewise. (sighandle_setxid): Likewise. * nptl/pthread_cancel.c (pthread_cancel): Likewise. * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise. * sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue): Likewise. * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise. * sysdeps/unix/sysv/linux/getpid.c: Remove file. * nptl/descr.h (struct pthread): Change comment about pid value. * nptl/pthread_getattr_np.c (pthread_getattr_np): Remove thread pid assert. * sysdeps/unix/sysv/linux/pthread-pids.h (__pthread_initialize_pids): Do not set pid value. * nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove thread pid cache check. * nptl_db/td_thr_validate.c (td_thr_validate): Likewise. * sysdeps/aarch64/nptl/tcb-offsets.sym: Remove pid offset. * sysdeps/alpha/nptl/tcb-offsets.sym: Likewise. * sysdeps/arm/nptl/tcb-offsets.sym: Likewise. * sysdeps/hppa/nptl/tcb-offsets.sym: Likewise. * sysdeps/i386/nptl/tcb-offsets.sym: Likewise. * sysdeps/ia64/nptl/tcb-offsets.sym: Likewise. * sysdeps/m68k/nptl/tcb-offsets.sym: Likewise. * sysdeps/microblaze/nptl/tcb-offsets.sym: Likewise. * sysdeps/mips/nptl/tcb-offsets.sym: Likewise. * sysdeps/nios2/nptl/tcb-offsets.sym: Likewise. * sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise. * sysdeps/s390/nptl/tcb-offsets.sym: Likewise. * sysdeps/sh/nptl/tcb-offsets.sym: Likewise. * sysdeps/sparc/nptl/tcb-offsets.sym: Likewise. * sysdeps/tile/nptl/tcb-offsets.sym: Likewise. * sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise. * sysdeps/unix/sysv/linux/aarch64/clone.S: Remove pid and tid caching. * sysdeps/unix/sysv/linux/alpha/clone.S: Likewise. * sysdeps/unix/sysv/linux/arm/clone.S: Likewise. * sysdeps/unix/sysv/linux/hppa/clone.S: Likewise. * sysdeps/unix/sysv/linux/i386/clone.S: Likewise. * sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise. * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. * sysdeps/unix/sysv/linux/nios2/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise. * sysdeps/unix/sysv/linux/sh/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/tile/clone.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/vfork.S: Remove pid set and reset. * sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise. * sysdeps/unix/sysv/linux/arm/vfork.S: Likewise. * sysdeps/unix/sysv/linux/i386/vfork.S: Likewise. * sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/m68k/clone.S: Likewise. * sysdeps/unix/sysv/linux/m68k/vfork.S: Likewise. * sysdeps/unix/sysv/linux/mips/vfork.S: Likewise. * sysdeps/unix/sysv/linux/nios2/vfork.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sh/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/tile/vfork.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise. * sysdeps/unix/sysv/linux/tst-clone2.c (f): Remove direct pthread struct access. (clone_test): Remove function. (do_test): Rewrite to take in consideration pid is not cached anymore.
* Refactor float_t, double_t information into bits/flt-eval-method.h.Joseph Myers2016-11-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present, definitions of float_t and double_t are split among many bits/mathdef.h headers. For all but three architectures, these types are float and double. Furthermore, if you assume __FLT_EVAL_METHOD__ to be defined, that provides a more generic way of determining the correct values of these typedefs. Defining these typedefs more generally based on __FLT_EVAL_METHOD__ was previously proposed by Paul Eggert in <https://sourceware.org/ml/libc-alpha/2012-02/msg00002.html>. This patch refactors things in the way I proposed in <https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>. A new header bits/flt-eval-method.h defines a single macro, __GLIBC_FLT_EVAL_METHOD, which is then used by math.h to define float_t and double_t. The default is based on __FLT_EVAL_METHOD__ (although actually a default to 0 would have the same effect for current ports, because ports where values other than 0 or 16 are possible all have their own headers). To avoid changing the existing semantics in any case, including for compilers not defining __FLT_EVAL_METHOD__, architecture-specific files are then added for m68k, s390, x86 which replicate the existing semantics. At least with __FLT_EVAL_METHOD__ values possible with GCC, there should be no change to the choices of float_t and double_t for any supported configuration. Architecture maintainer notes: * m68k: sysdeps/m68k/m680x0/bits/flt-eval-method.h always defines __GLIBC_FLT_EVAL_METHOD to 2 to replicate the existing logic. But actually GCC defines __FLT_EVAL_METHOD__ to 0 if TARGET_68040. It might make sense to make the header prefer to base things on __FLT_EVAL_METHOD__ if defined, like the x86 version, and so make the choices of these types more accurate (with a NEWS entry as for the other changes to these types on particular architectures). * s390: sysdeps/s390/bits/flt-eval-method.h always defines __GLIBC_FLT_EVAL_METHOD to 1 to replicate the existing logic. As previously discussed, it might make sense in coordination with GCC to eliminate the historic mistake, avoid excess precision in the -fexcess-precision=standard case and make the typedefs match (with a NEWS entry, again). Tested for x86-64 and x86. Also did compilation-only testing with build-many-glibcs.py. * bits/flt-eval-method.h: New file. * sysdeps/m68k/m680x0/bits/flt-eval-method.h: Likewise. * sysdeps/s390/bits/flt-eval-method.h: Likewise. * sysdeps/x86/bits/flt-eval-method.h: Likewise. * math/Makefile (headers): Add bits/flt-eval-method.h. * math/math.h: Include <bits/flt-eval-method.h>. [__USE_ISOC99] (float_t): Define based on __GLIBC_FLT_EVAL_METHOD. [__USE_ISOC99] (double_t): Likewise. * bits/mathdef.h (float_t): Remove. (double_t): Likewise. * sysdeps/aarch64/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/alpha/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/arm/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/hppa/fpu/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/ia64/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/m68k/m680x0/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/mips/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/powerpc/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/s390/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/sh/sh4/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/sparc/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/tile/bits/mathdef.h (float_t): Likewise. (double_t): Likewise. * sysdeps/x86/bits/mathdef.h (float_t): Likewise. (double_t): Likewise.
* Do not hardcode platform names in manual/libm-err-tab.pl (bug 14139).Joseph Myers2016-11-042-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | manual/libm-err-tab.pl hardcodes a list of names for particular platforms (mapping from sysdeps directory name to friendly name for the manual). This goes against the principle of keeping information about individual platforms in their corresponding sysdeps directory, and the list is also very out-of-date regarding supported platforms and their corresponding sysdeps directories. This patch fixes this by adding a libm-test-ulps-name file alongside each libm-test-ulps file. The script then gets the friendly name from that file, which is required to exist, so it no longer needs to allow for the mapping being missing. Tested for x86_64. [BZ #14139] * manual/libm-err-tab.pl (%pplatforms): Initialize to empty. (find_files): Obtain platform name from libm-test-ulps-name and store in %pplatforms. (canonicalize_platform): Remove. (print_platforms): Use $pplatforms directly. (by_platforms): Do not allow for platforms missing from %pplatforms. * sysdeps/aarch64/libm-test-ulps-name: New file. * sysdeps/alpha/fpu/libm-test-ulps-name: Likewise. * sysdeps/arm/libm-test-ulps-name: Likewise. * sysdeps/generic/libm-test-ulps-name: Likewise. * sysdeps/hppa/fpu/libm-test-ulps-name: Likewise. * sysdeps/i386/fpu/libm-test-ulps-name: Likewise. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name: Likewise. * sysdeps/ia64/fpu/libm-test-ulps-name: Likewise. * sysdeps/m68k/coldfire/fpu/libm-test-ulps-name: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps-name: Likewise. * sysdeps/microblaze/libm-test-ulps-name: Likewise. * sysdeps/mips/mips32/libm-test-ulps-name: Likewise. * sysdeps/mips/mips64/libm-test-ulps-name: Likewise. * sysdeps/nios2/libm-test-ulps-name: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps-name: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps-name: Likewise. * sysdeps/s390/fpu/libm-test-ulps-name: Likewise. * sysdeps/sh/libm-test-ulps-name: Likewise. * sysdeps/sparc/fpu/libm-test-ulps-name: Likewise. * sysdeps/tile/libm-test-ulps-name: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps-name: Likewise.
* Define wordsize.h macros everywhereSteve Ellcey2016-11-042-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * bits/wordsize.h: Add documentation. * sysdeps/aarch64/bits/wordsize.h : New file * sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update definitions. (SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check. * sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check with #if instead of #ifdef. * sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto. * sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG, __WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32): Add or change defines. * sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise. * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h: Likewise. * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise. * sysdeps/tile/tilegx/bits/wordsize.h: Likewise. * sysdeps/tile/tilepro/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise. * sysdeps/wordsize-32/bits/wordsize.h: Likewise. * sysdeps/wordsize-64/bits/wordsize.h: Likewise. * sysdeps/x86/bits/wordsize.h: Likewise.
* Document a behavior of an elided pthread_rwlock_unlockTulio Magno Quites Machado Filho2016-10-281-0/+3
| | | | | Explain that pthread_rwlock_unlock may crash if called on a lock not held by the current thread.
* Fix cmpli usage in power6 memset.Joseph Myers2016-10-252-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Building glibc for powerpc64 with recent (2.27.51.20161012) binutils, with multi-arch enabled, I get the error: ../sysdeps/powerpc/powerpc64/power6/memset.S: Assembler messages: ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (5 is not between 0 and 1) ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (128 is not between 0 and 31) ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: missing operand Indeed, cmpli is documented as a four-operand instruction, and looking at nearby code it seems likely cmpldi was intended. This patch fixes this powerpc64 code accordingly, and makes a corresponding change to the powerpc32 code. Tested for powerpc, powerpc64 and powerpc64le by Tulio Magno Quites Machado Filho * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi instead of cmpli. * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi instead of cmpli.