Author: adconrad Date: 2015-03-23 09:15:47 +0000 (Mon, 23 Mar 2015) New Revision: 6432
Added: glibc-package/branches/glibc-2.21/debian/patches/any/cvs-localplt-new-readelf.diff glibc-package/branches/glibc-2.21/debian/patches/any/cvs-logbl-accuracy.diff glibc-package/branches/glibc-2.21/debian/patches/any/cvs-make-typo.diff glibc-package/branches/glibc-2.21/debian/patches/any/local-math-logb.diff glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-arm-sfi_breg.diff glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-memcpy-memmove-always-bx.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-power7-strncpy.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-feraiseexcept.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-pow.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrt.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrtf.diff glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-tabort-le.diff Removed: glibc-package/branches/glibc-2.21/debian/patches/powerpc/local-math-logb.diff Modified: glibc-package/branches/glibc-2.21/debian/changelog glibc-package/branches/glibc-2.21/debian/patches/any/local-disable-test-tgmath2.diff glibc-package/branches/glibc-2.21/debian/patches/any/submitted-longdouble.diff glibc-package/branches/glibc-2.21/debian/patches/series Log: * debian/patches/powerpc/cvs-ppc-sqrt.diff: Fix sqrt() on powerpc. * debian/patches/powerpc/cvs-ppc-sqrtf.diff: Likewise for sqrtf(). * debian/patches/powerpc/cvs-ppc-pow.diff: Likewise for pow(). * debian/patches/powerpc/cvs-ppc-feraiseexcept.diff: Fix inline feraiseexcept and feclearexcept macro input conversion on PPC. * debian/patches/any/submitted-longdouble.diff: Refresh for above. * debian/patches/any/local-disable-test-tgmath2.diff: Likewise. * debian/patches/any/cvs-logbl-accuracy.diff: Fix ldbl-128ibm logbl. * debian/patches/powerpc/local-math-logb.diff: Refresh and move to debian/patches/any/local-math-logb.diff, as it's not PPC-specific. * debian/patches/any/cvs-localplt-new-readelf.diff: Preemptively fix localplt test breakage with binutils 2.26 before it lands. * debian/patches/any/cvs-make-typo.diff: Fix typo in elf/Makefile. * debian/patches/powerpc/cvs-power7-strncpy.diff: Optimize strncpy for POWER7 drastically (10-70%) on strings longer than 16 chars. * debian/patches/powerpc/cvs-ppc-tabort-le.diff: Fix TABORT encoding when building on toolchains without HTM support (no-op on gcc-4.9) * debian/patches/arm/cvs-arm-sfi_breg.diff: Fix LDR_GLOBAL macro. * debian/patches/arm/cvs-memcpy-memmove-always-bx.diff: Fix memcpy and memmove for the ARM_ALWAYS_BX class of hardware like ArmadaXP. Modified: glibc-package/branches/glibc-2.21/debian/changelog =================================================================== --- glibc-package/branches/glibc-2.21/debian/changelog 2015-03-23 02:21:01 UTC (rev 6431) +++ glibc-package/branches/glibc-2.21/debian/changelog 2015-03-23 09:15:47 UTC (rev 6432) @@ -52,6 +52,26 @@ leverage the same trick to decide to install usr/lib/pt_chown too. * debian/patches/kfreebsd/local-no-pldd.diff: Drop, no longer used. * debian/patches/alpha/submitted-PTR_MANGLE.diff: Use IS_IN macros. + * debian/patches/powerpc/cvs-ppc-sqrt.diff: Fix sqrt() on powerpc. + * debian/patches/powerpc/cvs-ppc-sqrtf.diff: Likewise for sqrtf(). + * debian/patches/powerpc/cvs-ppc-pow.diff: Likewise for pow(). + * debian/patches/powerpc/cvs-ppc-feraiseexcept.diff: Fix inline + feraiseexcept and feclearexcept macro input conversion on PPC. + * debian/patches/any/submitted-longdouble.diff: Refresh for above. + * debian/patches/any/local-disable-test-tgmath2.diff: Likewise. + * debian/patches/any/cvs-logbl-accuracy.diff: Fix ldbl-128ibm logbl. + * debian/patches/powerpc/local-math-logb.diff: Refresh and move to + debian/patches/any/local-math-logb.diff, as it's not PPC-specific. + * debian/patches/any/cvs-localplt-new-readelf.diff: Preemptively + fix localplt test breakage with binutils 2.26 before it lands. + * debian/patches/any/cvs-make-typo.diff: Fix typo in elf/Makefile. + * debian/patches/powerpc/cvs-power7-strncpy.diff: Optimize strncpy + for POWER7 drastically (10-70%) on strings longer than 16 chars. + * debian/patches/powerpc/cvs-ppc-tabort-le.diff: Fix TABORT encoding + when building on toolchains without HTM support (no-op on gcc-4.9) + * debian/patches/arm/cvs-arm-sfi_breg.diff: Fix LDR_GLOBAL macro. + * debian/patches/arm/cvs-memcpy-memmove-always-bx.diff: Fix memcpy + and memmove for the ARM_ALWAYS_BX class of hardware like ArmadaXP. [ Aurelien Jarno ] * debian/patches/any/local-libgcc-compat-main.diff: Fix definition of Added: glibc-package/branches/glibc-2.21/debian/patches/any/cvs-localplt-new-readelf.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/cvs-localplt-new-readelf.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/any/cvs-localplt-new-readelf.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,31 @@ +commit a0af371c25ac1f215cf0db64e54cbb9a1b51f78c +Author: Alan Modra <amo...@gmail.com> +Date: Fri Feb 20 15:23:28 2015 +1030 + + Fix localplt test breakage with new readelf + + Since 2014-11-24 binutils git commit bb4d2ac2, readelf has appended + the symbol version to symbols shown in reloc dumps. + + [BZ #16512] + * scripts/localplt.awk: Strip off symbol version. + * NEWS: Mention bug fix. + +diff --git a/scripts/localplt.awk b/scripts/localplt.awk +index f55c41a..84c94d1 100644 +--- a/scripts/localplt.awk ++++ b/scripts/localplt.awk +@@ -35,11 +35,11 @@ in_relocs && relocs_offset == jmprel_offset && NF >= 5 { + # Relocations against GNU_IFUNC symbols are not shown as an hexadecimal + # value, but rather as the resolver symbol followed by (). + if ($4 ~ /\(\)/) { +- print whatfile, $5 ++ print whatfile, gensub(/@.*/, "", "g", $5) + } else { + symval = strtonum("0x" $4); + if (symval != 0) +- print whatfile, $5 ++ print whatfile, gensub(/@.*/, "", "g", $5) + } + } + Added: glibc-package/branches/glibc-2.21/debian/patches/any/cvs-logbl-accuracy.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/cvs-logbl-accuracy.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/any/cvs-logbl-accuracy.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,74 @@ +commit 380bd0fd2418f8988217de950f8b8ff18af0cb2b +Author: Joseph Myers <jos...@codesourcery.com> +Date: Thu Feb 26 15:13:22 2015 +0000 + + Fix ldbl-128ibm logbl near powers of 2 (bug 18030). + + The ldbl-128ibm implementation of logbl produces incorrect results + when the high part of the argument is a power of 2 and the low part a + nonzero number with the opposite sign (and so the returned exponent + should be 1 less than that of the high part). For example, logbl + (0x1.ffffffffffffffp1L) returns 2 but should return 1. (This is + similar to (fixed) bug 16740 for frexpl, and (fixed) bug 18029 for + ilogbl.) This patch adds checks for that case. + + Tested for powerpc. + + [BZ #18030] + * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Adjust exponent + of power of 2 down when low part has opposite sign. + * math/libm-test.inc (logb_test_data): Add more tests. + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index 6045764..7acd29b 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -7868,6 +7868,11 @@ static const struct test_f_f_data logb_test_data[] = + TEST_f_f (logb, 0x1p-16400L, -16400, NO_INEXACT_EXCEPTION), + TEST_f_f (logb, 0x.00000000001p-16382L, -16426, NO_INEXACT_EXCEPTION), + #endif ++ ++#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 57 ++ TEST_f_f (logb, 0x1.ffffffffffffffp1L, 1, NO_INEXACT_EXCEPTION), ++ TEST_f_f (logb, -0x1.ffffffffffffffp1L, 1, NO_INEXACT_EXCEPTION), ++#endif + }; + + static void +diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +index dbd3478..22e5fc2 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c ++++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +@@ -26,11 +26,12 @@ + long double + __logbl (long double x) + { +- int64_t hx, rhx; +- double xhi; ++ int64_t hx, hxs, rhx; ++ double xhi, xlo; + +- xhi = ldbl_high (x); ++ ldbl_unpack (x, &xhi, &xlo); + EXTRACT_WORDS64 (hx, xhi); ++ hxs = hx; + hx &= 0x7fffffffffffffffLL; /* high |x| */ + if (hx == 0) + return -1.0 / fabs (x); +@@ -42,6 +43,16 @@ __logbl (long double x) + though it were normalized. */ + rhx -= __builtin_clzll (hx) - 12; + } ++ else if ((hx & 0x000fffffffffffffLL) == 0) ++ { ++ /* If the high part is a power of 2, and the low part is nonzero ++ with the opposite sign, the low part affects the ++ exponent. */ ++ int64_t lx; ++ EXTRACT_WORDS64 (lx, xlo); ++ if ((hxs ^ lx) < 0 && (lx & 0x7fffffffffffffffLL) != 0) ++ rhx--; ++ } + return (long double) (rhx - 1023); + } + #ifndef __logbl Added: glibc-package/branches/glibc-2.21/debian/patches/any/cvs-make-typo.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/cvs-make-typo.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/any/cvs-make-typo.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,19 @@ +commit e8b6be0016f131c2ac72bf3213eabdb59800e63b +Author: Andreas Schwab <sch...@suse.de> +Date: Mon Mar 2 15:47:56 2015 +0100 + + Fix parallel build error + +diff --git a/elf/Makefile b/elf/Makefile +index 20b1682..711beed 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -362,7 +362,7 @@ $(objpfx)interp.os: $(elf-objpfx)runtime-linker.h + + $(elf-objpfx)runtime-linker.h: $(elf-objpfx)runtime-linker.st; @: + $(elf-objpfx)runtime-linker.st: $(common-objpfx)config.make +- $(name-target-directory) ++ $(make-target-directory) + echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \ + > ${@:st=T} + $(move-if-change) ${@:st=T} ${@:st=h} Modified: glibc-package/branches/glibc-2.21/debian/patches/any/local-disable-test-tgmath2.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/local-disable-test-tgmath2.diff 2015-03-23 02:21:01 UTC (rev 6431) +++ glibc-package/branches/glibc-2.21/debian/patches/any/local-disable-test-tgmath2.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -10,6 +10,6 @@ test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \ - test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \ + test-tgmath-int test-powl tst-CMPLX tst-CMPLX2 test-snan \ - test-fenv-tls test-fenv-preserve test-fenv-return $(tests-static) + test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \ + $(tests-static) tests-static = test-fpucw-static test-fpucw-ieee-static - # We do the `long double' tests only if this data type is available and Copied: glibc-package/branches/glibc-2.21/debian/patches/any/local-math-logb.diff (from rev 6431, glibc-package/branches/glibc-2.21/debian/patches/powerpc/local-math-logb.diff) =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/local-math-logb.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/any/local-math-logb.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,80 @@ +This patch workarounds a GCC bug on PowerPC 32-bit, converting 0 from +int to float might return -0.0. Upstream consider the bug fixed, as it +doesn't affect GCC built for PPC970/Power4 or later. It is clearly +something we don't want in Debian. + +2012-07-22 Aurelien Jarno <aurel...@aurel32.net> + + * sysdeps/ieee754/dbl-64/s_logb.c (__logb): avoid logb_downward (0.0) + return -0.0. + * sysdeps/ieee754/flt-32/s_logbf.c (__logbf): Likewise. + * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise. + +diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c +index 17aa94b..d7fd59d 100644 +--- a/sysdeps/ieee754/dbl-64/s_logb.c ++++ b/sysdeps/ieee754/dbl-64/s_logb.c +@@ -23,6 +23,7 @@ double + __logb (double x) + { + int32_t lx, ix, rix; ++ double ret; + + EXTRACT_WORDS (ix, lx, x); + ix &= 0x7fffffff; /* high |x| */ +@@ -41,7 +42,9 @@ __logb (double x) + ma = __builtin_clz (ix); + rix -= ma - 12; + } +- return (double) (rix - 1023); ++ ret = (double) (rix - 1023); ++ /* The test is to avoid logb_downward (0.0) == -0.0. */ ++ return ret == -0.0 ? 0.0 : ret; + } + weak_alias (__logb, logb) + #ifdef NO_LONG_DOUBLE +diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c +index e2b3aaa..1dce251 100644 +--- a/sysdeps/ieee754/flt-32/s_logbf.c ++++ b/sysdeps/ieee754/flt-32/s_logbf.c +@@ -20,6 +20,7 @@ float + __logbf (float x) + { + int32_t ix, rix; ++ float ret; + + GET_FLOAT_WORD (ix, x); + ix &= 0x7fffffff; /* high |x| */ +@@ -33,6 +34,8 @@ __logbf (float x) + though it were normalized. */ + rix -= __builtin_clz (ix) - 9; + } +- return (float) (rix - 127); ++ ret = (float) (rix - 127); ++ /* The test is to avoid logb_downward (0.0) == -0.0. */ ++ return ret == -0.0 ? 0.0 : ret; + } + weak_alias (__logbf, logbf) +diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +index 92ce2c1..db030a7 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c ++++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +@@ -27,6 +27,7 @@ long double + { + int64_t hx, hxs, rhx; + double xhi, xlo; ++ long double ret; + + ldbl_unpack (x, &xhi, &xlo); + EXTRACT_WORDS64 (hx, xhi); +@@ -40,7 +41,9 @@ __logbl (long double x) + if ((hxs ^ lx) < 0 && (lx & 0x7fffffffffffffffLL) != 0) + rhx--; + } +- return (long double) (rhx - 1023); ++ ret = (long double) (rhx - 1023); ++ /* The test is to avoid logb_downward (0.0) == -0.0. */ ++ return ret == -0.0 ? 0.0 : ret; + } + #ifndef __logbl + long_double_symbol (libm, __logbl, logbl); Modified: glibc-package/branches/glibc-2.21/debian/patches/any/submitted-longdouble.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/any/submitted-longdouble.diff 2015-03-23 02:21:01 UTC (rev 6431) +++ glibc-package/branches/glibc-2.21/debian/patches/any/submitted-longdouble.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -5,8 +5,8 @@ --- a/math/Makefile +++ b/math/Makefile @@ -92,12 +92,16 @@ - test-tgmath-int test-powl tst-CMPLX tst-CMPLX2 test-snan \ - test-fenv-tls test-fenv-preserve test-fenv-return $(tests-static) + test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \ + $(tests-static) tests-static = test-fpucw-static test-fpucw-ieee-static -# We do the `long double' tests only if this data type is available and -# distinct from `double'. Added: glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-arm-sfi_breg.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-arm-sfi_breg.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-arm-sfi_breg.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,28 @@ +commit f8d1bb4c25849b528b9771cb5834b0cd17450ae3 +Author: Roland McGrath <rol...@hack.frob.com> +Date: Fri Feb 6 14:42:18 2015 -0800 + + ARM: Add missing sfi_breg in LDR_GLOBAL macro. + +diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h +index eaa4b94..9bbd009 100644 +--- a/sysdeps/arm/sysdep.h ++++ b/sysdeps/arm/sysdep.h +@@ -198,7 +198,7 @@ + # define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \ + movw T, #:lower16:SYMBOL; \ + movt T, #:upper16:SYMBOL; \ +- ldr R, [T, $CONSTANT] ++ sfi_breg T, ldr R, [\B, $CONSTANT] + # elif defined (ARCH_HAS_T2) && defined (PIC) && ARM_PCREL_MOVW_OK + # define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \ + movw R, #:lower16:_GLOBAL_OFFSET_TABLE_ - 97f - PC_OFS; \ +@@ -212,7 +212,7 @@ + 97: add R, R, pc; \ + 98: LDST_PC_INDEXED (ldr, T, T, T); \ + LDST_INDEXED (ldr, R, T, R, T); \ +- ldr R, [R, $CONSTANT] ++ sfi_breg R, ldr R, [\B, $CONSTANT] + # else + # define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \ + ldr T, 99f; \ Added: glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-memcpy-memmove-always-bx.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-memcpy-memmove-always-bx.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/arm/cvs-memcpy-memmove-always-bx.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,80 @@ +commit 298e5d56dca199aea2c18ef27dd33bd82c879ee4 +Author: Roland McGrath <rol...@hack.frob.com> +Date: Thu Mar 19 12:45:24 2015 -0700 + + ARM: Fix memcpy & memmove for [ARM_ALWAYS_BX] + +diff --git a/sysdeps/arm/memcpy.S b/sysdeps/arm/memcpy.S +index 0602d99..3e41ea6 100644 +--- a/sysdeps/arm/memcpy.S ++++ b/sysdeps/arm/memcpy.S +@@ -125,7 +125,12 @@ ENTRY(memcpy) + push {r10} + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r10, 0) +- add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++0: add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++ /* If alignment is not perfect, then there will be some ++ padding (nop) instructions between this BX and label 6. ++ The computation above assumed that two instructions ++ later is exactly the right spot. */ ++ add r10, #(6f - (0b + PC_OFS)) + bx r10 + #endif + .p2align ARM_BX_ALIGN_LOG2 +@@ -156,11 +161,16 @@ ENTRY(memcpy) + add pc, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) + nop + #else +- add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++0: add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++ /* If alignment is not perfect, then there will be some ++ padding (nop) instructions between this BX and label 66. ++ The computation above assumed that two instructions ++ later is exactly the right spot. */ ++ add r10, #(66f - (0b + PC_OFS)) + bx r10 + #endif + .p2align ARM_BX_ALIGN_LOG2 +- nop ++66: nop + .p2align ARM_BX_ALIGN_LOG2 + sfi_breg r0, \ + str r3, [\B], #4 +diff --git a/sysdeps/arm/memmove.S b/sysdeps/arm/memmove.S +index f8a4eff..dde877e 100644 +--- a/sysdeps/arm/memmove.S ++++ b/sysdeps/arm/memmove.S +@@ -141,7 +141,12 @@ ENTRY(memmove) + push {r10} + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r10, 0) +- add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++0: add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++ /* If alignment is not perfect, then there will be some ++ padding (nop) instructions between this BX and label 6. ++ The computation above assumed that two instructions ++ later is exactly the right spot. */ ++ add r10, #(6f - (0b + PC_OFS)) + bx r10 + #endif + .p2align ARM_BX_ALIGN_LOG2 +@@ -172,11 +177,16 @@ ENTRY(memmove) + add pc, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) + nop + #else +- add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++0: add r10, pc, ip, lsl #(ARM_BX_ALIGN_LOG2 - 2) ++ /* If alignment is not perfect, then there will be some ++ padding (nop) instructions between this BX and label 66. ++ The computation above assumed that two instructions ++ later is exactly the right spot. */ ++ add r10, #(66f - (0b + PC_OFS)) + bx r10 + #endif + .p2align ARM_BX_ALIGN_LOG2 +- nop ++66: nop + .p2align ARM_BX_ALIGN_LOG2 + sfi_breg r0, \ + str r3, [\B, #-4]! Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-power7-strncpy.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-power7-strncpy.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-power7-strncpy.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,416 @@ +commit 98408b95b155464e760c22dce4842f29499db821 +Author: Rajalakshmi Srinivasaraghavan <r...@linux.vnet.ibm.com> +Date: Wed Jan 28 08:43:29 2015 -0500 + + powerpc: POWER7 strncpy optimization for unaligned string + + This patch optimizes strncpy for power7 for unaligned source or + destination address. The source or destination address is aligned + to doubleword and data is shifted based on the alignment and + added with the previous loaded data to be written as a doubleword. + For each load, cmpb instruction is used for faster null check. + + The new optimization shows 10 to 70% of performance improvement + for longer string though it does not show big difference on string + size less than 16 due to additional checks.Hence this new algorithm + is restricted to string greater than 16. + +diff --git a/sysdeps/powerpc/powerpc64/power7/strncpy.S b/sysdeps/powerpc/powerpc64/power7/strncpy.S +index e60fc25..a6c9abf 100644 +--- a/sysdeps/powerpc/powerpc64/power7/strncpy.S ++++ b/sysdeps/powerpc/powerpc64/power7/strncpy.S +@@ -72,9 +72,9 @@ EALIGN(FUNC_NAME, 4, 0) + + mr r9, r3 /* save r3 into r9 for use */ + mr r18, r3 /* save r3 for retCode of strncpy */ +- bne 0, L(byte_by_byte) +- ++ bne 0, L(unaligned) + ++L(aligned): + srdi r11, r5, 3 /* compute count for CTR ; count = n/8 */ + cmpldi cr7, r11, 3 /* if count > 4 ; perform unrolling 4 times */ + ble 7, L(update1) +@@ -332,6 +332,382 @@ L(HopBy8): + addi r5, r5, -8 /* decrement length 'n' by 8 */ + addi r0, r11, -1 /* decrement loop counter */ + b L(dWordUnrollOFF) ++ ++L(unaligned): ++ cmpdi r5, 16 /* Proceed byte by byte for less than 16 */ ++ ble L(byte_by_byte) ++ rldicl r7, r3, 0, 61 ++ rldicl r6, r4, 0, 61 ++ cmpdi r6, 0 /* Check src alignment */ ++ beq L(srcaligndstunalign) ++ /* src is unaligned */ ++ rlwinm r10, r4, 3,26,28 /* Calculate padding. */ ++ clrrdi r4, r4, 3 /* Align the addr to dw boundary */ ++ ld r8, 0(r4) /* Load doubleword from memory. */ ++ li r0, 0 ++ /* Discard bits not part of the string */ ++#ifdef __LITTLE_ENDIAN__ ++ srd r7, r8, r10 ++#else ++ sld r7, r8, r10 ++#endif ++ cmpb r0, r7, r0 /* Compare each byte against null */ ++ /* Discard bits not part of the string */ ++#ifdef __LITTLE_ENDIAN__ ++ sld r0, r0, r10 ++#else ++ srd r0, r0, r10 ++#endif ++ cmpdi r0, 0 ++ bne L(bytebybyte) /* if it has null, copy byte by byte */ ++ subfic r6, r6, 8 ++ rlwinm r12, r3, 3,26,28 /* Calculate padding in bits. */ ++ rldicl r9, r3, 0, 61 /* Calculate padding in bytes. */ ++ addi r3, r3, -1 ++ ++ cmpdi r12, 0 /* check dest alignment */ ++ beq L(srcunaligndstalign) ++ ++ /* both src and dst unaligned */ ++#ifdef __LITTLE_ENDIAN__ ++ sld r8, r7, r10 ++ mr r11, r10 ++ addi r11, r11, -8 /* Adjust byte pointer on loaded dw */ ++#else ++ srd r8, r7, r10 ++ subfic r11, r10, 64 ++#endif ++ /* dst alignment is greater then src alignment? */ ++ cmpd cr7, r12, r10 ++ ble cr7, L(dst_align_small) ++ /* src alignment is less than dst */ ++ ++ /* Calculate the dst alignment difference */ ++ subfic r7, r9, 8 ++ mtctr r7 ++ ++ /* Write until dst is aligned */ ++ cmpdi r0, r7, 4 ++ blt L(storebyte1) /* less than 4, store byte by byte */ ++ beq L(equal1) /* if its 4, store word */ ++ addi r0, r7, -4 /* greater than 4, so stb and stw */ ++ mtctr r0 ++L(storebyte1): ++#ifdef __LITTLE_ENDIAN__ ++ addi r11, r11, 8 /* Adjust byte pointer on loaded dw */ ++#else ++ addi r11, r11, -8 ++#endif ++ srd r7, r8, r11 ++ stbu r7, 1(r3) ++ addi r5, r5, -1 ++ bdnz L(storebyte1) ++ ++ subfic r7, r9, 8 /* Check the remaining bytes */ ++ cmpdi r0, r7, 4 ++ blt L(proceed1) ++ ++ .align 4 ++L(equal1): ++#ifdef __LITTLE_ENDIAN__ ++ addi r11, r11, 8 /* Adjust byte pointer on loaded dw */ ++ srd r7, r8, r11 ++#else ++ subfic r11, r11, 64 ++ sld r7, r8, r11 ++ srdi r7, r7, 32 ++#endif ++ stw r7, 1(r3) ++ addi r3, r3, 4 ++ addi r5, r5, -4 ++ ++L(proceed1): ++ mr r7, r8 ++ /* calculate the Left over bytes to be written */ ++ subfic r11, r10, 64 ++ subfic r12, r12, 64 ++ subf r12, r12, r11 /* remaining bytes on second dw */ ++ subfic r10, r12, 64 /* remaining bytes on first dw */ ++ subfic r9, r9, 8 ++ subf r6, r9, r6 /* recalculate padding */ ++L(srcunaligndstalign): ++ addi r3, r3, 1 ++ subfic r12, r10, 64 /* remaining bytes on second dw */ ++ addi r4, r4, 8 ++ li r0,0 ++ b L(storedouble) ++ ++ .align 4 ++L(dst_align_small): ++ mtctr r6 ++ /* Write until src is aligned */ ++L(storebyte2): ++#ifdef __LITTLE_ENDIAN__ ++ addi r11, r11, 8 /* Adjust byte pointer on dw */ ++#else ++ addi r11, r11, -8 ++#endif ++ srd r7, r8, r11 ++ stbu r7, 1(r3) ++ addi r5, r5, -1 ++ bdnz L(storebyte2) ++ ++ addi r4, r4, 8 /* Increment src pointer */ ++ addi r3, r3, 1 /* Increment dst pointer */ ++ mr r9, r3 ++ li r8, 0 ++ cmpd cr7, r12, r10 ++ beq cr7, L(aligned) ++ rldicl r6, r3, 0, 61 /* Recalculate padding */ ++ mr r7, r6 ++ ++ /* src is algined */ ++L(srcaligndstunalign): ++ mr r9, r3 ++ mr r6, r7 ++ ld r8, 0(r4) ++ subfic r10, r7, 8 ++ mr r7, r8 ++ li r0, 0 /* Check null */ ++ cmpb r0, r8, r0 ++ cmpdi r0, 0 ++ bne L(byte_by_byte) /* Do byte by byte if there is NULL */ ++ rlwinm r12, r3, 3,26,28 /* Calculate padding */ ++ addi r3, r3, -1 ++ /* write byte by byte until aligned */ ++#ifdef __LITTLE_ENDIAN__ ++ li r11, -8 ++#else ++ li r11, 64 ++#endif ++ mtctr r10 ++ cmpdi r0, r10, 4 ++ blt L(storebyte) ++ beq L(equal) ++ addi r0, r10, -4 ++ mtctr r0 ++L(storebyte): ++#ifdef __LITTLE_ENDIAN__ ++ addi r11, r11, 8 /* Adjust byte pointer on dw */ ++#else ++ addi r11, r11, -8 ++#endif ++ srd r7, r8, r11 ++ stbu r7, 1(r3) ++ addi r5, r5, -1 ++ bdnz L(storebyte) ++ ++ cmpdi r0, r10, 4 ++ blt L(align) ++ ++ .align 4 ++L(equal): ++#ifdef __LITTLE_ENDIAN__ ++ addi r11, r11, 8 ++ srd r7, r8, r11 ++#else ++ subfic r11, r11, 64 ++ sld r7, r8, r11 ++ srdi r7, r7, 32 ++#endif ++ stw r7, 1(r3) ++ addi r5, r5, -4 ++ addi r3, r3, 4 ++L(align): ++ addi r3, r3, 1 ++ addi r4, r4, 8 /* Increment src pointer */ ++ subfic r10, r12, 64 ++ li r0, 0 ++ /* dst addr aligned to 8 */ ++L(storedouble): ++ cmpdi r5, 8 ++ ble L(null1) ++ ld r7, 0(r4) /* load next dw */ ++ cmpb r0, r7, r0 ++ cmpdi r0, 0 /* check for null on each new dw */ ++ bne L(null) ++#ifdef __LITTLE_ENDIAN__ ++ srd r9, r8, r10 /* bytes from first dw */ ++ sld r11, r7, r12 /* bytes from second dw */ ++#else ++ sld r9, r8, r10 ++ srd r11, r7, r12 ++#endif ++ or r11, r9, r11 /* make as a single dw */ ++ std r11, 0(r3) /* store as std on aligned addr */ ++ mr r8, r7 /* still few bytes left to be written */ ++ addi r3, r3, 8 /* increment dst addr */ ++ addi r4, r4, 8 /* increment src addr */ ++ addi r5, r5, -8 ++ b L(storedouble) /* Loop until NULL */ ++ ++ .align 4 ++ ++/* We've hit the end of the string. Do the rest byte-by-byte. */ ++L(null): ++ addi r3, r3, -1 ++ mr r10, r12 ++ mtctr r6 ++#ifdef __LITTLE_ENDIAN__ ++ subfic r10, r10, 64 ++ addi r10, r10, -8 ++#endif ++ cmpdi r0, r5, 4 ++ blt L(loop) ++ cmpdi r0, r6, 4 ++ blt L(loop) ++ ++ /* we can still use stw if leftover >= 4 */ ++#ifdef __LITTLE_ENDIAN__ ++ addi r10, r10, 8 ++ srd r11, r8, r10 ++#else ++ subfic r10, r10, 64 ++ sld r11, r8, r10 ++ srdi r11, r11, 32 ++#endif ++ stw r11, 1(r3) ++ addi r5, r5, -4 ++ addi r3, r3, 4 ++ cmpdi r0, r5, 0 ++ beq L(g1) ++ cmpdi r0, r6, 4 ++ beq L(bytebybyte1) ++ addi r10, r10, 32 ++#ifdef __LITTLE_ENDIAN__ ++ addi r10, r10, -8 ++#else ++ subfic r10, r10, 64 ++#endif ++ addi r0, r6, -4 ++ mtctr r0 ++ /* remaining byte by byte part of first dw */ ++L(loop): ++#ifdef __LITTLE_ENDIAN__ ++ addi r10, r10, 8 ++#else ++ addi r10, r10, -8 ++#endif ++ srd r0, r8, r10 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ cmpdi r0, r5, 0 ++ beq L(g1) ++ bdnz L(loop) ++L(bytebybyte1): ++ addi r3, r3, 1 ++ /* remaining byte by byte part of second dw */ ++L(bytebybyte): ++ addi r3, r3, -8 ++ addi r4, r4, -1 ++ ++#ifdef __LITTLE_ENDIAN__ ++ extrdi. r0, r7, 8, 56 ++ stbu r7, 8(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 48 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 40 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 32 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 24 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 16 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 8 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi r0, r7, 8, 0 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ b L(g2) ++#else ++ extrdi. r0, r7, 8, 0 ++ stbu r0, 8(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 8 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 16 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 24 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 32 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 40 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ extrdi. r0, r7, 8, 48 ++ stbu r0, 1(r3) ++ addi r5, r5, -1 ++ beq L(g2) ++ cmpdi r5, 0 ++ beq L(g1) ++ stbu r7, 1(r3) ++ addi r5, r5, -1 ++ b L(g2) ++#endif ++L(g1): ++#ifdef USE_AS_STPNCPY ++ addi r3, r3, 1 ++#endif ++L(g2): ++ addi r3, r3, 1 ++ mr r19, r3 ++ mr r8, r5 ++ b L(zeroFill) ++L(null1): ++ mr r9, r3 ++ subf r4, r6, r4 ++ b L(byte_by_byte) + END(FUNC_NAME) + #ifndef USE_AS_STPNCPY + libc_hidden_builtin_def (strncpy) Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-feraiseexcept.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-feraiseexcept.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-feraiseexcept.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,448 @@ +commit 85b290451e4d3ab460a57f1c5966c5827ca807ca +Author: Adhemerval Zanella <azane...@linux.vnet.ibm.com> +Date: Wed Jan 28 06:10:41 2015 -0500 + + powerpc: Fix inline feraiseexcept, feclearexcept macros + + This patch fixes the inline feraiseexcept and feclearexcept macros for + powerpc by casting the input argument to integer before operation on it. + + It fixes BZ#17776. + +diff --git a/math/Makefile b/math/Makefile +index fec7627..3904e41 100644 +--- a/math/Makefile ++++ b/math/Makefile +@@ -90,7 +90,8 @@ tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ + test-misc test-fpucw test-fpucw-ieee tst-definitions test-tgmath \ + test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \ + test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \ +- test-fenv-tls test-fenv-preserve test-fenv-return $(tests-static) ++ test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \ ++ $(tests-static) + tests-static = test-fpucw-static test-fpucw-ieee-static + # We do the `long double' tests only if this data type is available and + # distinct from `double'. +diff --git a/math/test-fenvinline.c b/math/test-fenvinline.c +new file mode 100644 +index 0000000..87c9df4 +--- /dev/null ++++ b/math/test-fenvinline.c +@@ -0,0 +1,351 @@ ++/* Test for fenv inline implementations. ++ Copyright (C) 2015 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++#ifndef _GNU_SOURCE ++# define _GNU_SOURCE ++#endif ++ ++/* To make sure the fenv inline function are used. */ ++#undef __NO_MATH_INLINES ++ ++#include <fenv.h> ++#include <stdio.h> ++#include <math-tests.h> ++ ++/* ++ Since not all architectures might define all exceptions, we define ++ a private set and map accordingly. ++*/ ++#define NO_EXC 0 ++#define INEXACT_EXC 0x1 ++#define DIVBYZERO_EXC 0x2 ++#define UNDERFLOW_EXC 0x04 ++#define OVERFLOW_EXC 0x08 ++#define INVALID_EXC 0x10 ++#define ALL_EXC \ ++ (INEXACT_EXC | DIVBYZERO_EXC | UNDERFLOW_EXC | OVERFLOW_EXC | \ ++ INVALID_EXC) ++static int count_errors; ++ ++#if FE_ALL_EXCEPT ++static void ++test_single_exception_fp_int (int exception, ++ int exc_flag, ++ int fe_flag, ++ const char *flag_name) ++{ ++ if (exception & exc_flag) ++ { ++ if (fetestexcept (fe_flag)) ++ printf (" Pass: Exception \"%s\" is set\n", flag_name); ++ else ++ { ++ printf (" Fail: Exception \"%s\" is not set\n", flag_name); ++ ++count_errors; ++ } ++ } ++ else ++ { ++ if (fetestexcept (fe_flag)) ++ { ++ printf (" Fail: Exception \"%s\" is set\n", flag_name); ++ ++count_errors; ++ } ++ else ++ printf (" Pass: Exception \"%s\" is not set\n", flag_name); ++ } ++} ++/* Test whether a given exception was raised. */ ++static void ++test_single_exception_fp_double (int exception, ++ int exc_flag, ++ double fe_flag, ++ const char *flag_name) ++{ ++ if (exception & exc_flag) ++ { ++ if (fetestexcept (fe_flag)) ++ printf (" Pass: Exception \"%s\" is set\n", flag_name); ++ else ++ { ++ printf (" Fail: Exception \"%s\" is not set\n", flag_name); ++ ++count_errors; ++ } ++ } ++ else ++ { ++ if (fetestexcept (fe_flag)) ++ { ++ printf (" Fail: Exception \"%s\" is set\n", flag_name); ++ ++count_errors; ++ } ++ else ++ printf (" Pass: Exception \"%s\" is not set\n", flag_name); ++ } ++} ++#endif ++ ++static void ++test_exceptions (const char *test_name, int exception) ++{ ++ printf ("Test: %s\n", test_name); ++#ifdef FE_DIVBYZERO ++ test_single_exception_fp_double (exception, DIVBYZERO_EXC, FE_DIVBYZERO, ++ "DIVBYZERO"); ++#endif ++#ifdef FE_INVALID ++ test_single_exception_fp_double (exception, INVALID_EXC, FE_INVALID, ++ "INVALID"); ++#endif ++#ifdef FE_INEXACT ++ test_single_exception_fp_double (exception, INEXACT_EXC, FE_INEXACT, ++ "INEXACT"); ++#endif ++#ifdef FE_UNDERFLOW ++ test_single_exception_fp_double (exception, UNDERFLOW_EXC, FE_UNDERFLOW, ++ "UNDERFLOW"); ++#endif ++#ifdef FE_OVERFLOW ++ test_single_exception_fp_double (exception, OVERFLOW_EXC, FE_OVERFLOW, ++ "OVERFLOW"); ++#endif ++} ++ ++static void ++test_exceptionflag (void) ++{ ++ printf ("Test: fegetexceptionflag (FE_ALL_EXCEPT)\n"); ++#if FE_ALL_EXCEPT ++ fexcept_t excepts; ++ ++ feclearexcept (FE_ALL_EXCEPT); ++ ++ feraiseexcept (FE_INVALID); ++ fegetexceptflag (&excepts, FE_ALL_EXCEPT); ++ ++ feclearexcept (FE_ALL_EXCEPT); ++ feraiseexcept (FE_OVERFLOW | FE_INEXACT); ++ ++ fesetexceptflag (&excepts, FE_ALL_EXCEPT); ++ ++ test_single_exception_fp_int (INVALID_EXC, INVALID_EXC, FE_INVALID, ++ "INVALID (int)"); ++ test_single_exception_fp_int (INVALID_EXC, OVERFLOW_EXC, FE_OVERFLOW, ++ "OVERFLOW (int)"); ++ test_single_exception_fp_int (INVALID_EXC, INEXACT_EXC, FE_INEXACT, ++ "INEXACT (int)"); ++ ++ /* Same test, but using double as argument */ ++ feclearexcept (FE_ALL_EXCEPT); ++ ++ feraiseexcept (FE_INVALID); ++ fegetexceptflag (&excepts, (double)FE_ALL_EXCEPT); ++ ++ feclearexcept (FE_ALL_EXCEPT); ++ feraiseexcept (FE_OVERFLOW | FE_INEXACT); ++ ++ fesetexceptflag (&excepts, (double)FE_ALL_EXCEPT); ++ ++ test_single_exception_fp_double (INVALID_EXC, INVALID_EXC, FE_INVALID, ++ "INVALID (double)"); ++ test_single_exception_fp_double (INVALID_EXC, OVERFLOW_EXC, FE_OVERFLOW, ++ "OVERFLOW (double)"); ++ test_single_exception_fp_double (INVALID_EXC, INEXACT_EXC, FE_INEXACT, ++ "INEXACT (double)"); ++#endif ++} ++ ++static void ++test_fesetround (void) ++{ ++#if defined FE_TONEAREST && defined FE_TOWARDZERO ++ int res1; ++ int res2; ++ ++ printf ("Tests for fesetround\n"); ++ ++ /* The fesetround should not itself cause the test to fail, however it ++ should either succeed for both 'int' and 'double' argument, or fail ++ for both. */ ++ res1 = fesetround ((int) FE_TOWARDZERO); ++ res2 = fesetround ((double) FE_TOWARDZERO); ++ if (res1 != res2) ++ { ++ printf ("fesetround (FE_TOWARDZERO) failed: %d, %d\n", res1, res2); ++ ++count_errors; ++ } ++ ++ res1 = fesetround ((int) FE_TONEAREST); ++ res2 = fesetround ((double) FE_TONEAREST); ++ if (res1 != res2) ++ { ++ printf ("fesetround (FE_TONEAREST) failed: %d, %d\n", res1, res2); ++ ++count_errors; ++ } ++#endif ++} ++ ++/* Tests for feenableexcept/fedisableexcept. */ ++static void ++feenable_test (const char *flag_name, fexcept_t fe_exc) ++{ ++#if FE_ALL_EXCEPT ++ int fe_exci = fe_exc; ++ double fe_excd = fe_exc; ++ int excepts; ++ ++ /* First disable all exceptions. */ ++ if (fedisableexcept (FE_ALL_EXCEPT) == -1) ++ { ++ printf ("Test: fedisableexcept (FE_ALL_EXCEPT) failed\n"); ++ ++count_errors; ++ /* If this fails, the other tests don't make sense. */ ++ return; ++ } ++ ++ /* Test for inline macros using integer argument. */ ++ excepts = feenableexcept (fe_exci); ++ if (!EXCEPTION_ENABLE_SUPPORTED (fe_exci) && excepts == -1) ++ { ++ printf ("Test: not testing feenableexcept, it isn't implemented.\n"); ++ return; ++ } ++ if (excepts == -1) ++ { ++ printf ("Test: feenableexcept (%s) failed\n", flag_name); ++ ++count_errors; ++ return; ++ } ++ if (excepts != 0) ++ { ++ printf ("Test: feenableexcept (%s) failed, return should be 0, is %x\n", ++ flag_name, excepts); ++ ++count_errors; ++ } ++ ++ /* And now disable the exception again. */ ++ excepts = fedisableexcept (fe_exc); ++ if (excepts == -1) ++ { ++ printf ("Test: fedisableexcept (%s) failed\n", flag_name); ++ ++count_errors; ++ return; ++ } ++ if (excepts != fe_exc) ++ { ++ printf ("Test: fedisableexcept (%s) failed, return should be 0x%x, is 0x%x\n", ++ flag_name, fe_exc, excepts); ++ ++count_errors; ++ } ++ ++ /* Test for inline macros using double argument. */ ++ excepts = feenableexcept (fe_excd); ++ if (!EXCEPTION_ENABLE_SUPPORTED (fe_excd) && excepts == -1) ++ { ++ printf ("Test: not testing feenableexcept, it isn't implemented.\n"); ++ return; ++ } ++ if (excepts == -1) ++ { ++ printf ("Test: feenableexcept (%s) failed\n", flag_name); ++ ++count_errors; ++ return; ++ } ++ if (excepts != 0) ++ { ++ printf ("Test: feenableexcept (%s) failed, return should be 0, is %x\n", ++ flag_name, excepts); ++ ++count_errors; ++ } ++ ++ /* And now disable the exception again. */ ++ excepts = fedisableexcept (fe_exc); ++ if (excepts == -1) ++ { ++ printf ("Test: fedisableexcept (%s) failed\n", flag_name); ++ ++count_errors; ++ return; ++ } ++ if (excepts != fe_exc) ++ { ++ printf ("Test: fedisableexcept (%s) failed, return should be 0x%x, is 0x%x\n", ++ flag_name, fe_exc, excepts); ++ ++count_errors; ++ } ++#endif ++} ++ ++static void ++test_feenabledisable (void) ++{ ++ printf ("Tests for feenableexcepts/fedisableexcept\n"); ++ ++ /* We might have some exceptions still set. */ ++ feclearexcept (FE_ALL_EXCEPT); ++ ++#ifdef FE_DIVBYZERO ++ feenable_test ("FE_DIVBYZERO", FE_DIVBYZERO); ++#endif ++#ifdef FE_INVALID ++ feenable_test ("FE_INVALID", FE_INVALID); ++#endif ++#ifdef FE_INEXACT ++ feenable_test ("FE_INEXACT", FE_INEXACT); ++#endif ++#ifdef FE_UNDERFLOW ++ feenable_test ("FE_UNDERFLOW", FE_UNDERFLOW); ++#endif ++#ifdef FE_OVERFLOW ++ feenable_test ("FE_OVERFLOW", FE_OVERFLOW); ++#endif ++ fesetenv (FE_DFL_ENV); ++} ++ ++static int ++do_test (void) ++{ ++ /* clear all exceptions and test if all are cleared */ ++ feclearexcept (FE_ALL_EXCEPT); ++ test_exceptions ("feclearexcept (FE_ALL_EXCEPT) clears all exceptions", ++ NO_EXC); ++ ++ /* raise all exceptions and test if all are raised */ ++ feraiseexcept (FE_ALL_EXCEPT); ++ test_exceptions ("feraiseexcept (FE_ALL_EXCEPT) raises all exceptions", ++ ALL_EXC); ++ ++ /* Same test, but using double as argument */ ++ feclearexcept ((double)FE_ALL_EXCEPT); ++ test_exceptions ("feclearexcept ((double)FE_ALL_EXCEPT) clears all exceptions", ++ NO_EXC); ++ ++ feraiseexcept ((double)FE_ALL_EXCEPT); ++ test_exceptions ("feraiseexcept ((double)FE_ALL_EXCEPT) raises all exceptions", ++ ALL_EXC); ++ ++ test_exceptionflag (); ++ ++ test_fesetround (); ++ ++ test_feenabledisable (); ++ ++ return count_errors; ++} ++ ++#define TEST_FUNCTION do_test () ++#include "../test-skeleton.c" +diff --git a/sysdeps/powerpc/bits/fenvinline.h b/sysdeps/powerpc/bits/fenvinline.h +index 35c2114..894789e 100644 +--- a/sysdeps/powerpc/bits/fenvinline.h ++++ b/sysdeps/powerpc/bits/fenvinline.h +@@ -34,29 +34,41 @@ + + /* Inline definition for feraiseexcept. */ + # define feraiseexcept(__excepts) \ +- ((__builtin_constant_p (__excepts) \ +- && ((__excepts) & ((__excepts)-1)) == 0 \ +- && (__excepts) != FE_INVALID) \ +- ? ((__excepts) != 0 \ +- ? (__extension__ ({ __asm__ __volatile__ \ +- ("mtfsb1 %s0" \ +- : : "i#*X"(__builtin_ffs (__excepts))); \ +- 0; })) \ +- : 0) \ +- : (feraiseexcept) (__excepts)) ++ (__extension__ ({ \ ++ int __e = __excepts; \ ++ int __ret; \ ++ if (__builtin_constant_p (__e) \ ++ && (__e & (__e - 1)) == 0 \ ++ && __e != FE_INVALID) \ ++ { \ ++ if (__e != 0) \ ++ __asm__ __volatile__ ("mtfsb1 %s0" \ ++ : : "i#*X" (__builtin_ffs (__e))); \ ++ __ret = 0; \ ++ } \ ++ else \ ++ __ret = feraiseexcept (__e); \ ++ __ret; \ ++ })) + + /* Inline definition for feclearexcept. */ + # define feclearexcept(__excepts) \ +- ((__builtin_constant_p (__excepts) \ +- && ((__excepts) & ((__excepts)-1)) == 0 \ +- && (__excepts) != FE_INVALID) \ +- ? ((__excepts) != 0 \ +- ? (__extension__ ({ __asm__ __volatile__ \ +- ("mtfsb0 %s0" \ +- : : "i#*X"(__builtin_ffs (__excepts))); \ +- 0; })) \ +- : 0) \ +- : (feclearexcept) (__excepts)) ++ (__extension__ ({ \ ++ int __e = __excepts; \ ++ int __ret; \ ++ if (__builtin_constant_p (__e) \ ++ && (__e & (__e - 1)) == 0 \ ++ && __e != FE_INVALID) \ ++ { \ ++ if (__e != 0) \ ++ __asm__ __volatile__ ("mtfsb0 %s0" \ ++ : : "i#*X" (__builtin_ffs (__e))); \ ++ __ret = 0; \ ++ } \ ++ else \ ++ __ret = feclearexcept (__e); \ ++ __ret; \ ++ })) + + # endif /* !__NO_MATH_INLINES. */ + Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-pow.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-pow.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-pow.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,19 @@ +commit d421868bb85d1459b1d2df520bb26f3e11aa195a +Author: Adhemerval Zanella <azane...@linux.vnet.ibm.com> +Date: Tue Mar 10 09:38:54 2015 -0400 + + powerpc: Fix incorrect results for pow when using FMA + + This patch adds no FMA generation for e_pow to avoid precision issues + for powerpc. This fixes BZ#18104. + +diff --git a/sysdeps/ieee754/dbl-64/Makefile b/sysdeps/ieee754/dbl-64/Makefile +index 35f545f..5557c75 100644 +--- a/sysdeps/ieee754/dbl-64/Makefile ++++ b/sysdeps/ieee754/dbl-64/Makefile +@@ -2,4 +2,5 @@ ifeq ($(subdir),math) + # branred depends on precise IEEE double rounding + CFLAGS-branred.c = $(config-cflags-nofma) + CFLAGS-e_sqrt.c = $(config-cflags-nofma) ++CFLAGS-e_pow.c = $(config-cflags-nofma) + endif Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrt.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrt.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrt.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,95 @@ +commit e8bd5286c68bc35be3b41e94c15c4387dcb3bec9 +Author: Joseph Myers <jos...@codesourcery.com> +Date: Thu Feb 12 23:05:37 2015 +0000 + + Fix powerpc software sqrt (bug 17964). + + As Adhemerval noted in + <https://sourceware.org/ml/libc-alpha/2015-01/msg00451.html>, the + powerpc sqrt implementation for when _ARCH_PPCSQ is not defined is + inaccurate in some cases. + + The problem is that this code relies on fused multiply-add, and relies + on the compiler contracting a * b + c to get a fused operation. But + sysdeps/ieee754/dbl-64/Makefile disables contraction for e_sqrt.c, + because the implementation in that directory relies on *not* having + contracted operations. + + While it would be possible to arrange makefiles so that an earlier + sysdeps directory can disable the setting in + sysdeps/ieee754/dbl-64/Makefile, it seems a lot cleaner to make the + dependence on fused operations explicit in the .c file. GCC 4.6 + introduced support for __builtin_fma on powerpc and other + architectures with such instructions, so we can rely on that; this + patch duly makes the code use __builtin_fma for all such fused + operations. + + Tested for powerpc32 (hard float). + + 2015-02-12 Joseph Myers <jos...@codesourcery.com> + + [BZ #17964] + * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Use + __builtin_fma instead of relying on contraction of a * b + c. + +diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c +index 0934faa..9b55ef8 100644 +--- a/sysdeps/powerpc/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/fpu/e_sqrt.c +@@ -99,38 +99,41 @@ __slow_ieee754_sqrt (double x) + /* Here we have three Newton-Raphson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ +- sd = -(sg * sg - sx); ++ sd = -__builtin_fma (sg, sg, -sx); + fsgi = (xi0 + 0x40000000) >> 1 & 0x7ff00000; + sy2 = sy + sy; +- sg = sy * sd + sg; /* 16-bit approximation to sqrt(sx). */ ++ sg = __builtin_fma (sy, sd, sg); /* 16-bit approximation to ++ sqrt(sx). */ + + /* schedule the INSERT_WORDS (fsg, fsgi, 0) to get separation + between the store and the load. */ + INSERT_WORDS (fsg, fsgi, 0); + iw_u.parts.msw = fsgi; + iw_u.parts.lsw = (0); +- e = -(sy * sg - almost_half); +- sd = -(sg * sg - sx); ++ e = -__builtin_fma (sy, sg, -almost_half); ++ sd = -__builtin_fma (sg, sg, -sx); + if ((xi0 & 0x7ff00000) == 0) + goto denorm; +- sy = sy + e * sy2; +- sg = sg + sy * sd; /* 32-bit approximation to sqrt(sx). */ ++ sy = __builtin_fma (e, sy2, sy); ++ sg = __builtin_fma (sy, sd, sg); /* 32-bit approximation to ++ sqrt(sx). */ + sy2 = sy + sy; + /* complete the INSERT_WORDS (fsg, fsgi, 0) operation. */ + fsg = iw_u.value; +- e = -(sy * sg - almost_half); +- sd = -(sg * sg - sx); +- sy = sy + e * sy2; ++ e = -__builtin_fma (sy, sg, -almost_half); ++ sd = -__builtin_fma (sg, sg, -sx); ++ sy = __builtin_fma (e, sy2, sy); + shx = sx * fsg; +- sg = sg + sy * sd; /* 64-bit approximation to sqrt(sx), +- but perhaps rounded incorrectly. */ ++ sg = __builtin_fma (sy, sd, sg); /* 64-bit approximation to ++ sqrt(sx), but perhaps ++ rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; +- e = -(sy * sg - almost_half); +- d = -(g * sg - shx); +- sy = sy + e * sy2; ++ e = -__builtin_fma (sy, sg, -almost_half); ++ d = -__builtin_fma (g, sg, -shx); ++ sy = __builtin_fma (e, sy2, sy); + fesetenv_register (fe); +- return g + sy * d; ++ return __builtin_fma (sy, d, g); + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrtf.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrtf.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-sqrtf.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,67 @@ +commit 95c26233a1c7dd73a852a4f3bffd2d2eeba5e2fd +Author: Joseph Myers <jos...@codesourcery.com> +Date: Fri Feb 13 16:20:36 2015 +0000 + + Fix powerpc software sqrtf (bug 17967). + + Similarly to sqrt in + <https://sourceware.org/ml/libc-alpha/2015-02/msg00353.html>, the + powerpc sqrtf implementation for when _ARCH_PPCSQ is not defined also + relies on a * b + c being contracted into a fused multiply-add. + Although this contraction is not explicitly disabled for e_sqrtf.c, it + still seems appropriate to make the file explicit about its + requirements by using __builtin_fmaf; this patch does so. + Furthermore, it turns out that doing so fixes the observed inaccuracy + and missing exceptions (that is, that without explicit __builtin_fmaf + usage, it was not being compiled as intended). + + Tested for powerpc32 (hard float). + + [BZ #17967] + * sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Use + __builtin_fmaf instead of relying on contraction of a * b + c. + +diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c +index 034b6f5..a684cf9 100644 +--- a/sysdeps/powerpc/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/fpu/e_sqrtf.c +@@ -87,26 +87,28 @@ __slow_ieee754_sqrtf (float x) + /* Here we have three Newton-Raphson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ +- sd = -(sg * sg - sx); ++ sd = -__builtin_fmaf (sg, sg, -sx); + fsgi = (xi + 0x40000000) >> 1 & 0x7f800000; + sy2 = sy + sy; +- sg = sy * sd + sg; /* 16-bit approximation to sqrt(sx). */ +- e = -(sy * sg - almost_half); ++ sg = __builtin_fmaf (sy, sd, sg); /* 16-bit approximation to ++ sqrt(sx). */ ++ e = -__builtin_fmaf (sy, sg, -almost_half); + SET_FLOAT_WORD (fsg, fsgi); +- sd = -(sg * sg - sx); +- sy = sy + e * sy2; ++ sd = -__builtin_fmaf (sg, sg, -sx); ++ sy = __builtin_fmaf (e, sy2, sy); + if ((xi & 0x7f800000) == 0) + goto denorm; + shx = sx * fsg; +- sg = sg + sy * sd; /* 32-bit approximation to sqrt(sx), +- but perhaps rounded incorrectly. */ ++ sg = __builtin_fmaf (sy, sd, sg); /* 32-bit approximation to ++ sqrt(sx), but perhaps ++ rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; +- e = -(sy * sg - almost_half); +- d = -(g * sg - shx); +- sy = sy + e * sy2; ++ e = -__builtin_fmaf (sy, sg, -almost_half); ++ d = -__builtin_fmaf (g, sg, -shx); ++ sy = __builtin_fmaf (e, sy2, sy); + fesetenv_register (fe); +- return g + sy * d; ++ return __builtin_fmaf (sy, d, g); + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ Added: glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-tabort-le.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-tabort-le.diff (rev 0) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/cvs-ppc-tabort-le.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -0,0 +1,22 @@ +commit 6f7415033813c73fde81da60d209297901f35575 +Author: Adhemerval Zanella <azane...@linux.vnet.ibm.com> +Date: Thu Feb 12 05:34:16 2015 -0600 + + powerpc: Fix TABORT encoding for little endian + + This patch fix the TABORT encoding for toolchains with no support for + HTM builtins. + +diff --git a/sysdeps/unix/sysv/linux/powerpc/htm.h b/sysdeps/unix/sysv/linux/powerpc/htm.h +index edac601..57d5cd6 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/htm.h ++++ b/sysdeps/unix/sysv/linux/powerpc/htm.h +@@ -60,7 +60,7 @@ + #define TBEGIN ".long 0x7c00051d" + #define TEND ".long 0x7c00055d" + #if __BYTE_ORDER == __LITTLE_ENDIAN +-# define TABORT ".byte 0x1d,0x07,%1,0x1d" ++# define TABORT ".byte 0x1d,0x07,%1,0x7c" + #else + # define TABORT ".byte 0x7c,%1,0x07,0x1d" + #endif Deleted: glibc-package/branches/glibc-2.21/debian/patches/powerpc/local-math-logb.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/powerpc/local-math-logb.diff 2015-03-23 02:21:01 UTC (rev 6431) +++ glibc-package/branches/glibc-2.21/debian/patches/powerpc/local-math-logb.diff 2015-03-23 09:15:47 UTC (rev 6432) @@ -1,80 +0,0 @@ -This patch workarounds a GCC bug on PowerPC 32-bit, converting 0 from -int to float might return -0.0. Upstream consider the bug fixed, as it -doesn't affect GCC built for PPC970/Power4 or later. It is clearly -something we don't want in Debian. - -2012-07-22 Aurelien Jarno <aurel...@aurel32.net> - - * sysdeps/ieee754/dbl-64/s_logb.c (__logb): avoid logb_downward (0.0) - return -0.0. - * sysdeps/ieee754/flt-32/s_logbf.c (__logbf): Likewise. - * sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise. - -diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c -index 17aa94b..d7fd59d 100644 ---- a/sysdeps/ieee754/dbl-64/s_logb.c -+++ b/sysdeps/ieee754/dbl-64/s_logb.c -@@ -23,6 +23,7 @@ double - __logb (double x) - { - int32_t lx, ix, rix; -+ double ret; - - EXTRACT_WORDS (ix, lx, x); - ix &= 0x7fffffff; /* high |x| */ -@@ -41,7 +42,9 @@ __logb (double x) - ma = __builtin_clz (ix); - rix -= ma - 12; - } -- return (double) (rix - 1023); -+ ret = (double) (rix - 1023); -+ /* The test is to avoid logb_downward (0.0) == -0.0. */ -+ return ret == -0.0 ? 0.0 : ret; - } - weak_alias (__logb, logb) - #ifdef NO_LONG_DOUBLE -diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c -index e2b3aaa..1dce251 100644 ---- a/sysdeps/ieee754/flt-32/s_logbf.c -+++ b/sysdeps/ieee754/flt-32/s_logbf.c -@@ -20,6 +20,7 @@ float - __logbf (float x) - { - int32_t ix, rix; -+ float ret; - - GET_FLOAT_WORD (ix, x); - ix &= 0x7fffffff; /* high |x| */ -@@ -33,6 +34,8 @@ __logbf (float x) - though it were normalized. */ - rix -= __builtin_clz (ix) - 9; - } -- return (float) (rix - 127); -+ ret = (float) (rix - 127); -+ /* The test is to avoid logb_downward (0.0) == -0.0. */ -+ return ret == -0.0 ? 0.0 : ret; - } - weak_alias (__logbf, logbf) -diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c -index 92ce2c1..db030a7 100644 ---- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c -+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c -@@ -27,6 +27,7 @@ long double - { - int64_t hx, rhx; - double xhi; -+ long double ret; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); -@@ -40,7 +41,9 @@ __logbl (long double x) - though it were normalized. */ - rhx -= __builtin_clzll (hx) - 12; - } -- return (long double) (rhx - 1023); -+ ret = (long double) (rhx - 1023); -+ /* The test is to avoid logb_downward (0.0) == -0.0. */ -+ return ret == -0.0 ? 0.0 : ret; - } - #ifndef __logbl - long_double_symbol (libm, __logbl, logbl); Modified: glibc-package/branches/glibc-2.21/debian/patches/series =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/series 2015-03-23 02:21:01 UTC (rev 6431) +++ glibc-package/branches/glibc-2.21/debian/patches/series 2015-03-23 09:15:47 UTC (rev 6432) @@ -52,6 +52,8 @@ arm/local-soname-hack.diff arm/local-vfp-sysdeps.diff arm/unsubmitted-ldso-multilib.diff +arm/cvs-arm-sfi_breg.diff +arm/cvs-memcpy-memmove-always-bx.diff hppa/local-inlining.diff hppa/local-stack-grows-up.diff @@ -168,8 +170,13 @@ mips/local-r10k.diff mips/submitted-rld_map.diff -powerpc/local-math-logb.diff powerpc/local-powerpc8xx-dcbz.diff +powerpc/cvs-ppc-sqrt.diff +powerpc/cvs-ppc-sqrtf.diff +powerpc/cvs-ppc-pow.diff +powerpc/cvs-ppc-feraiseexcept.diff +powerpc/cvs-power7-strncpy.diff +powerpc/cvs-ppc-tabort-le.diff s390/submitted-nexttowardf.diff @@ -240,3 +247,7 @@ any/cvs-vismain-pie.diff any/local-tester-gcc-4.9.diff any/local-xfail-stdlib-linkns.diff +any/cvs-localplt-new-readelf.diff +any/cvs-make-typo.diff +any/cvs-logbl-accuracy.diff +any/local-math-logb.diff -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1yzysa-0005vw...@moszumanska.debian.org