about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* PowerPC LE strnlenAlan Modra2013-10-042-102/+115
| | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00098.html The existing strnlen code has a number of defects, so this patch is more than just adding little-endian support. The changes here are similar to those for memchr. * sysdeps/powerpc/powerpc64/power7/strnlen.S (strnlen): Add little-endian support. Remove unnecessary "are we done" tests. Handle "s" wrapping around zero and extremely large "size". Correct main loop count. Handle single left-over word from main loop inline rather than by using small_loop. Correct comments. Delete "zero" tail, use "end_max" instead. * sysdeps/powerpc/powerpc32/power7/strnlen.S: Likewise.
* PowerPC LE strlenAlan Modra2013-10-044-47/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00097.html This is the first of nine patches adding little-endian support to the existing optimised string and memory functions. I did spend some time with a power7 simulator looking at cycle by cycle behaviour for memchr, but most of these patches have not been run on cpu simulators to check that we are going as fast as possible. I'm sure PowerPC can do better. However, the little-endian support mostly leaves main loops unchanged, so I'm banking on previous authors having done a good job on big-endian.. As with most code you stare at long enough, I found some improvements for big-endian too. Little-endian support for strlen. Like most of the string functions, I leave the main word or multiple-word loops substantially unchanged, just needing to modify the tail. Removing the branch in the power7 functions is just a tidy. .align produces a branch anyway. Modifying regs in the non-power7 functions is to suit the new little-endian tail. * sysdeps/powerpc/powerpc64/power7/strlen.S (strlen): Add little-endian support. Don't branch over align. * sysdeps/powerpc/powerpc32/power7/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/strlen.S (strlen): Add little-endian support. Rearrange tmp reg use to suit. Comment. * sysdeps/powerpc/powerpc32/strlen.S: Likewise.
* PowerPC SIGSTKSZAlan Modra2013-10-041-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00093.html This copies the sparc version of sigstack.h, which gives powerpc #define MINSIGSTKSZ 4096 #define SIGSTKSZ 16384 Before the VSX changes, struct rt_sigframe size was 1920 plus 128 for __SIGNAL_FRAMESIZE giving ppc64 exactly the default MINSIGSTKSZ of 2048. After VSX, ucontext increased by 256 bytes. Oops, we're over MINSIGSTKSZ, so powerpc has been using the wrong value for quite a while. Add another ucontext for TM and rt_sigframe is now at 3872, giving actual MINSIGSTKSZ of 4000. The glibc testcase that I was looking at was tst-cancel21, which allocates 2*SIGSTKSZ (not because the test is trying to be conservative, but because the test actually has nested signal stack frames). We blew the allocation by 48 bytes when using current mainline gcc to compile glibc (le ppc64). The required stack depth in _dl_lookup_symbol_x from the top of the next signal frame was 10944 bytes. I guess you'd want to add 288 to that, implying an actual SIGSTKSZ of 11232. * sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h: New file.
* PowerPC makecontextAlan Modra2013-10-042-4/+10
| | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00092.html Use conditional form of branch and link to avoid destroying the cpu link stack used to predict blr return addresses. * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use conditional form of branch and link when obtaining pc. * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
* PowerPC LE _dl_hwcap accessAlan Modra2013-10-043-16/+16
| | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00091.html More LE support, correcting word accesses to _dl_hwcap. * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Use HIWORD/LOWORD. * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Ditto. * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Ditto.
* PowerPC ugly symbol versioningAlan Modra2013-10-049-29/+23
| | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00090.html This patch fixes symbol versioning in setjmp/longjmp. The existing code uses raw versions, which results in wrong symbol versioning when you want to build glibc with a base version of 2.19 for LE. Note that the merging the 64-bit and 32-bit versions in novmx-lonjmp.c and pt-longjmp.c doesn't result in GLIBC_2.0 versions for 64-bit, due to the base in shlib_versions. * sysdeps/powerpc/longjmp.c: Use proper symbol versioning macros. * sysdeps/powerpc/novmx-longjmp.c: Likewise. * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/bsd-setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/mcount.c: Likewise. * sysdeps/powerpc/powerpc32/setjmp.S: Likewise. * sysdeps/powerpc/powerpc64/setjmp.S: Likewise. * nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c: Likewise.
* PowerPC LE setjmp/longjmpAnton Blanchard2013-10-045-85/+78
| | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00089.html Little-endian fixes for setjmp/longjmp. When writing these I noticed the setjmp code corrupts the non volatile VMX registers when using an unaligned buffer. Anton fixed this, and also simplified it quite a bit. The current code uses boilerplate for the case where we want to store 16 bytes to an unaligned address. For that we have to do a read/modify/write of two aligned 16 byte quantities. In our case we are storing a bunch of back to back data (consective VMX registers), and only the start and end of the region need the read/modify/write. [BZ #15723] * sysdeps/powerpc/jmpbuf-offsets.h: Comment fix. * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Correct _dl_hwcap access for little-endian. * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise. Don't destroy vmx regs when saving unaligned. * sysdeps/powerpc/powerpc64/__longjmp-common.S: Correct CR load. * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise CR save. Don't destroy vmx regs when saving unaligned.
* PowerPC floating point little-endian [15 of 15]Alan Modra2013-10-041-12/+9
| | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00206.html The union loses when little-endian. * sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_NOW): Don't use a union to pack hi/low value.
* PowerPC floating point little-endian [14 of 15]Anton Blanchard2013-10-046-7/+19
| | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00205.html These all wrongly specified float constants in a 64-bit word. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Correct float constants for little-endian. * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
* PowerPC floating point little-endian [13 of 15]Alan Modra2013-10-042-13/+10
| | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00088.html * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Increase alignment of constants to usual value for .cst8 section, and remove redundant high address load. * sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Use float constant for 0x1p52. Load little-endian words of double from correct stack offsets.
* PowerPC floating point little-endian [12 of 15]Alan Modra2013-10-0419-38/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00087.html Fixes for little-endian in 32-bit assembly. * sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define. * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian words of double from correct stack offsets. * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_lround.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT. * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
* PowerPC floating point little-endian [11 of 15]Alan Modra2013-10-042-57/+62
| | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00202.html Another little-endian fix. * sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Rewrite using 64-bit int/double union. (_FPU_SETCW): Likewise. * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise. (_SET_DI_FPSCR, _GET_SI_FPSCR, _SET_SI_FPSCR): Likewise.
* PowerPC floating point little-endian [10 of 15]Alan Modra2013-10-042-34/+32
| | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00201.html These two functions oddly test x+1>0 when a double x is >= 0.0, and similarly when x is negative. I don't see the point of that since the test should always be true. I also don't see any need to convert x+1 to integer rather than simply using xr+1. Note that the standard allows these functions to return any value when the input is outside the range of long long, but it's not too hard to prevent xr+1 overflowing so that's what I've done. (With rounding mode FE_UPWARD, x+1 can be a lot more than what you might naively expect, but perhaps that situation was covered by the x - xrf < 1.0 test.) * sysdeps/powerpc/fpu/s_llround.c (__llround): Rewrite. * sysdeps/powerpc/fpu/s_llroundf.c (__llroundf): Rewrite.
* PowerPC floating point little-endian [9 of 15]Alan Modra2013-10-041-25/+29
| | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00200.html This works around the fact that vsx is disabled in current little-endian gcc. Also, float constants take 4 bytes in memory vs. 16 bytes for vector constants, and we don't need to write one lot of masks for double (register format) and another for float (mem format). * sysdeps/powerpc/fpu/s_float_bitwise.h (__float_and_test28): Don't use vector int constants. (__float_and_test24, __float_and8, __float_get_exp): Likewise.
* PowerPC floating point little-endian [8 of 15]Anton Blanchard2013-10-0414-40/+39
| | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00199.html Corrects floating-point environment code for little-endian. * sysdeps/powerpc/fpu/fenv_libc.h (fenv_union_t): Replace int array with long long. * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Adjust. * sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Adjust. * sysdeps/powerpc/fpu/fclrexcpt.c (__feclearexcept): Adjust. * sysdeps/powerpc/fpu/fedisblxcpt.c (fedisableexcept): Adjust. * sysdeps/powerpc/fpu/feenablxcpt.c (feenableexcept): Adjust. * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Adjust. * sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Adjust. * sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Adjust. * sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Adjust. * sysdeps/powerpc/fpu/fgetexcptflg.c (__fegetexceptflag): Adjust. * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Adjust. * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Adjust. * sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Adjust.
* PowerPC floating point little-endian [7 of 15]Anton Blanchard2013-10-041-12/+14
| | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00086.html * sysdeps/powerpc/bits/mathinline.h (__signbitf): Use builtin. (__signbit): Likewise. Correct for little-endian. (__signbitl): Call __signbit. (lrint): Correct for little-endian. (lrintf): Call lrint.
* PowerPC floating point little-endian [6 of 15]Alan Modra2013-10-041-28/+23
| | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00197.html A rewrite to make this code correct for little-endian. * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (mynumber): Replace union 32-bit int array member with 64-bit int array. (t515, tm256): Double rather than long double. (__ieee754_sqrtl): Rewrite using 64-bit arithmetic.
* PowerPC floating point little-endian [5 of 15]Alan Modra2013-10-042-56/+0
| | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00085.html Rid ourselves of ieee854. * sysdeps/ieee754/ldbl-128ibm/ieee754.h (union ieee854_long_double): Delete. (IEEE854_LONG_DOUBLE_BIAS): Delete. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Don't include ieee854 version of math_ldbl.h.
* PowerPC floating point little-endian [4 of 15]Alan Modra2013-10-044-134/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00084.html Another batch of ieee854 macros and union replacement. These four files also have bugs fixed with this patch. The fact that the two doubles in an IBM long double may have different signs means that negation and absolute value operations can't just twiddle one sign bit as you can with ieee864 style extended double. fmodl, remainderl, erfl and erfcl all had errors of this type. erfl also returned +1 for large magnitude negative input where it should return -1. The hypotl error is innocuous since the value adjusted twice is only used as a flag. The e_hypotl.c tests for large "a" and small "b" are mutually exclusive because we've already exited when x/y > 2**120. That allows some further small simplifications. [BZ #15734], [BZ #15735] * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite all uses of ieee875 long double macros and unions. Simplify test for 0.0L. Correct |x|<|y| and |x|=|y| test. Use ldbl_extract_mantissa value for ix,iy exponents. Properly normalize after ldbl_extract_mantissa, and don't add hidden bit already handled. Don't treat low word of ieee854 mantissa like low word of IBM long double and mask off bit when testing for zero. * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Rewrite all uses of ieee875 long double macros and unions. Simplify tests for 0.0L and inf. Correct double adjustment of k. Delete dead code adjusting ha,hb. Simplify code setting kld. Delete two600 and two1022, instead use their values. Recognise that tests for large "a" and small "b" are mutually exclusive. Rename vars. Comment. * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl): Rewrite all uses of ieee875 long double macros and unions. Simplify test for 0.0L and nan. Correct negation. * sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Rewrite all uses of ieee875 long double macros and unions. Correct output for large magnitude x. Correct absolute value calculation. (__erfcl): Likewise. * math/libm-test.inc: Add tests for errors discovered in IBM long double versions of fmodl, remainderl, erfl and erfcl.
* PowerPC floating point little-endian [3 of 15]Alan Modra2013-10-0422-240/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00083.html Further replacement of ieee854 macros and unions. These files also have some optimisations for comparison against 0.0L, infinity and nan. Since the ABI specifies that the high double of an IBM long double pair is the value rounded to double, a high double of 0.0 means the low double must also be 0.0. The ABI also says that infinity and nan are encoded in the high double, with the low double unspecified. This means that tests for 0.0L, +/-Infinity and +/-NaN need only check the high double. * sysdeps/ieee754/ldbl-128ibm/e_atan2l.c (__ieee754_atan2l): Rewrite all uses of ieee854 long double macros and unions. Simplify tests for long doubles that are fully specified by the high double. * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl): Likewise. Remove dead code too. * sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise. (__ieee754_ynl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise. Remove dead code too. * sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c (__isinf_nsl): Likewise. Simplify. * sysdeps/ieee754/ldbl-128ibm/s_isinfl.c (___isinfl): Likewise. Simplify. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Likewise. Comment on variable precision. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c (__scalblnl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (__scalbnl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Adjust tan_towardzero ulps.
* PowerPC floating point little-endian [2 of 15]Alan Modra2013-10-0426-89/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00082.html This patch replaces occurrences of GET_LDOUBLE_* and SET_LDOUBLE_* macros, and union ieee854_long_double_shape_type in ldbl-128ibm/, and a stray one in the 32-bit fpu support. These files have no significant changes apart from rewriting the long double bit access. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_high): Define. * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Rewrite all uses of ieee854 long double macros and unions. * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_coshl.c (__ieee754_coshl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise. Simplify sign and nan test too. * sysdeps/ieee754/ldbl-128ibm/s_cosl.c (__cosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_finitel.c (___finitel): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_isnanl.c (___isnanl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c (__issignalingl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c (___signbitl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_sincosl.c (__sincosl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_sinl.c (__sinl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_tanl.c (__tanl): Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c (__logbl): Likewise.
* PowerPC floating point little-endian [1 of 15]Alan Modra2013-10-044-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html This is the first of a series of patches to ban ieee854_long_double and the ieee854_long_double macros when using IBM long double. union ieee854_long_double just isn't correct for IBM long double, especially when little-endian, and pretending it is OK has allowed a number of bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/. This changes the few places in generic code that use it. * stdio-common/printf_size.c (__printf_size): Don't use union ieee854_long_double in fpnum union. * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use signbit macro to retrieve sign from long double. * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to retrieve sign from long double. * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. * sysdeps/x86_64/fpu/printf_fphex.c: Likewise. * math/test-misc.c (main): Don't use union ieee854_long_double. ports/ * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
* Fix for [BZ #15680] IBM long double inaccuracyAlan Modra2013-10-045-106/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-06/msg00919.html I discovered a number of places where denormals and other corner cases were being handled wrongly. - printf_fphex.c: Testing for the low double exponent being zero is unnecessary. If the difference in exponents is less than 53 then the high double exponent must be nearing the low end of its range, and the low double exponent hit rock bottom. - ldbl2mpn.c: A denormal (ie. exponent of zero) value is treated as if the exponent was one, so shift mantissa left by one. Code handling normalisation of the low double mantissa lacked a test for shift count greater than bits in type being shifted, and lacked anything to handle the case where the difference in exponents is less than 53 as in printf_fphex.c. - math_ldbl.h (ldbl_extract_mantissa): Same as above, but worse, with code testing for exponent > 1 for some reason, probably a typo for >= 1. - math_ldbl.h (ldbl_insert_mantissa): Round the high double as per mpn2ldbl.c (hi is odd or explicit mantissas non-zero) so that the number we return won't change when applying ldbl_canonicalize(). Add missing overflow checks and normalisation of high mantissa. Correct misleading comment: "The hidden bit of the lo mantissa is zero" is not always true as can be seen from the code rounding the hi mantissa. Also by inspection, lzcount can never be less than zero so remove that test. Lastly, masking bitfields to their widths can be left to the compiler. - mpn2ldbl.c: The overflow checks here on rounding of high double were just plain wrong. Incrementing the exponent must be accompanied by a shift right of the mantissa to keep the value unchanged. Above notes for ldbl_insert_mantissa are also relevant. [BZ #15680] * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix. * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c (PRINT_FPHEX_LONG_DOUBLE): Tidy code by moving -53 into ediff calculation. Remove unnecessary test for denormal exponent. * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c (__mpn_extract_long_double): Correct handling of denormals. Avoid undefined shift behaviour. Correct normalisation of low mantissa when low double is denormal. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_extract_mantissa): Likewise. Comment. Use uint64_t* for hi64. (ldbl_insert_mantissa): Make both hi64 and lo64 parms uint64_t. Correct normalisation of low mantissa. Test for overflow of high mantissa and normalise. (ldbl_nearbyint): Use more readable constant for two52. * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c (__mpn_construct_long_double): Fix test for overflow of high mantissa and correct normalisation. Avoid undefined shift.
* IBM long double mechanical changes to support little-endianAlan Modra2013-10-0410-184/+145
| | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html This patch starts the process of supporting powerpc64 little-endian long double in glibc. IBM long double is an array of two ieee doubles, so making union ibm_extended_long_double reflect this fact is the correct way to access fields of the doubles. * sysdeps/ieee754/ldbl-128ibm/ieee754.h (union ibm_extended_long_double): Define as an array of ieee754_double. (IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete. * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS. * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise. * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
* Properly cache the result from looking up the nss database configAndreas Schwab2013-09-301-8/+6
|
* tst-fanotify: fix styleMike Frysinger2013-09-281-8/+9
| | | | | Reported-by: Andreas Jaeger <aj@suse.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* don't use Bash-specific ${parameter/pattern/string} expansionPatrick 'P. J.' McDermott2013-09-282-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | sysdeps/unix/make-syscalls.sh and sysdeps/unix/Makefile use GNU Bash's ${parameter/pattern/string} parameter expansion. Non-Bash shells (e.g. dash or BusyBox ash when built with CONFIG_ASH_BASH_COMPAT disabled) don't support this expansion syntax. So glibc will fail to build when $(SHELL) expands to a path that isn't provided by Bash. An example build failure: for dir in [...]; do \ test -f $dir/syscalls.list && \ { sysdirs='[...]' \ asm_CPP='gcc -c -I[...] -D_LIBC_REENTRANT -include include/libc-symbols.h -DASSEMBLER -g -Wa,--noexecstack -E -x assembler-with-cpp' \ /bin/sh sysdeps/unix/make-syscalls.sh $dir || exit 1; }; \ test $dir = sysdeps/unix && break; \ done > [build-dir]/sysd-syscallsT sysdeps/unix/make-syscalls.sh: line 273: syntax error: bad substitution This patch simply replaces the three instances of the Bash-only syntax in these files with an echo and sed command substitution. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Add SH implementation of stackguard-macros.h.Kaz Kojima2013-09-271-0/+6
|
* Faster strrchr.Ondřej Bílka2013-09-266-943/+199
|
* PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64Adhemerval Zanella2013-09-251-1/+1
|
* sysdeps/mach/hurd/i386/tls.h: Remove TLS_INIT_TP_EXPENSIVE.Will Newton2013-09-241-1/+0
| | | | | | | | | | | This define was removed from the rest of the tree eight years ago. ChangeLog: 2013-09-24 Will Newton <will.newton@linaro.org> * sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): Remove macro.
* BZ #15754: Fix test case for ARM.Carlos O'Donell2013-09-231-1/+6
| | | | | | | Statically built binaries use __pointer_chk_guard_local, while dynamically built binaries use __pointer_chk_guard. Provide the right definition depending on the test case we are building.
* BZ #15754: CVE-2013-4788Carlos O'Donell2013-09-239-0/+67
| | | | | | | | | | | | 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.
* Make __ffs hiddenAndreas Schwab2013-09-205-0/+5
|
* Consolidate common code into macrosSiddhesh Poyarekar2013-09-191-74/+62
| | | | | Consolidated common Taylor series polynomials into macros in s_sin.c to make it a bit cleaner.
* Consolidate sin/cos table lookup codeSiddhesh Poyarekar2013-09-191-114/+35
|
* Consolidate sin/cos computation for large inputsSiddhesh Poyarekar2013-09-191-47/+36
|
* Remove redundant goto linesSiddhesh Poyarekar2013-09-191-40/+3
|
* MIPS: IEEE 754-2008 NaN encoding supportMaciej W. Rozycki2013-09-181-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has been a long practice for software using IEEE 754 floating-point arithmetic run on MIPS processors to use an encoding of Not-a-Number (NaN) data different to one used by software run on other processors. And as of IEEE 754-2008 revision [1] this encoding does not follow one recommended in the standard, as specified in section 6.2.1, where it is stated that quiet NaNs should have the first bit (d1) of their significand set to 1 while signalling NaNs should have that bit set to 0, but MIPS software interprets the two bits in the opposite manner. As from revision 3.50 [2][3] the MIPS Architecture provides for processors that support the IEEE 754-2008 preferred NaN encoding format. As the two formats (further referred to as "legacy NaN" and "2008 NaN") are incompatible to each other, tools have to provide support for the two formats to help people avoid using incompatible binary modules. The change is comprised of two functional groups of features, both of which are required for correct support. 1. Dynamic linker support. To enforce the NaN encoding requirement in dynamic linking a new ELF file header flag has been defined. This flag is set for 2008-NaN shared modules and executables and clear for legacy-NaN ones. The dynamic linker silently ignores any incompatible modules it encounters in dependency processing. To avoid unnecessary processing of incompatible modules in the presence of a shared module cache, a set of new cache flags has been defined to mark 2008-NaN modules for the three ABIs supported. Changes to sysdeps/unix/sysv/linux/mips/readelflib.c have been made following an earlier code quality suggestion made here: http://sourceware.org/ml/libc-ports/2009-03/msg00036.html and are therefore a little bit more extensive than the minimum required. Finally a new name has been defined for the dynamic linker so that 2008-NaN and legacy-NaN binaries can coexist on a single system that supports dual-mode operation and that a legacy dynamic linker that does not support verifying the 2008-NaN ELF file header flag is not chosen to interpret a 2008-NaN binary by accident. 2. Floating environment support. IEEE 754-2008 features are controlled in the Floating-Point Control and Status (FCSR) register and updates are needed to floating environment support so that the 2008-NaN flag is set correctly and the kernel default, inferred from the 2008-NaN ELF file header flag at the time an executable is loaded, respected. As the NaN encoding format is a property of GCC code generation that is both a user-selected GCC configuration default and can be overridden with GCC options, code that needs to know what NaN encoding standard it has been configured for checks for the __mips_nan2008 macro that is defined internally by GCC whenever the 2008-NaN mode has been selected. This mode is determined at the glibc configuration time and therefore a few consistency checks have been added to catch cases where compilation flags have been overridden by the user. The 2008 NaN set of features relies on kernel support as the in-kernel floating-point emulator needs to be aware of the NaN encoding used even on hard-float processors and configure the FPU context according to the value of the 2008 NaN ELF file header flag of the executable being started. As at this time work on kernel support is still in progress and the relevant changes have not made their way yet to linux.org master repository. Therefore the minimum version supported has been artificially set to 10.0.0 so that 2008-NaN code is not accidentally run on a Linux kernel that does not suppport it. It is anticipated that the version is adjusted later on to the actual initial linux.org kernel version to support this feature. Legacy NaN encoding support is unaffected, older kernel versions remain supported. [1] "IEEE Standard for Floating-Point Arithmetic", IEEE Computer Society, IEEE Std 754-2008, 29 August 2008 [2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the MIPS32 Architecture", MIPS Technologies, Inc., Document Number: MD00082, Revision 3.50, September 20, 2012 [3] "MIPS Architecture For Programmers, Volume I-A: Introduction to the MIPS64 Architecture", MIPS Technologies, Inc., Document Number: MD00083, Revision 3.50, September 20, 2012
* e500 port: fpu_control.h.Joseph Myers2013-09-181-1/+38
|
* e500 port: setjmp/longjmp.Joseph Myers2013-09-182-36/+47
|
* Don't force -msoft-float for powerpc --without-fp.Joseph Myers2013-09-181-5/+0
|
* Format sincos32.cSiddhesh Poyarekar2013-09-181-236/+254
|
* Fix powerpc fpu_control.h namespace and parenthesis issues (bug 15966).Joseph Myers2013-09-171-12/+12
|
* Faster strchr implementation.Ondřej Bílka2013-09-114-200/+160
|
* Update powerpc-fpu ULPs.Adhemerval Zanella2013-09-111-2/+63
|
* Add O_TMPFILE to <fcntl.h>Andreas Schwab2013-09-112-0/+5
|
* Remove DO_NOT_USE_THIS conditionals.Ondřej Bílka2013-09-105-97/+0
|
* Coordinate IPv6 definitions for Linux and glibcCarlos O'Donell2013-09-061-0/+12
| | | | | | | | | | This change synchronizes the glibc headers with the Linux kernel headers and arranges to coordinate the definition of structures already defined the Linux kernel UAPI headers. It is now safe to include glibc's netinet/in.h or Linux's linux/in6.h in any order in a userspace application and you will get the same ABI. The ABI is guaranteed by UAPI and glibc.
* PowerPC: fix POWER7 memrchr for some large inputsAdhemerval Zanella2013-09-052-4/+4
|