summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-01-18 17:11:00 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-01-18 17:11:00 +0000
commitfa4604e04e973ca3abd6aeaeec07bbf0fc38d9af (patch)
treecb548633e3b698c18fe6339137307cbf28dd0d82
parent00ed3326c2fac75592e173e9d731452e9bb769ff (diff)
downloadeglibc2-fa4604e04e973ca3abd6aeaeec07bbf0fc38d9af.tar.gz
Merge changes between r22176 and r22241 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@22242 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog641
-rw-r--r--libc/Makeconfig83
-rw-r--r--libc/Makefile2
-rw-r--r--libc/Makerules8
-rw-r--r--libc/NEWS3
-rw-r--r--libc/Rules23
-rw-r--r--libc/bits/byteswap.h2
-rw-r--r--libc/bits/types.h13
-rw-r--r--libc/catgets/Makefile2
-rwxr-xr-xlibc/catgets/test-gencat.sh4
-rw-r--r--libc/config.make.in1
-rwxr-xr-xlibc/configure33
-rw-r--r--libc/configure.in26
-rw-r--r--libc/debug/Makefile8
-rw-r--r--libc/debug/tst-backtrace2.c27
-rw-r--r--libc/debug/tst-backtrace3.c22
-rw-r--r--libc/debug/tst-backtrace4.c11
-rw-r--r--libc/debug/tst-backtrace5.c12
-rw-r--r--libc/elf/Makefile32
-rw-r--r--libc/elf/elf.h180
-rw-r--r--libc/elf/link.h4
-rw-r--r--libc/grp/Makefile2
-rw-r--r--libc/grp/tst_fgetgrent.sh10
-rw-r--r--libc/iconvdata/Makefile2
-rwxr-xr-xlibc/iconvdata/tst-table.sh6
-rwxr-xr-xlibc/iconvdata/tst-tables.sh4
-rw-r--r--libc/include/complex.h12
-rw-r--r--libc/include/features.h11
-rw-r--r--libc/include/stdlib.h1
-rw-r--r--libc/intl/Makefile10
-rwxr-xr-xlibc/intl/tst-gettext.sh4
-rw-r--r--libc/intl/tst-gettext2.sh4
-rwxr-xr-xlibc/intl/tst-gettext4.sh4
-rw-r--r--libc/intl/tst-gettext6.sh4
-rwxr-xr-xlibc/intl/tst-translit.sh4
-rw-r--r--libc/io/Makefile2
-rw-r--r--libc/libio/Makefile2
-rwxr-xr-xlibc/libio/test-freopen.sh4
-rw-r--r--libc/localedata/ChangeLog43
-rw-r--r--libc/localedata/Makefile27
-rw-r--r--libc/localedata/bug-setlocale1-static.c1
-rw-r--r--libc/localedata/bug-setlocale1.c18
-rw-r--r--libc/localedata/sort-test.sh6
-rwxr-xr-xlibc/localedata/tst-fmon.sh5
-rwxr-xr-xlibc/localedata/tst-mbswcs.sh12
-rw-r--r--libc/localedata/tst-numeric.sh4
-rwxr-xr-xlibc/localedata/tst-trans.sh3
-rw-r--r--libc/malloc/Makefile2
-rw-r--r--libc/malloc/arena.c3
-rw-r--r--libc/malloc/malloc.c12
-rwxr-xr-xlibc/malloc/tst-mtrace.sh4
-rw-r--r--libc/manual/install.texi5
-rw-r--r--libc/manual/pattern.texi30
-rw-r--r--libc/math/Makefile5
-rw-r--r--libc/math/bits/mathcalls.h2
-rw-r--r--libc/math/k_casinh.c85
-rw-r--r--libc/math/k_casinhf.c85
-rw-r--r--libc/math/k_casinhl.c92
-rw-r--r--libc/math/libm-test.inc37
-rw-r--r--libc/math/s_cacos.c26
-rw-r--r--libc/math/s_cacosf.c26
-rw-r--r--libc/math/s_cacosl.c26
-rw-r--r--libc/math/s_casinh.c36
-rw-r--r--libc/math/s_casinhf.c36
-rw-r--r--libc/math/s_casinhl.c43
-rw-r--r--libc/misc/Versions1
-rw-r--r--libc/misc/error.c1
-rw-r--r--libc/misc/mktemp.c3
-rw-r--r--libc/nptl/ChangeLog27
-rw-r--r--libc/nptl/Makefile12
-rw-r--r--libc/nptl/allocatestack.c5
-rw-r--r--libc/nptl/sem_open.c2
-rwxr-xr-xlibc/nptl/tst-tls6.sh6
-rw-r--r--libc/ports/ChangeLog.aarch6439
-rw-r--r--libc/ports/ChangeLog.hppa8
-rw-r--r--libc/ports/ChangeLog.m68k5
-rw-r--r--libc/ports/ChangeLog.mips5
-rw-r--r--libc/ports/ChangeLog.tile6
-rw-r--r--libc/ports/sysdeps/aarch64/bits/setjmp.h2
-rw-r--r--libc/ports/sysdeps/aarch64/bzero.S27
-rw-r--r--libc/ports/sysdeps/aarch64/memcmp.S151
-rw-r--r--libc/ports/sysdeps/aarch64/memcpy.S176
-rw-r--r--libc/ports/sysdeps/aarch64/memmove.S312
-rw-r--r--libc/ports/sysdeps/aarch64/memset.S229
-rw-r--r--libc/ports/sysdeps/aarch64/strcmp.S155
-rw-r--r--libc/ports/sysdeps/aarch64/strlen.S117
-rw-r--r--libc/ports/sysdeps/aarch64/sysdep.h31
-rw-r--r--libc/ports/sysdeps/arm/Makefile5
-rw-r--r--libc/ports/sysdeps/hppa/fpu/fpu_control.h4
-rw-r--r--libc/ports/sysdeps/m68k/bits/byteswap.h1
-rw-r--r--libc/ports/sysdeps/mips/Makefile5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/ipc.h4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure.in4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed1
-rw-r--r--libc/posix/Makefile21
-rwxr-xr-xlibc/posix/globtest.sh101
-rw-r--r--libc/posix/sys/types.h4
-rw-r--r--libc/posix/tst-exec-static.c1
-rw-r--r--libc/posix/tst-exec.c18
-rw-r--r--libc/posix/tst-spawn-static.c1
-rw-r--r--libc/posix/tst-spawn.c33
-rwxr-xr-xlibc/posix/wordexp-tst.sh22
-rw-r--r--libc/rt/Makefile2
-rw-r--r--libc/stdio-common/Makefile6
-rw-r--r--libc/stdio-common/tst-printf.sh4
-rwxr-xr-xlibc/stdio-common/tst-unbputc.sh4
-rw-r--r--libc/stdlib/Makefile2
-rw-r--r--libc/stdlib/stdlib.h13
-rwxr-xr-xlibc/stdlib/tst-fmtmsg.sh4
-rw-r--r--libc/string/Makefile2
-rw-r--r--libc/string/byteswap.h4
-rw-r--r--libc/string/endian.h20
-rw-r--r--libc/string/string.h2
-rw-r--r--libc/sysdeps/generic/inttypes.h4
-rw-r--r--libc/sysdeps/gnu/netinet/tcp.h80
-rw-r--r--libc/sysdeps/i386/dl-machine.h9
-rw-r--r--libc/sysdeps/i386/fpu/fenv_private.h2
-rw-r--r--libc/sysdeps/i386/fpu/libm-test-ulps6
-rw-r--r--libc/sysdeps/ieee754/dbl-64/atnat.h4
-rw-r--r--libc/sysdeps/ieee754/dbl-64/atnat2.h7
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpa.c720
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpa.h56
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpa2.h50
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpatan.h3
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpatan2.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpexp.c152
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpexp.h121
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mpsqrt.h3
-rw-r--r--libc/sysdeps/ieee754/dbl-64/mptan.c2
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_nearbyint.c8
-rw-r--r--libc/sysdeps/ieee754/dbl-64/ulog.h4
-rw-r--r--libc/sysdeps/ieee754/dbl-64/utan.h6
-rw-r--r--libc/sysdeps/powerpc/bits/mathdef.h4
-rw-r--r--libc/sysdeps/powerpc/fpu/bits/fenvinline.h6
-rw-r--r--libc/sysdeps/powerpc/fpu/bits/mathinline.h2
-rw-r--r--libc/sysdeps/powerpc/fpu/fpu_control.h48
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c807
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c807
-rw-r--r--libc/sysdeps/s390/bits/byteswap.h3
-rw-r--r--libc/sysdeps/sh/Makefile5
-rw-r--r--libc/sysdeps/sparc/fpu/libm-test-ulps188
-rw-r--r--libc/sysdeps/sparc/sparc-ifunc.h62
-rw-r--r--libc/sysdeps/sparc/sparc32/fpu/s_fdim.S41
-rw-r--r--libc/sysdeps/sparc/sparc32/fpu/s_fdimf.S35
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S82
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile6
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S61
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S40
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S2
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S58
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S37
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S2
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S34
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S19
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S32
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S12
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S61
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S40
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S2
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S58
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S37
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S2
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S65
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S19
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S61
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S12
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S57
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S19
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S53
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S12
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S40
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S35
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S72
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S64
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S64
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S56
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S71
-rw-r--r--libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S83
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/Makefile5
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S57
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S38
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S2
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S37
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S2
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S57
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S38
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S2
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S39
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S2
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S61
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S12
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S60
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S12
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S53
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S12
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S52
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S12
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_fdim.S32
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_fdimf.S31
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_nearbyint.S63
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_nearbyintf.S62
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_trunc.S55
-rw-r--r--libc/sysdeps/sparc/sparc64/fpu/s_truncf.S54
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/Makefile9
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/add_n-vis3.S67
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/add_n.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S87
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/addmul_1.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S73
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/mul_1.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S71
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/sub_n.S56
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S87
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/submul_1.S56
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h7
-rw-r--r--libc/sysdeps/unix/sysv/linux/bits/socket.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/malloc-sysdep.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/Versions1
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c3
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/init-first.c5
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h28
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h29
-rw-r--r--libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c30
-rw-r--r--libc/sysdeps/unix/sysv/linux/scsi/sg.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies (renamed from libc/sysdeps/sparc/sparc32/sparcv9/fpu/unix/sysv/linux/multiarch/Implies)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/sysmacros.h15
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86/bits/environments.h25
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h2
-rw-r--r--libc/sysdeps/x86/bits/byteswap.h2
-rw-r--r--libc/sysdeps/x86/bits/setjmp.h2
-rw-r--r--libc/sysdeps/x86/fpu/bits/mathinline.h5
-rw-r--r--libc/sysdeps/x86_64/dl-machine.h20
-rw-r--r--libc/sysdeps/x86_64/fpu/libm-test-ulps15
-rw-r--r--libc/wcsmbs/wchar.h8
241 files changed, 7999 insertions, 2004 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 3f37b8440..730538e0c 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,644 @@
+2013-01-18 Joseph Myers <joseph@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+ Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * debug/tst-backtrace2.c: New file.
+ * debug/tst-backtrace3.c: Likewise.
+ * debug/tst-backtrace4.c: Likewise.
+ * debug/tst-backtrace5.c: Likewise.
+ * debug/Makefile (CFLAGS-tst-backtrace2.c): New variable.
+ (CFLAGS-tst-backtrace3.c): Likewise.
+ (CFLAGS-tst-backtrace4.c): Likewise.
+ (CFLAGS-tst-backtrace5.c): Likewise.
+ (LDFLAGS-tst-backtrace2): Likewise.
+ (LDFLAGS-tst-backtrace3): Likewise.
+ (LDFLAGS-tst-backtrace4): Likewise.
+ (LDFLAGS-tst-backtrace5): Likewise.
+ (tests): Add new tests tst-backtrace2, tst-backtrace3,
+ tst-backtrace4 and tst-backtrace5.
+
+2013-01-18 Anton Blanchard <anton@samba.org>
+ Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/init-first.c: Rename
+ __kernel_vdso_get_tbfreq to __kernel_get_tbfreq.
+ * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Add parameter to
+ INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK to specify return type.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+ (INTERNAL_VSYSCALL_NCS): Change "=&r" in inline asm output regs list to
+ "+r" and remove output regs list as redundant. Add explicit inline
+ asm to specify register of return val to work around compiler codegen
+ bug. Remove (int) cast on return value. Add return type parameter to
+ use in macro so that this macro does not truncate return value for
+ 64-bit values.
+ (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Add return type parameter and
+ pass to INTERNAL_VSYSCALL_NCS.
+ (INLINE_VSYSCALL): Add 'long int' as return type to
+ INTERNAL_VSYSCALL_NCS macro invocation.
+ (INTERNAL_VSYSCALL): Add 'long int' as return type to
+ INTERNAL_VSYSCALL_NCS macro invocation.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
+
+2013-01-18 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ [BZ #14496]
+ * sysdeps/i386/fpu/fenv_private.h (libc_feupdateenv_test_sse):
+ Fix application of SIMD FP exception mask.
+
+ * sysdeps/ieee754/dbl-64/mpa.h (__pow_mp): New function to get an
+ mp_no from a power of two.
+ * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove
+ __mpexp_twomm1. Use __pow_mp.
+
+ * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove unnecessary
+ multiplication.
+
+2013-01-17 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/fpu/libm-test-ulps: Update.
+
+2013-01-17 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #15023]
+ * include/complex.h: Condition contents on [!_COMPLEX_H].
+ (__kernel_casinhf): New prototype.
+ (__kernel_casinh): Likewise.
+ (__kernel_casinhl): Likewise.
+ * math/Makefile (libm_calls): Add k_casinh.
+ * math/k_casinh.c: New file.
+ * math/k_casinhf.c: Likewise.
+ * math/k_casinhl.c: Likewise.
+ * math/s_cacos.c (__cacos): Implement using __kernel_casinh for
+ finite nonzero arguments.
+ * math/s_cacosf.c (__cacosf): Implement using __kernel_casinhf for
+ finite nonzero arguments.
+ * math/s_cacosl.c (__cacosl): Implement using __kernel_casinhl for
+ finite nonzero arguments.
+ * math/s_casinh.c: Do not include <float.h>.
+ (__casinh): Move code for finite nonzero arguments to k_casinh.c.
+ * math/s_casinhf.c: Do not include <float.h>.
+ (__casinhf): Move code for finite nonzero arguments to
+ k_casinhf.c.
+ * math/s_casinhl.c: Do not include <float.h>.
+ [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Do not undefine and
+ redefine.
+ (__casinhl): Move code for finite nonzero arguments to
+ k_casinhl.c.
+ * math/libm-test.inc (cacos_test): Add more tests.
+ * sysdeps/i386/fpu/libm-test-ulps: Update.
+ * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
+2013-01-17 Pino Toscano <toscano.pino@tiscali.it>
+
+ * sysdeps/unix/sysv/linux/malloc-sysdep.h (HAVE_MREMAP): New define.
+ * malloc/malloc.c: Include <unistd.h> and <malloc-sysdep.h>.
+ [!HAVE_MREMAP]: Remove [defined linux] case.
+ * malloc/arena.c: Do not include <malloc-sysdep.h>.
+
+2013-01-17 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/mpa.c: Fix header comment.
+
+2013-01-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/elf.h (R_386_SIZE32): New relocation.
+ * sysdeps/i386/dl-machine.h (elf_machine_rel): Handle
+ R_386_SIZE32.
+ (elf_machine_rela): Likewise.
+ * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Handle
+ R_X86_64_SIZE64 and R_X86_64_SIZE32.
+
+2013-01-17 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/bits/mathdef.h [_SOFT_FLOAT || __NO_FPRS__]
+ (FP_FAST_FMA): Do not define.
+ [_SOFT_FLOAT || __NO_FPRS__] (FP_FAST_FMAF): Likewise.
+ * sysdeps/powerpc/fpu/bits/fenvinline.h [__GNUC__ && !_SOFT_FLOAT
+ && !__NO_MATH_INLINES]: Add [!__NO_FPRS__] condition.
+ * sysdeps/powerpc/fpu/bits/mathinline.h [__GNUC__ &&
+ !_SOFT_FLOAT]: Likewise.
+ * sysdeps/powerpc/fpu/fpu_control.h [_SOFT_FLOAT || __NO_FPRS__]
+ [_SOFT_FLOAT || __NO_FPRS__] (_FPU_RESERVED): Define with generic
+ value.
+ [_SOFT_FLOAT || __NO_FPRS__] (_FPU_DEFAULT): Likewise.
+ [_SOFT_FLOAT || __NO_FPRS__] (fpu_control_t): Likewise.
+ [_SOFT_FLOAT || __NO_FPRS__] (_FPU_GETCW): Likewise.
+ [_SOFT_FLOAT || __NO_FPRS__] (_FPU_SETCW): Likewise.
+ [_SOFT_FLOAT || __NO_FPRS__] (__fpu_control): Likewise.
+ [!_SOFT_FLOAT && !__NO_FPRS__]: Condition previous contents of
+ file.
+
+2013-01-16 Andreas Schwab <schwab@suse.de>
+
+ [BZ #14327]
+ * include/stdlib.h (__mktemp): Add declaration.
+ * misc/mktemp.c (__mktemp): Renamed from mktemp, add weak alias.
+ * misc/Versions (GLIBC_PRIVATE): Add __mktemp.
+
+2013-01-16 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/atnat.h: Remove constant value
+ definitions.
+ * sysdeps/ieee754/dbl-64/atnat2.h: Likewise.
+ * sysdeps/ieee754/dbl-64/mpa.c: Do not include mpa2.h.
+ * sysdeps/ieee754/dbl-64/mpa.h: Move all constant value
+ definitions here.
+ * sysdeps/ieee754/dbl-64/mpa2.h: Remove.
+ * sysdeps/ieee754/dbl-64/mpatan.h: Remove constant value
+ definitions.
+ * sysdeps/ieee754/dbl-64/mpatan2.c (__mpatan2): Remove ZERO
+ and ONE.
+ * sysdeps/ieee754/dbl-64/mpexp.c: Do not include mpexp.h.
+ * sysdeps/ieee754/dbl-64/mpexp.h: Remove.
+ * sysdeps/ieee754/dbl-64/mpsqrt.h: Remove constant value
+ definitions.
+ * sysdeps/ieee754/dbl-64/mptan.c (__mptan): Remove MONE.
+ * sysdeps/ieee754/dbl-64/ulog.h: Remove constant value
+ definitions.
+ * sysdeps/ieee754/dbl-64/utan.h: Likewise.
+
+ * sysdeps/ieee754/dbl-64/mpa2.h: Fix the value of TWO.
+
+2013-01-15 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add vis3
+ trunc{,f} to libm-sysdep_routes.
+ * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_trunc.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_truncf.S: New file.
+
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add vis3
+ nearbyint{,f} to libm-sysdep_routes.
+ * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S:
+ New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S:
+ New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_nearbyint.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_nearbyintf.S: New file.
+
+ * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
+ libc_feholdexcept and libc_fesetenv.
+
+2013-01-15 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/scsi/sg.h: Include stddef.h.
+
+2013-01-14 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC2): New macro.
+ (SPARC_ASM_VIS2_IFUNC): Likewise.
+ (SPARC_ASM_VIS3_VIS2_IFUNC): Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S: Make
+ use of 'siam' instruction.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S:
+ Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S:
+ Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S:
+ Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S: New
+ file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S: New file.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S: Hook in
+ new VIS2 routines.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S:
+ Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add new VIS2
+ routines to libm-sysdep_routines.
+ * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
+
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Add vis3
+ fdim/fdimf to libm-sysdep_routines.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: New
+ file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: New file.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: New file.
+ * sysdeps/sparc/sparc32/fpu/s_fdim.S: New file.
+ * sysdeps/sparc/sparc32/fpu/s_fdimf.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_fdim.S: New file.
+ * sysdeps/sparc/sparc64/fpu/s_fdimf.S: New file.
+
+2013-01-14 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/mpa.c (__mul): Add a local variable
+ to optimize copies.
+
+ * sysdeps/ieee754/dbl-64/mpa.c: Fix formatting.
+ * sysdeps/powerpc/powerpc32/power4/fpu/mpa.c: Likewise.
+ * sysdeps/powerpc/powerpc64/power4/fpu/mpa.c: Likewise.
+
+ * sysdeps/powerpc/powerpc32/power4/fpu/mpa.c (__inv): Remove
+ local variable MPTWO.
+ * sysdeps/powerpc/powerpc64/power4/fpu/mpa.c (__inv):
+ Likewise.
+
+2013-01-13 Mike Frysinger <vapier@gentoo.org>
+
+ * manual/pattern.texi (Flags for Globbing): Move GLOB_NOSORT after
+ GLOB_NOESCAPE.
+
+2013-01-13 Mike Frysinger <vapier@gentoo.org>
+
+ * manual/pattern.texi (Flags for Globbing): Highlight GNU extensions.
+
+2013-01-13 Mike Frysinger <vapier@gentoo.org>
+
+ * manual/pattern.texi (glob_t): Document gl_flags.
+ (glob64_t): Likewise.
+
+2013-01-11 David S. Miller <davem@davemloft.net>
+
+ * math/Makefile (gmp-objs): Use $(gmp-sysdep_routines).
+ * sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = math]
+ (gmp-sysdep_routines): New variable. Add VIS3 optimized GMP routines.
+ * sysdeps/sparc/sparc64/multiarch/add_n-vis3.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/add_n.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/addmul_1.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/mul_1.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/sub_n.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S: New file.
+ * sysdeps/sparc/sparc64/multiarch/submul_1.S: New file.
+
+ * sysdeps/sparc/sparc32/sparcv9/mul_1.S: Properly optimize for 32-bit
+ sparc V9 rather than using V8 code.
+ * sysdeps/sparc/sparc32/sparcv9/addmul_1.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/submul_1.S: Likewise.
+
+ * sysdeps/sparc/sparc32/sparcv9/fpu/unix/sysv/linux/multiarch/Implies:
+ Move to...
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies:
+ Here.
+
+2013-01-11 Roland McGrath <roland@hack.frob.com>
+
+ * configure.in (sysnames): Use $multi_arch_d in setting up $mach list,
+ not in the main loop.
+ * configure: Regenerated.
+
+2013-01-11 Joseph Myers <joseph@codesourcery.com>
+
+ * include/features.h (__GLIBC_HAVE_LONG_LONG): Remove.
+ * bits/byteswap.h [__GLIBC_HAVE_LONG_LONG]: Change #elif condition
+ to just #else.
+ * bits/types.h [__GLIBC_HAVE_LONG_LONG]: Likewise. Remove
+ [!__GLIBC_HAVE_LONG_LONG] case.
+ * posix/sys/types.h [__GLIBC_HAVE_LONG_LONG]: Change #elif
+ condition to just #else.
+ * stdlib/stdlib.h [__USE_ISOC99 || (__GLIBC_HAVE_LONG_LONG &&
+ __USE_MISC)]: Change all uses to [__USE_ISOC99 || __USE_MISC].
+ [__GLIBC_HAVE_LONG_LONG && __USE_BSD]: Change to [__USE_BSD].
+ * string/byteswap.h [__GLIBC_HAVE_LONG_LONG]: Make code
+ unconditional.
+ * string/endian.h [__GLIBC_HAVE_LONG_LONG]: Likewise.
+ * sysdeps/s390/bits/byteswap.h [__GLIBC_HAVE_LONG_LONG]: Change
+ #elif condition to just #else.
+ * sysdeps/unix/sysv/linux/sys/sysmacros.h
+ [__GLIBC_HAVE_LONG_LONG]: Make code unconditional.
+ * sysdeps/x86/bits/byteswap.h [__GLIBC_HAVE_LONG_LONG]: Change
+ #elif condition to just #else.
+
+2013-01-11 Steve Ellcey <sellcey@mips.com>
+
+ * elf/elf.h (EF_MIPS_ARCH_32): Fix value.
+ (EF_MIPS_ARCH_64): Fix value.
+ (EF_MIPS_ARCH_32R2): New.
+ (EF_MIPS_ARCH_64R2): New.
+
+2013-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makeconfig (+link-pie-before-libc): New.
+ (+link-pie-after-libc): Likewise.
+ (+link-pie-tests): Likewise.
+ (+link-pie): Rewritten.
+ (link-before-libc): Remove $(config-LDFLAGS).
+ (+link): Add $(rtld-LDFLAGS) after $(+link-before-libc).
+ (+link-tests): Add $(rtld-tests-LDFLAGS) after $(+link-before-libc).
+ (config-LDFLAGS): Renamed to ...
+ (rtld-LDFLAGS): This.
+ (rtld-tests-LDFLAGS): New macro.
+ (link-libc-rpath-link): Likewise.
+ (link-libc-tests-rpath-link): Likewise.
+ (link-libc-before-gnulib): Remove -Wl,-rpath-link=$(rpath-link).
+ (link-libc): Prepand $(link-libc-rpath-link).
+ (link-libc-tests): Prepand $(link-libc-tests-rpath-link).
+ (test-program-prefix): New macro.
+ (test-via-rtld-prefix): Likewise.
+ (test-program-cmd): Likewise.
+ (host-test-program-cmd): Likewise.
+ * Makefile ($(common-objpfx)testrun.sh): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * Makerules ($(LINK.o)): Replace $(config-LDFLAGS) with
+ $(rtld-LDFLAGS).
+ ($(common-objpfx)shlib.lds): Likewise.
+ (build-module-helper): Likewise.
+ ($(common-objpfx)format.lds): Likewise.
+ * Rules (binaries-pie-tests): New.
+ (binaries-pie-notests): Likewise.
+ (binaries-pie): Rewritten.
+ ($(addprefix $(objpfx),$(binaries-pie))): Renamed to ...
+ ($(addprefix $(objpfx),$(binaries-pie-notests))): This.
+ ($(addprefix $(objpfx),$(binaries-pie-tests))): New.
+ (make-test-out): Replace $(host-built-program-cmd) with
+ $(host-test-program-cmd).
+ * config.make.in (build-hardcoded-path-in-tests): New variable.
+ * configure.in (--enable-hardcoded-path-in-tests): New configure
+ option.
+ (hardcoded_path_in_tests): New AC_SUBST.
+ * configure: Regenerated.
+ * catgets/Makefile ($(objpfx)test-gencat.out): Replace
+ $(built-program-cmd) with $(test-program-cmd).
+ * catgets/test-gencat.sh (run_program_cmd): Renamed to ...
+ (test_program_cmd): This.
+ * elf/Makefile ($(objpfx)order.out): Run test with
+ $(test-program-prefix).
+ ($(objpfx)order2.out): Likewise.
+ ($(objpfx)tst-initorder.out): Likewise.
+ ($(objpfx)tst-initorder2.out): Likewise.
+ ($(objpfx)tst-array1.out): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ ($(objpfx)tst-array1-static.out): Likewise.
+ ($(objpfx)tst-array2.out): Likewise.
+ ($(objpfx)tst-array3.out): Likewise.
+ ($(objpfx)tst-array4.out): Likewise.
+ ($(objpfx)tst-array5.out): Likewise.
+ ($(objpfx)tst-array5-static.out): Likewise.
+ (tst-stackguard1-ARGS): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ * grp/Makefile ($(objpfx)tst_fgetgrent.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * grp/tst_fgetgrent.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * iconvdata/Makefile ($(objpfx)tst-tables.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * iconvdata/tst-table.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * iconvdata/tst-tables.sh: Likewise.
+ * intl/Makefile ($(objpfx)tst-gettext.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ ($(objpfx)tst-translit.out): Likewise.
+ ($(objpfx)tst-gettext2.out): Likewise.
+ ($(objpfx)tst-gettext4.out): Likewise.
+ ($(objpfx)tst-gettext6.out): Likewise.
+ * intl/tst-gettext.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * intl/tst-gettext2.sh: Likewise.
+ * intl/tst-gettext4.sh Likewise.
+ * intl/tst-gettext6.sh: Likewise.
+ * intl/tst-translit.sh: Likewise.
+ * io/Makefile ($(objpfx)ftwtest.out): Replace $(run-program-cmd)
+ with $(test-program-cmd).
+ * libio/Makefile ($(objpfx)test-freopen.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * libio/test-freopen.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * malloc/Makefile ($(objpfx)tst-mtrace.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * malloc/tst-mtrace.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * manual/install.texi: Document --enable-hardcoded-path-in-tests.
+ * posix/Makefile ($(objpfx)globtest.out): Replace
+ $(run-via-rtld-prefix) and $(test-wrapper) with
+ $(test-program-prefix) and $(test-via-rtld-prefix).
+ ($(objpfx)wordexp-tst.out): Replace $(run-program-prefix) with
+ $(test-program-prefix).
+ (tst-exec-ARGS): Replace $(host-built-program-cmd) with
+ $(host-test-program-cmd).
+ (tst-spawn-ARGS): Likewise.
+ ($(objpfx)tst-rxspencer-mem): Replace $(run-program-prefix) with
+ $(test-program-prefix).
+ * posix/globtest.sh (un_via_rtld_prefix): Renamed to ...
+ (test_via_rtld_prefix): This.
+ (test_wrapper): Renamed to ...
+ (test_program_prefix): This.
+ (run_program_prefix): Replaced by test_program_prefix.
+ * posix/wordexp-tst.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * rt/Makefile (tst-mqueue7-ARGS): Replace $(host-built-program-cmd)
+ with $(host-test-program-cmd).
+ * stdio-common/Makefile ($(objpfx)tst-unbputc.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ ($(objpfx)tst-printf.out): Likewise.
+ ($(objpfx)tst-setvbuf1.out): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ * stdio-common/tst-printf.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * stdio-common/tst-unbputc.sh: Likewise.
+ * stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * stdlib/tst-fmtmsg.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * string/Makefile ($(objpfx)tst-svc.out): Replace
+ $(built-program-cmd) with $(test-program-cmd).
+
+2013-01-11 Andreas Jaeger <aj@suse.de>
+
+ [BZ #15003]
+ * sysdeps/unix/sysv/linux/bits/socket.h (MSG_FASTOPEN): New
+ value. Sync with Linux 3.7.
+
+2013-01-10 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc32/sparcv9/mul_1.S: Revert previous changes.
+ * sysdeps/sparc/sparc32/sparcv9/addmul_1.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/submul_1.S: Likewise.
+
+2013-01-10 Roland McGrath <roland@hack.frob.com>
+
+ * configure.in (sysnames): Drop use of $m0sub and $msub, which are
+ never set.
+ * configure: Regenerated.
+
+2013-01-10 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc32/sparcv9/mul_1.S: Properly optimize for 32-bit
+ sparc V9 rather than using V8 code.
+ * sysdeps/sparc/sparc32/sparcv9/addmul_1.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/submul_1.S: Likewise.
+
+2013-01-10 Roland McGrath <roland@hack.frob.com>
+
+ * elf/elf.h (DT_SPARC_REGISTER, DT_SPARC_NUM): Fix whitespace.
+ (EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_XGOT): Likewise.
+ (EF_MIPS_64BIT_WHIRL, EF_MIPS_ABI2, EF_MIPS_ABI_ON32): Likewise.
+ (EF_MIPS_ARCH, EF_MIPS_ARCH_1, EF_MIPS_ARCH_2): Likewise.
+ (EF_MIPS_ARCH_3, EF_MIPS_ARCH_4, EF_MIPS_ARCH_5): Likewise.
+ (EF_MIPS_ARCH_32, EF_MIPS_ARCH_64): Likewise.
+ (E_MIPS_ARCH_1): Define in terms of EF_MIPS_ARCH_* counterpart.
+ (E_MIPS_ARCH_2, E_MIPS_ARCH_3, E_MIPS_ARCH_4, E_MIPS_ARCH_5): Likewise.
+ (E_MIPS_ARCH_32, E_MIPS_ARCH_64): Likewise.
+ (SHN_MIPS_ACOMMON, SHN_MIPS_TEXT, SHN_MIPS_DATA): Fix whitespace.
+ (SHN_MIPS_SCOMMON, SHN_MIPS_SUNDEFINED): Likewise.
+ (SHT_MIPS_LIBLIST, SHT_MIPS_MSYM, SHT_MIPS_CONFLICT): Likewise.
+ (SHT_MIPS_GPTAB, SHT_MIPS_UCODE, SHT_MIPS_DEBUG): Likewise.
+ (SHT_MIPS_REGINFO, SHT_MIPS_PACKAGE, SHT_MIPS_PACKSYM): Likewise.
+ (SHT_MIPS_RELD, SHT_MIPS_IFACE, SHT_MIPS_CONTENT): Likewise.
+ (SHT_MIPS_OPTIONS, SHT_MIPS_SHDR, SHT_MIPS_FDESC): Likewise.
+ (SHT_MIPS_EXTSYM, SHT_MIPS_DENSE, SHT_MIPS_PDESC): Likewise.
+ (SHT_MIPS_LOCSYM, SHT_MIPS_AUXSYM, SHT_MIPS_OPTSYM): Likewise.
+ (SHT_MIPS_LOCSTR, SHT_MIPS_LINE, SHT_MIPS_RFDESC): Likewise.
+ (SHT_MIPS_DELTASYM, SHT_MIPS_DELTAINST, SHT_MIPS_DELTACLASS): Likewise.
+ (SHT_MIPS_DELTADECL, SHT_MIPS_SYMBOL_LIB, SHT_MIPS_EVENTS): Likewise.
+ (SHT_MIPS_TRANSLATE, SHT_MIPS_PIXIE, SHT_MIPS_XLATE): Likewise.
+ (SHT_MIPS_XLATE_DEBUG, SHT_MIPS_WHIRL, SHT_MIPS_EH_REGION): Likewise.
+ (SHT_MIPS_XLATE_OLD, SHT_MIPS_PDR_EXCEPTION): Likewise.
+ (SHF_MIPS_GPREL, SHF_MIPS_MERGE, SHF_MIPS_ADDR): Likewise.
+ (SHF_MIPS_STRINGS, SHF_MIPS_NOSTRIP, SHF_MIPS_LOCAL): Likewise.
+ (SHF_MIPS_NAMES, SHF_MIPS_NODUPE): Likewise.
+
+2013-01-10 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/fpu/libm-test-ulps: Update.
+
+2013-01-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * posix/Makefile (tests-static): New variable.
+ (tests): Add $(tests-static).
+ (tst-exec-static-ARGS): New variable.
+ (tst-spawn-static-ARGS): Likewise.
+ * posix/tst-exec-static.c: New file.
+ * posix/tst-spawn-static.c: Likewise.
+ * posix/tst-exec.c: Support run directly.
+ * posix/tst-spawn.c: Likewise.
+
+2013-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * elf/link.h (struct dl_phdr_info): Use __extension__ with long
+ long.
+ * math/bits/mathcalls.h (llrint): Likewise.
+ (llround): Likewise.
+ * stdlib/stdlib.h (struct drand48_data): Likewise.
+ * sysdeps/generic/inttypes.h (imaxdiv_t): Likewise.
+ * sysdeps/s390/bits/byteswap.h (__bswap_64): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/ipc.h (struct ipc_perm):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct fpu):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86/sys/procfs.h [__x86_64__]
+ (elf_greg_t): Likewise.
+ * sysdeps/x86/bits/setjmp.h [__x86_64__ && __WORDSIZE != 64]
+ (__jmp_buf): Likewise.
+ * sysdeps/x86/fpu/bits/mathinline.h (llrintf): Likewise, for all
+ definitions.
+ (llrint): Likewise, for all definitions.
+ (llrintl): Likewise.
+
+ * string/string.h [__USE_BSD && __USE_GNU && __GNUC__] (ffsll):
+ Remove [__GNUC__] condition.
+ * wcsmbs/wchar.h [__USE_ISOC99 || (__GNUC__ && __USE_GNU)]: Change
+ condition to just [__USE_ISOC99].
+ [__GNUC__ && __USE_GNU]: Change condition to just [__USE_GNU].
+
+2013-01-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14200]
+ * sysdeps/unix/sysv/linux/x86/bits/environments.h
+ (_POSIX_V7_ILP32_OFF32): Defined as 1 only if __x86_64__ isn't
+ defined.
+ (_POSIX_V6_ILP32_OFF32): Likewise.
+ (_XBS5_ILP32_OFF32): Likewise.
+ (__ILP32_OFFBIG_CFLAGS): Defined as "-mx32" for x32.
+ (__ILP32_OFFBIG_LDFLAGS): Likewise.
+
+2013-01-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sysdeps/ieee754/dbl-64/mpexp.c: Fix formatting.
+
+ * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): New array of
+ doubles __mpexp_twomm1. Adjust usage.
+ * sysdeps/ieee754/dbl-64/mpexp.h (__mpexp_twomm1):
+ Remove.
+
+2013-01-10 Andreas Schwab <schwab@suse.de>
+
+ [BZ #14964]
+ * sysdeps/unix/sysv/linux/bits/fcntl-linux.h (FALLOC_FL_KEEP_SIZE)
+ (FALLOC_FL_PUNCH_HOLE) [__USE_GNU]: New macros.
+
+2013-01-09 David S. Miller <davem@davemloft.net>
+
+ [BZ #15003]
+ * sysdeps/gnu/netinet/tcp.h (TCP_COOKIE_TRANSACTIONS,
+ TCP_THIN_LINEAR_TIMEOUTS, TCP_THIN_DUPACK, TCP_USER_TIMEOUT,
+ TCP_REPAIR, TCP_REPAIR_QUEUE, TCP_QUEUE_SEQ, TCP_REPAIR_OPTIONS,
+ TCP_FASTOPEN): Define.
+ (tcp_repair_opt): New structure.
+ (TCP_NO_QUEUE, TCP_RECV_QUEUE, TCP_SEND_QUEUE, TCP_QUEUES_NR): New
+ enum values.
+ (TCP_COOKIE_MIN, TCP_COOKIE_MAX, TCP_COOKIE_PAIR_SIZE,
+ TCP_COOKIE_IN_ALWAYS, TCP_COOKIE_OUT_NEVER, TCP_S_DATA_IN,
+ TCP_S_DATA_OUT, TCP_MSS_DEFAULT, TCP_MSS_DESIRED): Define.
+ (tcp_cookie_transactions): New structure.
+
+2013-01-09 Anton Blanchard <anton@samba.org>
+
+ * sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: New file.
+ * sysdeps/unix/sysv/linux/powerpc/Versions: Add __vdso_getcpu.
+ * sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise.
+
+2013-01-09 Joseph Myers <joseph@codesourcery.com>
+
+ * include/features.h (__USE_ANSI): Remove.
+
+2013-01-09 Roland McGrath <roland@hack.frob.com>
+
+ * posix/Makefile (others): Depend on $(objpfx)getconf.speclist.
+
+ * misc/error.c (error_tail: ALLOCA_LIMIT): Remove unused macro.
+
2013-01-09 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/s390/fpu/libm-test-ulps: Update.
diff --git a/libc/Makeconfig b/libc/Makeconfig
index b6b6ab981..3dcfcc660 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -379,8 +379,8 @@ endif
# Command for linking PIE programs with the C library.
ifndef +link-pie
-+link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
++link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
$(addprefix $(csu-objpfx),S$(start-installed-name)) \
$(+preinit) $(+prectorS) \
@@ -388,7 +388,12 @@ ifndef +link-pie
S$(start-installed-name))\
$(+preinit) $(link-extra-libs) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ $(link-extra-libs)
++link-pie-after-libc = $(+postctorS) $(+postinit)
++link-pie = $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) \
+ $(+link-pie-after-libc)
++link-pie-tests = $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) \
+ $(link-libc-tests) $(+link-pie-after-libc)
endif
# Command for statically linking programs with the C library.
ifndef +link-static
@@ -411,7 +416,7 @@ endif
ifndef +link
ifeq (yes,$(build-shared))
+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
$(addprefix $(csu-objpfx),$(start-installed-name)) \
$(+preinit) $(+prector) \
@@ -421,8 +426,10 @@ ifeq (yes,$(build-shared))
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs)
+link-after-libc = $(+postctor) $(+postinit)
-+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
-+link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
++link = $(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) \
+ $(+link-after-libc)
++link-tests = $(+link-before-libc) $(rtld-tests-LDFLAGS) \
+ $(link-libc-tests) $(+link-after-libc)
else
+link = $(+link-static)
+link-tests = $(+link-static-tests)
@@ -440,9 +447,16 @@ ifndef +link-bounded
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-bounded) $(link-libc-bounded) $(+postctorT) $(+postinit)
endif
-ifndef config-LDFLAGS
ifeq (yes,$(build-shared))
-config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+ifndef rtld-LDFLAGS
+rtld-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+endif
+ifndef rtld-tests-LDFLAGS
+ifeq (yes,$(build-hardcoded-path-in-tests))
+rtld-tests-LDFLAGS = -Wl,-dynamic-linker=$(common-objpfx)elf/ld.so
+else
+rtld-tests-LDFLAGS = $(rtld-LDFLAGS)
+endif
endif
endif
ifndef link-libc
@@ -450,12 +464,19 @@ ifeq (yes,$(build-shared))
# We need the versioned name of libc.so in the deps of $(others) et al
# so that the symlink to libc.so is created before anything tries to
# run the linked programs.
-link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \
- $(common-objpfx)libc.so$(libc.so-version) \
- $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed)
-link-libc = $(link-libc-before-gnulib) $(gnulib)
-link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests)
+link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
+ifeq (yes,$(build-hardcoded-path-in-tests))
+link-libc-tests-rpath-link = -Wl,-rpath=$(rpath-link)
+else
+link-libc-tests-rpath-link = $(link-libc-rpath-link)
+endif
+link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
+ $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
+ $(as-needed) $(common-objpfx)elf/ld.so \
+ $(no-as-needed)
+link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib)
+link-libc-tests = $(link-libc-tests-rpath-link) \
+ $(link-libc-before-gnulib) $(gnulib-tests)
# This is how to find at build-time things that will be installed there.
rpath-dirs = math elf dlfcn nss nis rt resolv crypt
rpath-link = \
@@ -628,6 +649,40 @@ ifndef LD
LD := ld -X
endif
+# $(test-via-rtld-prefix) is a command that, when prepended to the name
+# of a test program built with the newly built library, produces a command
+# that, executed on the host for which the library is built, runs that
+# program. For the statically-linked %-bp test programs, and for
+# tests listed in tests-static or xtests-static as well as when test
+# programs are hardcoded to the newly built libraries, it is empty.
+
+# $(test-program-prefix) is a command that, when prepended to the name
+# of a test program built with the newly built library, produces a command
+# that, executed on the build system on which "make" is run, runs that
+# test program.
+
+# $(test-program-cmd) is a command that, executed on the build system
+# on which "make" is run, runs the newly built test program that is the
+# second dependency of the makefile target in which
+# $(test-program-cmd) is used.
+
+# $(host-test-program-cmd) is a command that, executed on the host
+# for which the library is built, runs the newly built test program that
+# is the second dependency of the makefile target in which
+# $(host-test-program-cmd) is used.
+
+ifeq (yes,$(build-hardcoded-path-in-tests))
+test-via-rtld-prefix =
+test-program-prefix = $(test-wrapper)
+test-program-cmd = $(test-wrapper) $(built-program-file)
+host-test-program-cmd = $(built-program-file)
+else
+test-via-rtld-prefix = $(run-via-rtld-prefix)
+test-program-prefix = $(run-program-prefix)
+test-program-cmd = $(built-program-cmd)
+host-test-program-cmd = $(host-built-program-cmd)
+endif
+
# Extra flags to pass to GCC.
ifeq ($(all-warnings),yes)
+gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
diff --git a/libc/Makefile b/libc/Makefile
index 5449afd00..662e1a095 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -164,7 +164,7 @@ $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
echo 'builddir=`dirname "$$0"`'; \
echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
echo 'exec $(subst $(common-objdir),"$${builddir}",\
- $(run-program-prefix)) $${1+"$$@"}'; \
+ $(test-program-prefix)) $${1+"$$@"}'; \
) > $@T
chmod a+x $@T
mv -f $@T $@
diff --git a/libc/Makerules b/libc/Makerules
index ba75376d2..7cc82627b 100644
--- a/libc/Makerules
+++ b/libc/Makerules
@@ -470,7 +470,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
define build-shlib-helper
$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
- $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(config-LDFLAGS) \
+ $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
@@ -488,7 +488,7 @@ else
$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
$(LINK.o) -shared -Wl,-O1 \
-nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+ $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
-Wl,--verbose 2>&1 | \
sed > $@T \
-e '/^=========/,/^=========/!d;/^=========/d' \
@@ -528,7 +528,7 @@ $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
endef
define build-module-helper
-$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
-B$(csu-objpfx) $(load-map-file) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
@@ -958,7 +958,7 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
ifneq (unknown,$(output-format))
echo > $@.new 'OUTPUT_FORMAT($(output-format))'
else
- $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+ $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
| sed -n -f $< > $@.new
test -s $@.new
diff --git a/libc/NEWS b/libc/NEWS
index d0e02c6b1..cf6191bb3 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -9,7 +9,8 @@ Version 2.18
* The following bugs are resolved with this release:
- 13951, 14317, 14981, 14982, 14985, 14994, 14996.
+ 13951, 14200, 14317, 14327, 14496, 14964, 14981, 14982, 14985, 14994,
+ 14996, 15003, 15023.
Version 2.17
diff --git a/libc/Rules b/libc/Rules
index 5c5aa6084..5728d0955 100644
--- a/libc/Rules
+++ b/libc/Rules
@@ -114,9 +114,11 @@ binaries-static-notests = $(others-static)
binaries-static-tests = $(tests-static) $(xtests-static)
binaries-static = $(binaries-static-notests) $(binaries-static-tests)
ifeq (yesyes,$(have-fpie)$(build-shared))
-binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie)
+binaries-pie-tests = $(tests-pie) $(xtests-pie)
+binaries-pie-notests = $(others-pie)
else
-binaries-pie =
+binaries-pie-tests =
+binaries-pie-notests =
endif
else
binaries-all-notests =
@@ -125,9 +127,11 @@ binaries-all = $(binaries-all-tests)
binaries-static-notests =
binaries-static-tests =
binaries-static =
-binaries-pie =
+binaries-pie-tests =
+binaries-pie-notests =
endif
+binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests)
binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static), \
$(binaries-all-tests))
binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \
@@ -147,8 +151,15 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
$(+link-tests)
endif
-ifneq "$(strip $(binaries-pie))" ""
-$(addprefix $(objpfx),$(binaries-pie)): %: %.o \
+ifneq "$(strip $(binaries-pie-tests))" ""
+$(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \
+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+ $(+link-pie-tests)
+endif
+
+ifneq "$(strip $(binaries-pie-notests))" ""
+$(addprefix $(objpfx),$(binaries-pie-notests)): %: %.o \
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
$(+link-pie)
@@ -182,7 +193,7 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
make-test-out = $(test-wrapper-env) \
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
- $($*-ENV) $(host-built-program-cmd) $($*-ARGS)
+ $($*-ENV) $(host-test-program-cmd) $($*-ARGS)
$(objpfx)%-bp.out: %.input $(objpfx)%-bp
$(make-test-out) > $@ < $(word 1,$^)
$(objpfx)%.out: %.input $(objpfx)%
diff --git a/libc/bits/byteswap.h b/libc/bits/byteswap.h
index 35d4cb366..57d34b461 100644
--- a/libc/bits/byteswap.h
+++ b/libc/bits/byteswap.h
@@ -91,7 +91,7 @@ __bswap_64 (__uint64_t __bsx)
} \
__r.__ll; }))
# endif
-#elif __GLIBC_HAVE_LONG_LONG
+#else
# define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
diff --git a/libc/bits/types.h b/libc/bits/types.h
index c45d6e436..dc7b784f9 100644
--- a/libc/bits/types.h
+++ b/libc/bits/types.h
@@ -42,7 +42,7 @@ typedef unsigned int __uint32_t;
#if __WORDSIZE == 64
typedef signed long int __int64_t;
typedef unsigned long int __uint64_t;
-#elif defined __GLIBC_HAVE_LONG_LONG
+#else
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
#endif
@@ -51,18 +51,9 @@ __extension__ typedef unsigned long long int __uint64_t;
#if __WORDSIZE == 64
typedef long int __quad_t;
typedef unsigned long int __u_quad_t;
-#elif defined __GLIBC_HAVE_LONG_LONG
+#else
__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
-#else
-typedef struct
-{
- long __val[2];
-} __quad_t;
-typedef struct
-{
- __u_long __val[2];
-} __u_quad_t;
#endif
diff --git a/libc/catgets/Makefile b/libc/catgets/Makefile
index 7d52e25e3..0d500080b 100644
--- a/libc/catgets/Makefile
+++ b/libc/catgets/Makefile
@@ -79,7 +79,7 @@ $(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
$(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
$(objpfx)sample.SJIS.cat
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'
$(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
diff --git a/libc/catgets/test-gencat.sh b/libc/catgets/test-gencat.sh
index 7f36ec0e8..69bdb54e9 100755
--- a/libc/catgets/test-gencat.sh
+++ b/libc/catgets/test-gencat.sh
@@ -20,12 +20,12 @@
set -e
common_objpfx=$1
-run_program_cmd=$2
+test_program_cmd=$2
# Run the test program.
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
NLSPATH=${common_objpfx}catgets/%N.%c.cat LC_ALL=ja_JP.SJIS \
- ${run_program_cmd} \
+ ${test_program_cmd} \
> ${common_objpfx}catgets/test-gencat.out
# Compare with the expected result.
diff --git a/libc/config.make.in b/libc/config.make.in
index 7f1bbb51d..ed2716385 100644
--- a/libc/config.make.in
+++ b/libc/config.make.in
@@ -101,6 +101,7 @@ force-install = @force_install@
link-obsolete-rpc = @link_obsolete_rpc@
build-nscd = @build_nscd@
use-nscd = @use_nscd@
+build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
# Build tools.
CC = @CC@
diff --git a/libc/configure b/libc/configure
index fc1408fe2..be21626b6 100755
--- a/libc/configure
+++ b/libc/configure
@@ -659,6 +659,7 @@ libc_cv_nss_crypt
all_warnings
force_install
bindnow
+hardcoded_path_in_tests
oldest_abi
use_default_link
sysheaders
@@ -745,6 +746,7 @@ enable_shared
enable_profile
enable_versioning
enable_oldest_abi
+enable_hardcoded_path_in_tests
enable_stackguard_randomization
enable_add_ons
enable_hidden_plt
@@ -1397,6 +1399,9 @@ Optional Features:
objects [default=yes if supported]
--enable-oldest-abi=ABI configure the oldest ABI supported [e.g. 2.2]
[default=glibc default]
+ --enable-hardcoded-path-in-tests
+ hardcode newly built glibc path in tests
+ [default=no]
--enable-stackguard-randomization
initialize __stack_chk_guard canary with a random
number at program start
@@ -3698,6 +3703,15 @@ _ACEOF
fi
+# Check whether --enable-hardcoded-path-in-tests was given.
+if test "${enable_hardcoded_path_in_tests+set}" = set; then :
+ enableval=$enable_hardcoded_path_in_tests; hardcoded_path_in_tests=$enableval
+else
+ hardcoded_path_in_tests=no
+fi
+
+
+
# Check whether --enable-stackguard-randomization was given.
if test "${enable_stackguard_randomization+set}" = set; then :
enableval=$enable_stackguard_randomization; enable_stackguard_randomize=$enableval
@@ -4281,6 +4295,7 @@ if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
multi_arch=no
fi
fi
+multi_arch_d=
if test x"$multi_arch" != xno; then
multi_arch_d=/multiarch
fi
@@ -4333,11 +4348,16 @@ while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless --without-fp.
if test "$with_fp" = yes; then
- mach="$mach /$1/fpu"
+ maybe_fpu=/fpu
else
- mach="$mach /$1/nofpu"
+ maybe_fpu=/nofpu
fi
- mach="$mach /$1"
+ # For each machine term, try it with and then without /multiarch.
+ for try_fpu in $maybe_fpu ''; do
+ for try_multi in $multi_arch_d ''; do
+ mach="$mach /$1$try_fpu$try_multi"
+ done
+ done
tail="$2"
done
@@ -4351,15 +4371,16 @@ for b in $base ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
- for m in $multi_arch_d $mach ''; do
+ for m in $mach ''; do
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
- if test -n "$m0$m0sub$b$v$o$m$msub"; then
+ try_suffix="$m0$b$v$o$m"
+ if test -n "$try_suffix"; then
try_srcdir="${srcdir}/"
case "$d" in
/*) try_srcdir= ;;
esac
- try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
+ try="${d}sysdeps$try_suffix$a"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d "$try_srcdir$try"; then
diff --git a/libc/configure.in b/libc/configure.in
index 05cbad50e..03e5a8faa 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -146,6 +146,13 @@ else
fi
AC_SUBST(oldest_abi)
+AC_ARG_ENABLE([hardcoded-path-in-tests],
+ AC_HELP_STRING([--enable-hardcoded-path-in-tests],
+ [hardcode newly built glibc path in tests @<:@default=no@:>@]),
+ [hardcoded_path_in_tests=$enableval],
+ [hardcoded_path_in_tests=no])
+AC_SUBST(hardcoded_path_in_tests)
+
AC_ARG_ENABLE([stackguard-randomization],
AC_HELP_STRING([--enable-stackguard-randomization],
[initialize __stack_chk_guard canary with a random number at program start]),
@@ -626,6 +633,7 @@ if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
multi_arch=no
fi
fi
+multi_arch_d=
if test x"$multi_arch" != xno; then
multi_arch_d=/multiarch
fi
@@ -679,11 +687,16 @@ while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless --without-fp.
if test "$with_fp" = yes; then
- mach="$mach /$1/fpu"
+ maybe_fpu=/fpu
else
- mach="$mach /$1/nofpu"
+ maybe_fpu=/nofpu
fi
- mach="$mach /$1"
+ # For each machine term, try it with and then without /multiarch.
+ for try_fpu in $maybe_fpu ''; do
+ for try_multi in $multi_arch_d ''; do
+ mach="$mach /$1$try_fpu$try_multi"
+ done
+ done
tail="$2"
done
@@ -699,15 +712,16 @@ for b in $base ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
- for m in $multi_arch_d $mach ''; do
+ for m in $mach ''; do
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
- if test -n "$m0$m0sub$b$v$o$m$msub"; then
+ try_suffix="$m0$b$v$o$m"
+ if test -n "$try_suffix"; then
try_srcdir="${srcdir}/"
case "$d" in
/*) try_srcdir= ;;
esac
- try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
+ try="${d}sysdeps$try_suffix$a"
test -n "$enable_debug_configure" &&
echo "$0 [DEBUG]: try $try" >&2
if test -d "$try_srcdir$try"; then
diff --git a/libc/debug/Makefile b/libc/debug/Makefile
index 5c7ec06bd..b4f0f1835 100644
--- a/libc/debug/Makefile
+++ b/libc/debug/Makefile
@@ -131,7 +131,13 @@ LDLIBS-tst-lfschk4 = -lstdc++
LDLIBS-tst-lfschk5 = -lstdc++
LDLIBS-tst-lfschk6 = -lstdc++
-# backtrace_symbols only works if we link with -rdynamic.
+# backtrace_symbols only works if we link with -rdynamic. backtrace
+# requires unwind tables on most architectures.
+CFLAGS-tst-backtrace2.c += -funwind-tables
+CFLAGS-tst-backtrace3.c += -funwind-tables
+CFLAGS-tst-backtrace4.c += -funwind-tables
+CFLAGS-tst-backtrace5.c += -funwind-tables
+CFLAGS-tst-backtrace6.c += -funwind-tables
LDFLAGS-tst-backtrace2 = -rdynamic
LDFLAGS-tst-backtrace3 = -rdynamic
LDFLAGS-tst-backtrace4 = -rdynamic
diff --git a/libc/debug/tst-backtrace2.c b/libc/debug/tst-backtrace2.c
index edbed2abd..e1d4572c3 100644
--- a/libc/debug/tst-backtrace2.c
+++ b/libc/debug/tst-backtrace2.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Test backtrace and backtrace_symbols.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by CodeSourcery.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -13,12 +13,13 @@
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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <execinfo.h>
#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
static int do_test (void);
@@ -40,10 +41,10 @@ volatile int x;
/* Use this attribute to prevent inlining, so that all expected frames
are present. */
-#define NO_INLINE __attribute__((noinline))
+#define NO_INLINE __attribute__ ((noinline))
NO_INLINE void
-fn1 (void)
+fn1 (void)
{
void *addresses[NUM_FUNCTIONS];
char **symbols;
@@ -62,7 +63,7 @@ fn1 (void)
/* Convert them to symbols. */
symbols = backtrace_symbols (addresses, n);
/* Check that symbols were obtained. */
- if (symbols == NULL)
+ if (symbols == NULL)
{
FAIL ();
return;
@@ -86,15 +87,15 @@ fn1 (void)
check do_test. */
}
-NO_INLINE static int
-fn2 (void)
+NO_INLINE static int
+fn2 (void)
{
fn1 ();
/* Prevent tail calls. */
return x;
}
-NO_INLINE int
+NO_INLINE int
fn3 (void)
{
fn2();
@@ -102,8 +103,8 @@ fn3 (void)
return x;
}
-NO_INLINE static int
-do_test (void)
+NO_INLINE static int
+do_test (void)
{
fn3 ();
return ret;
diff --git a/libc/debug/tst-backtrace3.c b/libc/debug/tst-backtrace3.c
index 05a48b928..4d3309b3a 100644
--- a/libc/debug/tst-backtrace3.c
+++ b/libc/debug/tst-backtrace3.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Test backtrace and backtrace_symbols for recursive calls.
+ Copyright (C) 2010-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by CodeSourcery.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -13,12 +13,13 @@
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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <execinfo.h>
#include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
static int do_test (void);
@@ -40,10 +41,10 @@ volatile int x;
/* Use this attribute to prevent inlining, so that all expected frames
are present. */
-#define NO_INLINE __attribute__((noinline))
+#define NO_INLINE __attribute__ ((noinline))
NO_INLINE int
-fn (int c)
+fn (int c)
{
void *addresses[NUM_FUNCTIONS];
char **symbols;
@@ -67,7 +68,7 @@ fn (int c)
/* Convert them to symbols. */
symbols = backtrace_symbols (addresses, n);
/* Check that symbols were obtained. */
- if (symbols == NULL)
+ if (symbols == NULL)
{
FAIL ();
return 1;
@@ -83,10 +84,11 @@ fn (int c)
}
/* Symbol names are not available for static functions, so we do not
check do_test. */
+ return x;
}
-NO_INLINE static int
-do_test (void)
+NO_INLINE static int
+do_test (void)
{
fn (2);
return ret;
diff --git a/libc/debug/tst-backtrace4.c b/libc/debug/tst-backtrace4.c
index cce4319ff..41a3f5134 100644
--- a/libc/debug/tst-backtrace4.c
+++ b/libc/debug/tst-backtrace4.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Test backtrace and backtrace_symbols for signal frames.
+ Copyright (C) 2011-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by CodeSourcery.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -13,9 +13,8 @@
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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <execinfo.h>
#include <search.h>
@@ -46,7 +45,7 @@ volatile int x;
/* Use this attribute to prevent inlining, so that all expected frames
are present. */
-#define NO_INLINE __attribute__((noinline))
+#define NO_INLINE __attribute__ ((noinline))
volatile int sig_handled = 0;
diff --git a/libc/debug/tst-backtrace5.c b/libc/debug/tst-backtrace5.c
index c4bb90eb0..eb16c23ce 100644
--- a/libc/debug/tst-backtrace5.c
+++ b/libc/debug/tst-backtrace5.c
@@ -1,6 +1,7 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Test backtrace and backtrace_symbols for signal frames, where a
+ system call was interrupted by a signal.
+ Copyright (C) 2011-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by CodeSourcery.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -13,9 +14,8 @@
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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <execinfo.h>
#include <search.h>
@@ -46,7 +46,7 @@ volatile int x;
/* Use this attribute to prevent inlining, so that all expected frames
are present. */
-#define NO_INLINE __attribute__((noinline))
+#define NO_INLINE __attribute__ ((noinline))
void
handle_signal (int signum)
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index 526f7216f..c2b792b5c 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -642,9 +642,7 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
$(objpfx)order.out: $(objpfx)order
- $(test-wrapper) \
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $(test-program-prefix) \
$(objpfx)order > $@
(echo "0123456789" | cmp $@ -) > /dev/null
@@ -852,36 +850,36 @@ LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
endif
$(objpfx)tst-array1.out: tst-array1.exp $(objpfx)tst-array1
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array1.exp > /dev/null
$(objpfx)tst-array1-static.out: tst-array1.exp $(objpfx)tst-array1-static
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array1.exp > /dev/null
$(objpfx)tst-array2: $(objpfx)tst-array2dep.so
$(objpfx)tst-array2.out: tst-array2.exp $(objpfx)tst-array2
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array2.exp > /dev/null
$(objpfx)tst-array3.out: tst-array1.exp $(objpfx)tst-array3
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array1.exp > /dev/null
$(objpfx)tst-array4: $(libdl)
$(objpfx)tst-array4.out: tst-array4.exp $(objpfx)tst-array4 \
$(objpfx)tst-array2dep.so
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array4.exp > /dev/null
$(objpfx)tst-array5: $(objpfx)tst-array5dep.so
$(objpfx)tst-array5.out: tst-array5.exp $(objpfx)tst-array5
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array5.exp > /dev/null
$(objpfx)tst-array5-static.out: tst-array5-static.exp \
$(objpfx)tst-array5-static
- $(built-program-cmd) > $@
+ $(test-program-cmd) > $@
cmp $@ tst-array5-static.exp > /dev/null
CFLAGS-tst-pie1.c += $(pie-ccflag)
@@ -1030,9 +1028,7 @@ $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
$(objpfx)order2: $(libdl)
$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
$(objpfx)order2mod2.so
- $(test-wrapper) \
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $(test-program-prefix) \
$(objpfx)order2 > $@
(echo "12345" | cmp $@ -) > /dev/null
$(objpfx)order2mod1.so: $(objpfx)order2mod4.so
@@ -1042,7 +1038,7 @@ order2mod2.so-no-z-defs = yes
LDFLAGS-order2mod1.so = $(no-as-needed)
LDFLAGS-order2mod2.so = $(no-as-needed)
-tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
$(objpfx)tst-leaks1: $(libdl)
@@ -1125,9 +1121,7 @@ $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
- $(test-wrapper) \
- $(elf-objpfx)${rtld-installed-name} \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $(test-program-prefix) \
$< > $@
cmp $@ tst-initorder.exp > /dev/null
@@ -1147,9 +1141,7 @@ object-suffixes-left := a b c d
include $(o-iterator)
$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
- $(test-wrapper) \
- $(elf-objpfx)${rtld-installed-name} \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $(test-program-prefix) \
$< > $@
cmp $@ tst-initorder2.exp > /dev/null
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index 233b7630f..9bc5004c1 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -1229,7 +1229,7 @@ typedef struct
#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
-/* 38? */
+#define R_386_SIZE32 38 /* 32-bit symbol size */
#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */
#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS
descriptor for
@@ -1365,102 +1365,104 @@ typedef struct
/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
-#define DT_SPARC_REGISTER 0x70000001
-#define DT_SPARC_NUM 2
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM 2
/* MIPS R3000 specific definitions. */
/* Legal values for e_flags field of Elf32_Ehdr. */
-#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
-#define EF_MIPS_PIC 2 /* Contains PIC code */
-#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
-#define EF_MIPS_XGOT 8
-#define EF_MIPS_64BIT_WHIRL 16
-#define EF_MIPS_ABI2 32
-#define EF_MIPS_ABI_ON32 64
-#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */
+#define EF_MIPS_PIC 2 /* Contains PIC code. */
+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */
+#define EF_MIPS_XGOT 8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2 32
+#define EF_MIPS_ABI_ON32 64
+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
/* Legal values for MIPS architecture level. */
-#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
-#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
-#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
-#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
-#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
-#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */
-#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */
-
-/* The following are non-official names and should not be used. */
-
-#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
-#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
-#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
-#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
-#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
-#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */
-#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */
+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
+#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
+#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
+#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */
+#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */
+
+/* The following are unofficial names and should not be used. */
+
+#define E_MIPS_ARCH_1 EF_MIPS_ARCH_1
+#define E_MIPS_ARCH_2 EF_MIPS_ARCH_2
+#define E_MIPS_ARCH_3 EF_MIPS_ARCH_3
+#define E_MIPS_ARCH_4 EF_MIPS_ARCH_4
+#define E_MIPS_ARCH_5 EF_MIPS_ARCH_5
+#define E_MIPS_ARCH_32 EF_MIPS_ARCH_32
+#define E_MIPS_ARCH_64 EF_MIPS_ARCH_64
/* Special section indices. */
-#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
-#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
-#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
-#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
-#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */
+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */
+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */
/* Legal values for sh_type field of Elf32_Shdr. */
-#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
-#define SHT_MIPS_MSYM 0x70000001
-#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
-#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
-#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
-#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/
-#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
-#define SHT_MIPS_PACKAGE 0x70000007
-#define SHT_MIPS_PACKSYM 0x70000008
-#define SHT_MIPS_RELD 0x70000009
-#define SHT_MIPS_IFACE 0x7000000b
-#define SHT_MIPS_CONTENT 0x7000000c
-#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
-#define SHT_MIPS_SHDR 0x70000010
-#define SHT_MIPS_FDESC 0x70000011
-#define SHT_MIPS_EXTSYM 0x70000012
-#define SHT_MIPS_DENSE 0x70000013
-#define SHT_MIPS_PDESC 0x70000014
-#define SHT_MIPS_LOCSYM 0x70000015
-#define SHT_MIPS_AUXSYM 0x70000016
-#define SHT_MIPS_OPTSYM 0x70000017
-#define SHT_MIPS_LOCSTR 0x70000018
-#define SHT_MIPS_LINE 0x70000019
-#define SHT_MIPS_RFDESC 0x7000001a
-#define SHT_MIPS_DELTASYM 0x7000001b
-#define SHT_MIPS_DELTAINST 0x7000001c
-#define SHT_MIPS_DELTACLASS 0x7000001d
-#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
-#define SHT_MIPS_DELTADECL 0x7000001f
-#define SHT_MIPS_SYMBOL_LIB 0x70000020
-#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
-#define SHT_MIPS_TRANSLATE 0x70000022
-#define SHT_MIPS_PIXIE 0x70000023
-#define SHT_MIPS_XLATE 0x70000024
-#define SHT_MIPS_XLATE_DEBUG 0x70000025
-#define SHT_MIPS_WHIRL 0x70000026
-#define SHT_MIPS_EH_REGION 0x70000027
-#define SHT_MIPS_XLATE_OLD 0x70000028
-#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */
+#define SHT_MIPS_MSYM 0x70000001
+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */
+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */
+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */
+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */
+#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_RELD 0x70000009
+#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
+#define SHT_MIPS_SHDR 0x70000010
+#define SHT_MIPS_FDESC 0x70000011
+#define SHT_MIPS_EXTSYM 0x70000012
+#define SHT_MIPS_DENSE 0x70000013
+#define SHT_MIPS_PDESC 0x70000014
+#define SHT_MIPS_LOCSYM 0x70000015
+#define SHT_MIPS_AUXSYM 0x70000016
+#define SHT_MIPS_OPTSYM 0x70000017
+#define SHT_MIPS_LOCSTR 0x70000018
+#define SHT_MIPS_LINE 0x70000019
+#define SHT_MIPS_RFDESC 0x7000001a
+#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTAINST 0x7000001c
+#define SHT_MIPS_DELTACLASS 0x7000001d
+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
+#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_SYMBOL_LIB 0x70000020
+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
+#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_XLATE 0x70000024
+#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_XLATE_OLD 0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
/* Legal values for sh_flags field of Elf32_Shdr. */
-#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
-#define SHF_MIPS_MERGE 0x20000000
-#define SHF_MIPS_ADDR 0x40000000
-#define SHF_MIPS_STRINGS 0x80000000
-#define SHF_MIPS_NOSTRIP 0x08000000
-#define SHF_MIPS_LOCAL 0x04000000
-#define SHF_MIPS_NAMES 0x02000000
-#define SHF_MIPS_NODUPE 0x01000000
+#define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */
+#define SHF_MIPS_MERGE 0x20000000
+#define SHF_MIPS_ADDR 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL 0x04000000
+#define SHF_MIPS_NAMES 0x02000000
+#define SHF_MIPS_NODUPE 0x01000000
/* Symbol tables. */
@@ -1482,23 +1484,23 @@ typedef union
{
struct
{
- Elf32_Word gt_current_g_value; /* -G value used for compilation */
- Elf32_Word gt_unused; /* Not used */
- } gt_header; /* First entry in section */
+ Elf32_Word gt_current_g_value; /* -G value used for compilation. */
+ Elf32_Word gt_unused; /* Not used. */
+ } gt_header; /* First entry in section. */
struct
{
- Elf32_Word gt_g_value; /* If this value were used for -G */
- Elf32_Word gt_bytes; /* This many bytes would be used */
- } gt_entry; /* Subsequent entries in section */
+ Elf32_Word gt_g_value; /* If this value were used for -G. */
+ Elf32_Word gt_bytes; /* This many bytes would be used. */
+ } gt_entry; /* Subsequent entries in section. */
} Elf32_gptab;
/* Entry found in sections of type SHT_MIPS_REGINFO. */
typedef struct
{
- Elf32_Word ri_gprmask; /* General registers used */
- Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
- Elf32_Sword ri_gp_value; /* $gp register value */
+ Elf32_Word ri_gprmask; /* General registers used. */
+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used. */
+ Elf32_Sword ri_gp_value; /* $gp register value. */
} Elf32_RegInfo;
/* Entries found in sections of type SHT_MIPS_OPTIONS. */
diff --git a/libc/elf/link.h b/libc/elf/link.h
index 29e7ced06..500871f45 100644
--- a/libc/elf/link.h
+++ b/libc/elf/link.h
@@ -147,9 +147,9 @@ struct dl_phdr_info
whether or not each later member is available. */
/* Incremented when a new object may have been added. */
- unsigned long long int dlpi_adds;
+ __extension__ unsigned long long int dlpi_adds;
/* Incremented when an object may have been removed. */
- unsigned long long int dlpi_subs;
+ __extension__ unsigned long long int dlpi_subs;
/* If there is a PT_TLS segment, its module ID as used in
TLS relocations, else zero. */
diff --git a/libc/grp/Makefile b/libc/grp/Makefile
index 837cd8c02..2d355cd56 100644
--- a/libc/grp/Makefile
+++ b/libc/grp/Makefile
@@ -60,7 +60,7 @@ ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
tests: $(objpfx)tst_fgetgrent.out
$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
endif
endif
diff --git a/libc/grp/tst_fgetgrent.sh b/libc/grp/tst_fgetgrent.sh
index 35a7a7605..d4943db97 100644
--- a/libc/grp/tst_fgetgrent.sh
+++ b/libc/grp/tst_fgetgrent.sh
@@ -20,22 +20,22 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
testout=${common_objpfx}/grp/tst_fgetgrent.out
result=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1
exit $result
diff --git a/libc/iconvdata/Makefile b/libc/iconvdata/Makefile
index 15a037c12..bf67b2c91 100644
--- a/libc/iconvdata/Makefile
+++ b/libc/iconvdata/Makefile
@@ -309,7 +309,7 @@ $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(objpfx)tst-table-from $(objpfx)tst-table-to
$(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ \
- '$(run-program-prefix)' > $@
+ '$(test-program-prefix)' > $@
do-tests-clean common-mostlyclean: tst-tables-clean
diff --git a/libc/iconvdata/tst-table.sh b/libc/iconvdata/tst-table.sh
index 59166ca51..b0e667d2a 100755
--- a/libc/iconvdata/tst-table.sh
+++ b/libc/iconvdata/tst-table.sh
@@ -23,7 +23,7 @@
common_objpfx=$1
objpfx=$2
-run_program_prefix=$3
+test_program_prefix=$3
charset=$4
charmap=$5
@@ -60,12 +60,12 @@ else
fi
# iconv in one direction.
-${run_program_prefix} \
+${test_program_prefix} \
${objpfx}tst-table-from ${charset} \
> ${objpfx}tst-${charset}.table
# iconv in the other direction.
-${run_program_prefix} \
+${test_program_prefix} \
${objpfx}tst-table-to ${charset} | sort \
> ${objpfx}tst-${charset}.inverse.table
diff --git a/libc/iconvdata/tst-tables.sh b/libc/iconvdata/tst-tables.sh
index ff21aa808..8f4debdd6 100755
--- a/libc/iconvdata/tst-tables.sh
+++ b/libc/iconvdata/tst-tables.sh
@@ -23,7 +23,7 @@
common_objpfx=$1
objpfx=$2
-run_program_prefix=$3
+test_program_prefix=$3
status=0
@@ -262,7 +262,7 @@ while read charset charmap; do
if test "$charset" = GB18030; then echo "This might take a while" 1>&2; fi
case ${charset} in \#*) continue;; esac
echo -n "Testing ${charset}" 1>&2
- if ./tst-table.sh ${common_objpfx} ${objpfx} "${run_program_prefix}" \
+ if ./tst-table.sh ${common_objpfx} ${objpfx} "${test_program_prefix}" \
${charset} ${charmap} < /dev/null; then
echo 1>&2
else
diff --git a/libc/include/complex.h b/libc/include/complex.h
index acf8cf14b..e173f1f6a 100644
--- a/libc/include/complex.h
+++ b/libc/include/complex.h
@@ -1 +1,11 @@
-#include <math/complex.h>
+#ifndef _COMPLEX_H
+# include <math/complex.h>
+
+/* Return the complex inverse hyperbolic sine of finite nonzero Z,
+ with the imaginary part of the result subtracted from pi/2 if ADJ
+ is nonzero. */
+extern complex float __kernel_casinhf (complex float z, int adj);
+extern complex double __kernel_casinh (complex double z, int adj);
+extern complex long double __kernel_casinhl (complex long double z, int adj);
+
+#endif
diff --git a/libc/include/features.h b/libc/include/features.h
index 688322c64..ca83da05e 100644
--- a/libc/include/features.h
+++ b/libc/include/features.h
@@ -129,9 +129,6 @@
# define __KERNEL_STRICT_NAMES
#endif
-/* Always use ISO C things. */
-#define __USE_ANSI 1
-
/* Convenience macros to test the versions of glibc and gcc.
Use them like this:
#if __GNUC_PREREQ (2,8)
@@ -361,14 +358,6 @@
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
-/* Decide whether a compiler supports the long long datatypes. */
-#if defined __GNUC__ \
- || (defined __PGI && defined __i386__ ) \
- || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
- || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
-# define __GLIBC_HAVE_LONG_LONG 1
-#endif
-
/* This is here only because every header file already includes this one. */
#ifndef __ASSEMBLER__
# ifndef _SYS_CDEFS_H
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index d45b2f02d..2e536641b 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -77,6 +77,7 @@ extern struct drand48_data __libc_drand48_data attribute_hidden;
extern int __setenv (const char *__name, const char *__value, int __replace);
extern int __unsetenv (const char *__name);
extern int __clearenv (void);
+extern char *__mktemp (char *__template) __THROW __nonnull ((1));
extern char *__canonicalize_file_name (const char *__name);
extern char *__realpath (const char *__name, char *__resolved);
extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
diff --git a/libc/intl/Makefile b/libc/intl/Makefile
index 7d7d5eab7..3807d89aa 100644
--- a/libc/intl/Makefile
+++ b/libc/intl/Makefile
@@ -75,18 +75,18 @@ $(codeset_mo): tstcodeset.po
$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace
$(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(common-objpfx)intl/
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(common-objpfx)intl/
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-codeset.out: $(codeset_mo)
$(objpfx)tst-gettext3.out: $(codeset_mo)
diff --git a/libc/intl/tst-gettext.sh b/libc/intl/tst-gettext.sh
index f62284078..87ebe7cf6 100755
--- a/libc/intl/tst-gettext.sh
+++ b/libc/intl/tst-gettext.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
malloc_trace=$4
@@ -54,7 +54,7 @@ export LOCPATH
# Now run the test.
MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${run_program_prefix} \
+${test_program_prefix} \
${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
exit $?
diff --git a/libc/intl/tst-gettext2.sh b/libc/intl/tst-gettext2.sh
index 9c8f298e4..c99ca4d3f 100644
--- a/libc/intl/tst-gettext2.sh
+++ b/libc/intl/tst-gettext2.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
LC_ALL=C
@@ -67,7 +67,7 @@ LOCPATH=${objpfx}domaindir
export LOCPATH
# Now run the test.
-${run_program_prefix} \
+${test_program_prefix} \
${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
cmp ${objpfx}tst-gettext2.out - <<EOF
String1 - Lang1: 1st string
diff --git a/libc/intl/tst-gettext4.sh b/libc/intl/tst-gettext4.sh
index 657bd309c..8f3342a85 100755
--- a/libc/intl/tst-gettext4.sh
+++ b/libc/intl/tst-gettext4.sh
@@ -21,7 +21,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
LC_ALL=C
@@ -39,6 +39,6 @@ export GCONV_PATH
LOCPATH=${common_objpfx}localedata
export LOCPATH
-${run_program_prefix} ${objpfx}tst-gettext4 > ${objpfx}tst-gettext4.out
+${test_program_prefix} ${objpfx}tst-gettext4 > ${objpfx}tst-gettext4.out
exit $?
diff --git a/libc/intl/tst-gettext6.sh b/libc/intl/tst-gettext6.sh
index 9b7dc4717..ab570e782 100644
--- a/libc/intl/tst-gettext6.sh
+++ b/libc/intl/tst-gettext6.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
LC_ALL=C
@@ -36,6 +36,6 @@ export GCONV_PATH
LOCPATH=${common_objpfx}localedata
export LOCPATH
-${run_program_prefix} ${objpfx}tst-gettext6 > ${objpfx}tst-gettext6.out
+${test_program_prefix} ${objpfx}tst-gettext6 > ${objpfx}tst-gettext6.out
exit $?
diff --git a/libc/intl/tst-translit.sh b/libc/intl/tst-translit.sh
index 90bfd9bb2..154ac1f90 100755
--- a/libc/intl/tst-translit.sh
+++ b/libc/intl/tst-translit.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
LC_ALL=C
@@ -37,7 +37,7 @@ export GCONV_PATH
LOCPATH=${common_objpfx}localedata
export LOCPATH
-${run_program_prefix} \
+${test_program_prefix} \
${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
exit $?
diff --git a/libc/io/Makefile b/libc/io/Makefile
index 7f62788fb..7eb3d1b9c 100644
--- a/libc/io/Makefile
+++ b/libc/io/Makefile
@@ -112,5 +112,5 @@ tests: $(objpfx)ftwtest.out
endif
$(objpfx)ftwtest.out: ftwtest-sh $(objpfx)ftwtest
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@
endif
diff --git a/libc/libio/Makefile b/libc/libio/Makefile
index 1831f6cdc..5737b1045 100644
--- a/libc/libio/Makefile
+++ b/libc/libio/Makefile
@@ -212,7 +212,7 @@ endif
endif
$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(common-objpfx)libio/
$(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
diff --git a/libc/libio/test-freopen.sh b/libc/libio/test-freopen.sh
index 2cb274d48..3b05614f7 100755
--- a/libc/libio/test-freopen.sh
+++ b/libc/libio/test-freopen.sh
@@ -20,10 +20,10 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
-${run_program_prefix} ${objpfx}test-freopen ${objpfx}test-freopen.out &&
+${test_program_prefix} ${objpfx}test-freopen ${objpfx}test-freopen.out &&
cmp ${objpfx}test-freopen.out - <<"EOF"
Hello world (mb)
Hello world (wc)
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index 8b39ed1f1..58890d105 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,46 @@
+2013-01-14 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile (bug-setlocale1-ARGS): Use $(host-test-program-cmd),
+ not $(test-program-cmd).
+
+2013-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile ($(objpfx)sort-test.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ ($(objpfx)tst-numeric.out): Likewise.
+ ($(objpfx)tst-mbswcs.out): Likewise.
+ ($(objpfx)tst-fmon.out): Add $(test-program-prefix).
+ ($(objpfx)tst-trans.out): Likewise.
+ ($(objpfx)tst-rpmatch.out): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ ($(objpfx)tst-ctype.out): Likewise.
+ ($(objpfx)tst-wctype.out): Likewise.
+ ($(objpfx)tst-langinfo.out): Likewise.
+ (bug-setlocale1-ARGS): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ * sort-test.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * tst-mbswcs.sh: Likewise.
+ * tst-numeric.sh: Likewise.
+ * tst-wctype.sh: Likewise.
+ * tst-fmon.sh (test_program_prefix): New. Replace
+ ${run_program_prefix} with ${test_program_prefix} when running.
+ tst-fmon.
+ * tst-trans.sh: (test_program_prefix): New. Replace
+ ${run_program_prefix} with ${test_program_prefix} when running
+ tst-trans.
+
+2013-01-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile (tests-static): New variable.
+ (tests): Add $(tests-static).
+ (bug-setlocale1-ARGS): Set to -- $(built-program-cmd).
+ (bug-setlocale1-static-ENV): New variable.
+ (bug-setlocale1-static-ARGS): Likewise.
+ * bug-setlocale1.c (do_test): Support run directly. Check env[1]
+ instead of newargv[0].
+ * bug-setlocale1-static.c: New file.
+
2013-01-03 Chris Leonard <cjl@sugarlabs.org>
[BZ #14982]
diff --git a/libc/localedata/Makefile b/libc/localedata/Makefile
index 587663d3a..ccdd05616 100644
--- a/libc/localedata/Makefile
+++ b/libc/localedata/Makefile
@@ -92,6 +92,10 @@ tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2
+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
+tests-static = bug-setlocale1-static
+tests += $(tests-static)
+endif
ifeq (yesy,$(build-shared)$(OPTION_EGLIBC_LOCALE_CODE))
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
@@ -168,17 +172,18 @@ endif
$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
$(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(test-input) \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(test-input) \
> $@
$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data \
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+ '$(test-program-prefix)' tst-fmon.data \
> $@
$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' tst-numeric.data \
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
> $@
$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
$(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
@@ -186,27 +191,27 @@ $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
$(objpfx)tst-fmon.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@
$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' '$(test-program-prefix)'
$(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
$(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
$(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'
$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
$(objpfx)sort-test.out tst-wctype.input \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'
$(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
$(objpfx)sort-test.out \
$(addprefix $(objpfx),$(CTYPE_FILES))
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'
$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
endif
@@ -313,7 +318,9 @@ $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata
-bug-setlocale1-ARGS = $(common-objpfx)
+bug-setlocale1-ARGS = -- $(host-test-program-cmd)
+bug-setlocale1-static-ENV = $(bug-setlocale1-ENV)
+bug-setlocale1-static-ARGS = $(bug-setlocale1-ARGS)
tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata
$(objdir)/iconvdata/gconv-modules:
diff --git a/libc/localedata/bug-setlocale1-static.c b/libc/localedata/bug-setlocale1-static.c
new file mode 100644
index 000000000..f37177b03
--- /dev/null
+++ b/libc/localedata/bug-setlocale1-static.c
@@ -0,0 +1 @@
+#include "bug-setlocale1.c"
diff --git a/libc/localedata/bug-setlocale1.c b/libc/localedata/bug-setlocale1.c
index cf787be02..dc7f6f3f0 100644
--- a/libc/localedata/bug-setlocale1.c
+++ b/libc/localedata/bug-setlocale1.c
@@ -12,16 +12,16 @@ do_test (int argc, char *argv[])
if (argc > 1)
{
char *newargv[5];
- asprintf (&newargv[0], "%self/ld.so", argv[1]);
- if (newargv[0] == NULL)
+ int i;
+ if (argc != 2 && argc != 5)
{
- puts ("asprintf failed");
+ printf ("wrong number of arguments (%d)\n", argc);
return 1;
}
- newargv[1] = (char *) "--library-path";
- newargv[2] = argv[1];
- newargv[3] = argv[0];
- newargv[4] = NULL;
+
+ for (i = 0; i < (argc == 5 ? 4 : 1); i++)
+ newargv[i] = argv[i + 1];
+ newargv[i] = NULL;
char *env[3];
env[0] = (char *) "LC_CTYPE=de_DE.UTF-8";
@@ -32,9 +32,9 @@ do_test (int argc, char *argv[])
return 1;
}
asprintf (&env[1], "LOCPATH=%s", loc);
- if (newargv[0] == NULL)
+ if (env[1] == NULL)
{
- puts ("second asprintf failed");
+ puts ("asprintf failed");
return 1;
}
env[2] = NULL;
diff --git a/libc/localedata/sort-test.sh b/libc/localedata/sort-test.sh
index 5506a75e8..b74ae9d17 100644
--- a/libc/localedata/sort-test.sh
+++ b/libc/localedata/sort-test.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
lang=$*
id=${PPID:-100}
@@ -32,7 +32,7 @@ for l in $lang; do
here=0
cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'`
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
- LC_ALL=$l ${run_program_prefix} \
+ LC_ALL=$l ${test_program_prefix} \
${common_objpfx}localedata/collate-test $id < $cns.in \
> ${common_objpfx}localedata/$cns.out || here=1
cmp -s $cns.in ${common_objpfx}localedata/$cns.out || here=1
@@ -45,7 +45,7 @@ for l in $lang; do
fi
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
- LC_ALL=$l ${run_program_prefix} \
+ LC_ALL=$l ${test_program_prefix} \
${common_objpfx}localedata/xfrm-test $id < $cns.in \
> ${common_objpfx}localedata/$cns.xout || here=1
cmp -s $cns.in ${common_objpfx}localedata/$cns.xout || here=1
diff --git a/libc/localedata/tst-fmon.sh b/libc/localedata/tst-fmon.sh
index fa006fa18..b3d808552 100755
--- a/libc/localedata/tst-fmon.sh
+++ b/libc/localedata/tst-fmon.sh
@@ -22,7 +22,8 @@ set -e
common_objpfx=$1
run_program_prefix=$2
-datafile=$3
+test_program_prefix=$3
+datafile=$4
here=`pwd`
@@ -47,7 +48,7 @@ while IFS=" " read locale format value expect; do
expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'`
LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
- ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
+ ${test_program_prefix} ${common_objpfx}localedata/tst-fmon \
"$locale" "$format" "$value" "$expect" < /dev/null ||
errcode=$?
fi
diff --git a/libc/localedata/tst-mbswcs.sh b/libc/localedata/tst-mbswcs.sh
index bc4423638..af3b3ae84 100755
--- a/libc/localedata/tst-mbswcs.sh
+++ b/libc/localedata/tst-mbswcs.sh
@@ -20,29 +20,29 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
status=0
# Run the test programs.
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs1 \
+${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs1 \
> ${common_objpfx}localedata/tst-mbswcs.out || status=1
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs2 \
+${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs2 \
>> ${common_objpfx}localedata/tst-mbswcs.out || status=1
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs3 \
+${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs3 \
>> ${common_objpfx}localedata/tst-mbswcs.out || status=1
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs4 \
+${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs4 \
>> ${common_objpfx}localedata/tst-mbswcs.out || status=1
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs5 \
+${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs5 \
>> ${common_objpfx}localedata/tst-mbswcs.out || status=1
exit $status
diff --git a/libc/localedata/tst-numeric.sh b/libc/localedata/tst-numeric.sh
index 3c3ed268d..035f3b44b 100644
--- a/libc/localedata/tst-numeric.sh
+++ b/libc/localedata/tst-numeric.sh
@@ -21,7 +21,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
datafile=$3
# Run the tests.
@@ -32,7 +32,7 @@ while IFS=" " read locale format value expect; do
if [ -n "$format" ]; then
if LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
- ${run_program_prefix} ${common_objpfx}localedata/tst-numeric \
+ ${test_program_prefix} ${common_objpfx}localedata/tst-numeric \
"$locale" "$format" "$value" "$expect" < /dev/null
then
echo "Locale: \"${locale}\" Format: \"${format}\"" \
diff --git a/libc/localedata/tst-trans.sh b/libc/localedata/tst-trans.sh
index e083c6183..2037994cd 100755
--- a/libc/localedata/tst-trans.sh
+++ b/libc/localedata/tst-trans.sh
@@ -21,6 +21,7 @@ set -e
common_objpfx=$1
run_program_prefix=$2
+test_program_prefix=$3
# Generate the necessary locale data.
I18NPATH=. GCONV_PATH=${common_objpfx}/iconvdata \
@@ -32,7 +33,7 @@ exit 1
# Run the test program.
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=tt_TT ${run_program_prefix} \
+LC_ALL=tt_TT ${test_program_prefix} \
${common_objpfx}localedata/tst-trans > ${common_objpfx}localedata/tst-trans.out
exit $?
diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile
index 57a6751cd..936b9ea04 100644
--- a/libc/malloc/Makefile
+++ b/libc/malloc/Makefile
@@ -117,7 +117,7 @@ ifeq (yes,$(build-shared))
ifneq ($(PERL),no)
tests: $(objpfx)tst-mtrace.out
$(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
endif
endif
endif
diff --git a/libc/malloc/arena.c b/libc/malloc/arena.c
index 0c7780282..7d51a9dd1 100644
--- a/libc/malloc/arena.c
+++ b/libc/malloc/arena.c
@@ -19,9 +19,6 @@
#include <stdbool.h>
-/* Get the implementation for check_may_shrink_heap. */
-#include <malloc-sysdep.h>
-
/* Compile-time constants. */
#define HEAP_MIN_SIZE (32*1024)
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index 9188d4e49..bbb035393 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -168,7 +168,7 @@
Compilation Environment options:
- HAVE_MREMAP 0 unless linux defined
+ HAVE_MREMAP 0
Changing default word sizes:
@@ -214,8 +214,10 @@
#include <stddef.h> /* for size_t */
#include <stdlib.h> /* for getenv(), abort() */
+#include <unistd.h> /* for __libc_enable_secure */
#include <malloc-machine.h>
+#include <malloc-sysdep.h>
#include <atomic.h>
#include <_itoa.h>
@@ -490,19 +492,13 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
/*
Define HAVE_MREMAP to make realloc() use mremap() to re-allocate
- large blocks. This is currently only possible on Linux with
- kernel versions newer than 1.3.77.
+ large blocks.
*/
#ifndef HAVE_MREMAP
-#ifdef linux
-#define HAVE_MREMAP 1
-#else
#define HAVE_MREMAP 0
#endif
-#endif /* HAVE_MREMAP */
-
/*
This version of malloc supports the standard SVID/XPG mallinfo
diff --git a/libc/malloc/tst-mtrace.sh b/libc/malloc/tst-mtrace.sh
index ac3916101..a86ecf03b 100755
--- a/libc/malloc/tst-mtrace.sh
+++ b/libc/malloc/tst-mtrace.sh
@@ -20,14 +20,14 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
status=0
trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}malloc/tst-mtrace || status=1
if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff --git a/libc/manual/install.texi b/libc/manual/install.texi
index 1b54051de..e36fb052a 100644
--- a/libc/manual/install.texi
+++ b/libc/manual/install.texi
@@ -155,6 +155,11 @@ if the used tools support it. By using @samp{--without-tls} this can be
prevented though there generally is no reason since it creates
compatibility problems.
+@item --enable-hardcoded-path-in-tests
+By default, dynamic tests are linked to run with the installed C library.
+This option hardcodes the newly built C library path in dynamic tests
+so that they can be invoked directly.
+
@item --build=@var{build-system}
@itemx --host=@var{host-system}
These options are for cross-compiling. If you specify both options and
diff --git a/libc/manual/pattern.texi b/libc/manual/pattern.texi
index 28b1d74b9..1966f3f14 100644
--- a/libc/manual/pattern.texi
+++ b/libc/manual/pattern.texi
@@ -234,6 +234,12 @@ is set in the flag parameter. The type of this field is @code{@w{int
(*) (const char *,} @w{struct stat *)}}.
This is a GNU extension.
+
+@item gl_flags
+The flags used when @code{glob} was called. In addition, @code{GLOB_MAGCHAR}
+might be set. See @ref{Flags for Globbing} for more details.
+
+This is a GNU extension.
@end table
@end deftp
@@ -312,6 +318,12 @@ is set in the flag parameter. The type of this field is @code{@w{int
(*) (const char *,} @w{struct stat64 *)}}.
This is a GNU extension.
+
+@item gl_flags
+The flags used when @code{glob} was called. In addition, @code{GLOB_MAGCHAR}
+might be set. See @ref{Flags for Globbing} for more details.
+
+This is a GNU extension.
@end table
@end deftp
@@ -408,10 +420,12 @@ This function is a GNU extension.
@node Flags for Globbing
@subsection Flags for Globbing
-This section describes the flags that you can specify in the
+This section describes the standard flags that you can specify in the
@var{flags} argument to @code{glob}. Choose the flags you want,
and combine them with the C bitwise OR operator @code{|}.
+Note that there are @ref{More Flags for Globbing} available as GNU extensions.
+
@vtable @code
@comment glob.h
@comment POSIX.2
@@ -481,13 +495,6 @@ matches.)
@comment glob.h
@comment POSIX.2
-@item GLOB_NOSORT
-Don't sort the file names; return them in no particular order.
-(In practice, the order will depend on the order of the entries in
-the directory.) The only reason @emph{not} to sort is to save time.
-
-@comment glob.h
-@comment POSIX.2
@item GLOB_NOESCAPE
Don't treat the @samp{\} character specially in patterns. Normally,
@samp{\} quotes the following character, turning off its special meaning
@@ -500,6 +507,13 @@ If you use @code{GLOB_NOESCAPE}, then @samp{\} is an ordinary character.
@code{glob} does its work by calling the function @code{fnmatch}
repeatedly. It handles the flag @code{GLOB_NOESCAPE} by turning on the
@code{FNM_NOESCAPE} flag in calls to @code{fnmatch}.
+
+@comment glob.h
+@comment POSIX.2
+@item GLOB_NOSORT
+Don't sort the file names; return them in no particular order.
+(In practice, the order will depend on the order of the entries in
+the directory.) The only reason @emph{not} to sort is to save time.
@end vtable
@node More Flags for Globbing
diff --git a/libc/math/Makefile b/libc/math/Makefile
index d7588e382..03b1baff5 100644
--- a/libc/math/Makefile
+++ b/libc/math/Makefile
@@ -60,7 +60,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos \
s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj s_clog10 \
s_fma s_lrint s_llrint s_lround s_llround e_exp10 w_log2 \
- s_isinf_ns $(calls:s_%=m_%) x2y2m1
+ s_isinf_ns $(calls:s_%=m_%) x2y2m1 k_casinh
include ../Makeconfig
@@ -205,7 +205,8 @@ endif
gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%.o,\
add_n sub_n cmp addmul_1 mul_1 mul_n divmod_1 \
- lshift rshift mp_clz_tab udiv_qrnnd inlines)
+ lshift rshift mp_clz_tab udiv_qrnnd inlines \
+ $(gmp-sysdep_routines))
$(objpfx)atest-exp: $(gmp-objs)
$(objpfx)atest-sincos: $(gmp-objs)
$(objpfx)atest-exp2: $(gmp-objs)
diff --git a/libc/math/bits/mathcalls.h b/libc/math/bits/mathcalls.h
index 41b1367e7..e90a34b0f 100644
--- a/libc/math/bits/mathcalls.h
+++ b/libc/math/bits/mathcalls.h
@@ -323,11 +323,13 @@ __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
/* Round X to nearest integral value according to current rounding
direction. */
__MATHDECL (long int,lrint,, (_Mdouble_ __x));
+__extension__
__MATHDECL (long long int,llrint,, (_Mdouble_ __x));
/* Round X to nearest integral value, rounding halfway cases away from
zero. */
__MATHDECL (long int,lround,, (_Mdouble_ __x));
+__extension__
__MATHDECL (long long int,llround,, (_Mdouble_ __x));
diff --git a/libc/math/k_casinh.c b/libc/math/k_casinh.c
new file mode 100644
index 000000000..7f98f24a8
--- /dev/null
+++ b/libc/math/k_casinh.c
@@ -0,0 +1,85 @@
+/* Return arc hyperbole sine for double value, with the imaginary part
+ of the result possibly adjusted for use in computing other
+ functions.
+ Copyright (C) 1997-2013 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/>. */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+/* Return the complex inverse hyperbolic sine of finite nonzero Z,
+ with the imaginary part of the result subtracted from pi/2 if ADJ
+ is nonzero. */
+
+__complex__ double
+__kernel_casinh (__complex__ double x, int adj)
+{
+ __complex__ double res;
+ double rx, ix;
+ __complex__ double y;
+
+ /* Avoid cancellation by reducing to the first quadrant. */
+ rx = fabs (__real__ x);
+ ix = fabs (__imag__ x);
+
+ if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
+ {
+ /* For large x in the first quadrant, x + csqrt (1 + x * x)
+ is sufficiently close to 2 * x to make no significant
+ difference to the result; avoid possible overflow from
+ the squaring and addition. */
+ __real__ y = rx;
+ __imag__ y = ix;
+
+ if (adj)
+ {
+ double t = __real__ y;
+ __real__ y = __copysign (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clog (y);
+ __real__ res += M_LN2;
+ }
+ else
+ {
+ __real__ y = (rx - ix) * (rx + ix) + 1.0;
+ __imag__ y = 2.0 * rx * ix;
+
+ y = __csqrt (y);
+
+ __real__ y += rx;
+ __imag__ y += ix;
+
+ if (adj)
+ {
+ double t = __real__ y;
+ __real__ y = copysign (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clog (y);
+ }
+
+ /* Give results the correct sign for the original argument. */
+ __real__ res = __copysign (__real__ res, __real__ x);
+ __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
+
+ return res;
+}
diff --git a/libc/math/k_casinhf.c b/libc/math/k_casinhf.c
new file mode 100644
index 000000000..940163634
--- /dev/null
+++ b/libc/math/k_casinhf.c
@@ -0,0 +1,85 @@
+/* Return arc hyperbole sine for float value, with the imaginary part
+ of the result possibly adjusted for use in computing other
+ functions.
+ Copyright (C) 1997-2013 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/>. */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+/* Return the complex inverse hyperbolic sine of finite nonzero Z,
+ with the imaginary part of the result subtracted from pi/2 if ADJ
+ is nonzero. */
+
+__complex__ float
+__kernel_casinhf (__complex__ float x, int adj)
+{
+ __complex__ float res;
+ float rx, ix;
+ __complex__ float y;
+
+ /* Avoid cancellation by reducing to the first quadrant. */
+ rx = fabsf (__real__ x);
+ ix = fabsf (__imag__ x);
+
+ if (rx >= 1.0f / FLT_EPSILON || ix >= 1.0f / FLT_EPSILON)
+ {
+ /* For large x in the first quadrant, x + csqrt (1 + x * x)
+ is sufficiently close to 2 * x to make no significant
+ difference to the result; avoid possible overflow from
+ the squaring and addition. */
+ __real__ y = rx;
+ __imag__ y = ix;
+
+ if (adj)
+ {
+ float t = __real__ y;
+ __real__ y = __copysignf (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clogf (y);
+ __real__ res += (float) M_LN2;
+ }
+ else
+ {
+ __real__ y = (rx - ix) * (rx + ix) + 1.0;
+ __imag__ y = 2.0 * rx * ix;
+
+ y = __csqrtf (y);
+
+ __real__ y += rx;
+ __imag__ y += ix;
+
+ if (adj)
+ {
+ float t = __real__ y;
+ __real__ y = __copysignf (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clogf (y);
+ }
+
+ /* Give results the correct sign for the original argument. */
+ __real__ res = __copysignf (__real__ res, __real__ x);
+ __imag__ res = __copysignf (__imag__ res, (adj ? 1.0f : __imag__ x));
+
+ return res;
+}
diff --git a/libc/math/k_casinhl.c b/libc/math/k_casinhl.c
new file mode 100644
index 000000000..641297975
--- /dev/null
+++ b/libc/math/k_casinhl.c
@@ -0,0 +1,92 @@
+/* Return arc hyperbole sine for long double value, with the imaginary
+ part of the result possibly adjusted for use in computing other
+ functions.
+ Copyright (C) 1997-2013 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/>. */
+
+#include <complex.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+/* To avoid spurious overflows, use this definition to treat IBM long
+ double as approximating an IEEE-style format. */
+#if LDBL_MANT_DIG == 106
+# undef LDBL_EPSILON
+# define LDBL_EPSILON 0x1p-106L
+#endif
+
+/* Return the complex inverse hyperbolic sine of finite nonzero Z,
+ with the imaginary part of the result subtracted from pi/2 if ADJ
+ is nonzero. */
+
+__complex__ long double
+__kernel_casinhl (__complex__ long double x, int adj)
+{
+ __complex__ long double res;
+ long double rx, ix;
+ __complex__ long double y;
+
+ /* Avoid cancellation by reducing to the first quadrant. */
+ rx = fabsl (__real__ x);
+ ix = fabsl (__imag__ x);
+
+ if (rx >= 1.0L / LDBL_EPSILON || ix >= 1.0L / LDBL_EPSILON)
+ {
+ /* For large x in the first quadrant, x + csqrt (1 + x * x)
+ is sufficiently close to 2 * x to make no significant
+ difference to the result; avoid possible overflow from
+ the squaring and addition. */
+ __real__ y = rx;
+ __imag__ y = ix;
+
+ if (adj)
+ {
+ long double t = __real__ y;
+ __real__ y = __copysignl (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clogl (y);
+ __real__ res += M_LN2l;
+ }
+ else
+ {
+ __real__ y = (rx - ix) * (rx + ix) + 1.0;
+ __imag__ y = 2.0 * rx * ix;
+
+ y = __csqrtl (y);
+
+ __real__ y += rx;
+ __imag__ y += ix;
+
+ if (adj)
+ {
+ long double t = __real__ y;
+ __real__ y = __copysignl (__imag__ y, __imag__ x);
+ __imag__ y = t;
+ }
+
+ res = __clogl (y);
+ }
+
+ /* Give results the correct sign for the original argument. */
+ __real__ res = __copysignl (__real__ res, __real__ x);
+ __imag__ res = __copysignl (__imag__ res, (adj ? 1.0L : __imag__ x));
+
+ return res;
+}
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc
index 1c479171f..0e640c19c 100644
--- a/libc/math/libm-test.inc
+++ b/libc/math/libm-test.inc
@@ -1461,6 +1461,43 @@ cacos_test (void)
TEST_c_c (cacos, 1.5L, plus_zero, plus_zero, -0.9624236501192068949955178268487368462704L);
TEST_c_c (cacos, 1.5L, minus_zero, plus_zero, 0.9624236501192068949955178268487368462704L);
+ TEST_c_c (cacos, 0x1p50L, 1.0L, 8.881784197001252323389053344727730248720e-16L, -3.535050620855721078027883819436720218708e1L);
+ TEST_c_c (cacos, 0x1p50L, -1.0L, 8.881784197001252323389053344727730248720e-16L, 3.535050620855721078027883819436720218708e1L);
+ TEST_c_c (cacos, -0x1p50L, 1.0L, 3.141592653589792350284223683154270545292L, -3.535050620855721078027883819436720218708e1L);
+ TEST_c_c (cacos, -0x1p50L, -1.0L, 3.141592653589792350284223683154270545292L, 3.535050620855721078027883819436720218708e1L);
+ TEST_c_c (cacos, 1.0L, 0x1p50L, 1.570796326794895731052901991514519103193L, -3.535050620855721078027883819436759661753e1L);
+ TEST_c_c (cacos, -1.0L, 0x1p50L, 1.570796326794897507409741391764983781004L, -3.535050620855721078027883819436759661753e1L);
+ TEST_c_c (cacos, 1.0L, -0x1p50L, 1.570796326794895731052901991514519103193L, 3.535050620855721078027883819436759661753e1L);
+ TEST_c_c (cacos, -1.0L, -0x1p50L, 1.570796326794897507409741391764983781004L, 3.535050620855721078027883819436759661753e1L);
+#ifndef TEST_FLOAT
+ TEST_c_c (cacos, 0x1p500L, 1.0L, 3.054936363499604682051979393213617699789e-151L, -3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, 0x1p500L, -1.0L, 3.054936363499604682051979393213617699789e-151L, 3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, -0x1p500L, 1.0L, 3.141592653589793238462643383279502884197L, -3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, -0x1p500L, -1.0L, 3.141592653589793238462643383279502884197L, 3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, 1.0L, 0x1p500L, 1.570796326794896619231321691639751442099L, -3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, -1.0L, 0x1p500L, 1.570796326794896619231321691639751442099L, -3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, 1.0L, -0x1p500L, 1.570796326794896619231321691639751442099L, 3.472667374605326000180332928505464606058e2L);
+ TEST_c_c (cacos, -1.0L, -0x1p500L, 1.570796326794896619231321691639751442099L, 3.472667374605326000180332928505464606058e2L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+ TEST_c_c (cacos, 0x1p5000L, 1.0L, 7.079811261048172892385615158694057552948e-1506L, -3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, 0x1p5000L, -1.0L, 7.079811261048172892385615158694057552948e-1506L, 3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, -0x1p5000L, 1.0L, 3.141592653589793238462643383279502884197L, -3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, -0x1p5000L, -1.0L, 3.141592653589793238462643383279502884197L, 3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, 1.0L, 0x1p5000L, 1.570796326794896619231321691639751442099L, -3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, -1.0L, 0x1p5000L, 1.570796326794896619231321691639751442099L, -3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, 1.0L, -0x1p5000L, 1.570796326794896619231321691639751442099L, 3.466429049980286492395577839412341016946e3L);
+ TEST_c_c (cacos, -1.0L, -0x1p5000L, 1.570796326794896619231321691639751442099L, 3.466429049980286492395577839412341016946e3L);
+#endif
+
+ TEST_c_c (cacos, 0x1.fp127L, 0x1.fp127L, 7.853981633974483096156608458198757210493e-1L, -8.973081118419833726837456344608533993585e1L);
+#ifndef TEST_FLOAT
+ TEST_c_c (cacos, 0x1.fp1023L, 0x1.fp1023L, 7.853981633974483096156608458198757210493e-1L, -7.107906849659093345062145442726115449315e2L);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+ TEST_c_c (cacos, 0x1.fp16383L, 0x1.fp16383L, 7.853981633974483096156608458198757210493e-1L, -1.135753137836666928715489992987020363057e4L);
+#endif
+
TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
diff --git a/libc/math/s_cacos.c b/libc/math/s_cacos.c
index 6604b5aec..acd9b2462 100644
--- a/libc/math/s_cacos.c
+++ b/libc/math/s_cacos.c
@@ -25,11 +25,27 @@ __cacos (__complex__ double x)
{
__complex__ double y;
__complex__ double res;
-
- y = __casin (x);
-
- __real__ res = (double) M_PI_2 - __real__ y;
- __imag__ res = -__imag__ y;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE
+ || (rcls == FP_ZERO && icls == FP_ZERO))
+ {
+ y = __casin (x);
+
+ __real__ res = (double) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+ }
+ else
+ {
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __kernel_casinh (y, 1);
+
+ __real__ res = __imag__ y;
+ __imag__ res = __real__ y;
+ }
return res;
}
diff --git a/libc/math/s_cacosf.c b/libc/math/s_cacosf.c
index 04c13e4fa..df2bf218a 100644
--- a/libc/math/s_cacosf.c
+++ b/libc/math/s_cacosf.c
@@ -25,11 +25,27 @@ __cacosf (__complex__ float x)
{
__complex__ float y;
__complex__ float res;
-
- y = __casinf (x);
-
- __real__ res = (float) M_PI_2 - __real__ y;
- __imag__ res = -__imag__ y;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE
+ || (rcls == FP_ZERO && icls == FP_ZERO))
+ {
+ y = __casinf (x);
+
+ __real__ res = (float) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+ }
+ else
+ {
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __kernel_casinhf (y, 1);
+
+ __real__ res = __imag__ y;
+ __imag__ res = __real__ y;
+ }
return res;
}
diff --git a/libc/math/s_cacosl.c b/libc/math/s_cacosl.c
index 304076ddf..8eab1f000 100644
--- a/libc/math/s_cacosl.c
+++ b/libc/math/s_cacosl.c
@@ -25,11 +25,27 @@ __cacosl (__complex__ long double x)
{
__complex__ long double y;
__complex__ long double res;
-
- y = __casinl (x);
-
- __real__ res = M_PI_2l - __real__ y;
- __imag__ res = -__imag__ y;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE
+ || (rcls == FP_ZERO && icls == FP_ZERO))
+ {
+ y = __casinl (x);
+
+ __real__ res = M_PI_2l - __real__ y;
+ __imag__ res = -__imag__ y;
+ }
+ else
+ {
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __kernel_casinhl (y, 1);
+
+ __real__ res = __imag__ y;
+ __imag__ res = __real__ y;
+ }
return res;
}
diff --git a/libc/math/s_casinh.c b/libc/math/s_casinh.c
index b493982d8..657e269ac 100644
--- a/libc/math/s_casinh.c
+++ b/libc/math/s_casinh.c
@@ -20,7 +20,6 @@
#include <complex.h>
#include <math.h>
#include <math_private.h>
-#include <float.h>
__complex__ double
__casinh (__complex__ double x)
@@ -62,40 +61,7 @@ __casinh (__complex__ double x)
}
else
{
- double rx, ix;
- __complex__ double y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabs (__real__ x);
- ix = fabs (__imag__ x);
-
- if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
- res = __clog (y);
- __real__ res += M_LN2;
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0;
- __imag__ y = 2.0 * rx * ix;
-
- y = __csqrt (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- res = __clog (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysign (__real__ res, __real__ x);
- __imag__ res = __copysign (__imag__ res, __imag__ x);
+ res = __kernel_casinh (x, 0);
}
return res;
diff --git a/libc/math/s_casinhf.c b/libc/math/s_casinhf.c
index f865e1449..8663c2e7c 100644
--- a/libc/math/s_casinhf.c
+++ b/libc/math/s_casinhf.c
@@ -20,7 +20,6 @@
#include <complex.h>
#include <math.h>
#include <math_private.h>
-#include <float.h>
__complex__ float
__casinhf (__complex__ float x)
@@ -62,40 +61,7 @@ __casinhf (__complex__ float x)
}
else
{
- float rx, ix;
- __complex__ float y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabsf (__real__ x);
- ix = fabsf (__imag__ x);
-
- if (rx >= 1.0f / FLT_EPSILON || ix >= 1.0f / FLT_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
- res = __clogf (y);
- __real__ res += (float) M_LN2;
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0;
- __imag__ y = 2.0 * rx * ix;
-
- y = __csqrtf (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- res = __clogf (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysignf (__real__ res, __real__ x);
- __imag__ res = __copysignf (__imag__ res, __imag__ x);
+ res = __kernel_casinhf (x, 0);
}
return res;
diff --git a/libc/math/s_casinhl.c b/libc/math/s_casinhl.c
index d7c74593e..2afc52714 100644
--- a/libc/math/s_casinhl.c
+++ b/libc/math/s_casinhl.c
@@ -20,14 +20,6 @@
#include <complex.h>
#include <math.h>
#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious overflows, use this definition to treat IBM long
- double as approximating an IEEE-style format. */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
__complex__ long double
__casinhl (__complex__ long double x)
@@ -69,40 +61,7 @@ __casinhl (__complex__ long double x)
}
else
{
- long double rx, ix;
- __complex__ long double y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabsl (__real__ x);
- ix = fabsl (__imag__ x);
-
- if (rx >= 1.0L / LDBL_EPSILON || ix >= 1.0L / LDBL_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
- res = __clogl (y);
- __real__ res += M_LN2l;
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0;
- __imag__ y = 2.0 * rx * ix;
-
- y = __csqrtl (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- res = __clogl (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysignl (__real__ res, __real__ x);
- __imag__ res = __copysignl (__imag__ res, __imag__ x);
+ res = __kernel_casinhl (x, 0);
}
return res;
diff --git a/libc/misc/Versions b/libc/misc/Versions
index 64632f0bf..ec5aea7b5 100644
--- a/libc/misc/Versions
+++ b/libc/misc/Versions
@@ -151,6 +151,7 @@ libc {
}
GLIBC_PRIVATE {
__madvise;
+ __mktemp;
__libc_ifunc_impl_list;
}
}
diff --git a/libc/misc/error.c b/libc/misc/error.c
index 81b911216..e3f8e0f00 100644
--- a/libc/misc/error.c
+++ b/libc/misc/error.c
@@ -132,7 +132,6 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (_IO_fwide (stderr, 0) > 0)
{
#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-# define ALLOCA_LIMIT 2000
size_t len = strlen (message) + 1;
wchar_t *wmessage = NULL;
mbstate_t st;
diff --git a/libc/misc/mktemp.c b/libc/misc/mktemp.c
index 9886c5d75..55421fd74 100644
--- a/libc/misc/mktemp.c
+++ b/libc/misc/mktemp.c
@@ -22,7 +22,7 @@
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique. */
char *
-mktemp (template)
+__mktemp (template)
char *template;
{
if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0)
@@ -31,5 +31,6 @@ mktemp (template)
return template;
}
+weak_alias (__mktemp, mktemp)
link_warning (mktemp, "the use of `mktemp' is dangerous, better use `mkstemp'")
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index f4cd57a91..c4f6c630c 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,26 @@
+2013-01-16 Andreas Schwab <schwab@suse.de>
+
+ [BZ #14327]
+ * sem_open.c (sem_open): Use __mktemp instead of mktemp.
+
+2013-01-11 Carlos O'Donell <codonell@redhat.com>
+
+ * allocatestack.c (allocate_stack): Add comment. Remove assert
+ on attr.
+
+2013-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile (tst-cancel7-ARGS: Replace $(host-built-program-cmd)
+ with $(host-test-program-cmd).
+ (tst-exec4-ARGS): Likewise.
+ (tst-stackguard1-ARGS): Likewise.
+ ($(objpfx)tst-tls6.out): Don't pass $(elf-objpfx) to tst-tls6.sh.
+ Replace $(rtld-installed-name) with $(test-via-rtld-prefix).
+ * tst-tls6.sh (elf_objpfx): Removed.
+ (rtld_installed_name): Renamed to ...
+ (test_via_rtld_prefix): This.
+ (tst_tls5): Prepend ${test_via_rtld_prefix}.
+
2013-01-02 Joseph Myers <joseph@codesourcery.com>
* All files with FSF copyright notices: Update copyright dates
@@ -10,9 +33,9 @@
2012-12-28 Andi Kleen <ak@linux.intel.com>
- * pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Convert
+ * pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock): Convert
to prototype.
- * pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock):
+ * pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock):
Likewise.
2012-12-27 David S. Miller <davem@davemloft.net>
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 21e3fd83f..474a687f8 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -456,7 +456,7 @@ CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
-tst-cancel7-ARGS = --command "exec $(host-built-program-cmd)"
+tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
@@ -496,8 +496,8 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
- $(BASH) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name) '$(test-wrapper-env)'
+ $(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
+ '$(test-wrapper-env)'
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
@@ -599,7 +599,7 @@ $(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
endif
endif
-tst-exec4-ARGS = $(host-built-program-cmd)
+tst-exec4-ARGS = $(host-test-program-cmd)
$(objpfx)tst-execstack: $(libdl)
$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
@@ -607,14 +607,14 @@ LDFLAGS-tst-execstack = -Wl,-z,noexecstack
$(objpfx)tst-fini1mod.so: $(shared-thread-library)
-tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-oddstacklimit.out
$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
- $(run-program-prefix) $< --command '$(host-built-program-cmd)' > $@
+ $(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@
endif
# The tests here better do not run in parallel
diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c
index d1056eefa..31c88291a 100644
--- a/libc/nptl/allocatestack.c
+++ b/libc/nptl/allocatestack.c
@@ -340,6 +340,10 @@ change_stack_perm (struct pthread *pd
}
+/* Returns a usable stack for a new thread either by allocating a
+ new stack or reusing a cached stack of sufficient size.
+ ATTR must be non-NULL and point to a valid pthread_attr.
+ PDP must be non-NULL. */
static int
allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
ALLOCATE_STACK_PARMS)
@@ -349,7 +353,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
size_t pagesize_m1 = __getpagesize () - 1;
void *stacktop;
- assert (attr != NULL);
assert (powerof2 (pagesize_m1 + 1));
assert (TCB_ALIGNMENT >= STACK_ALIGN);
diff --git a/libc/nptl/sem_open.c b/libc/nptl/sem_open.c
index 5bc56c5bd..83b2fdf47 100644
--- a/libc/nptl/sem_open.c
+++ b/libc/nptl/sem_open.c
@@ -329,7 +329,7 @@ sem_open (const char *name, int oflag, ...)
since the file must be opened with a specific mode. The
mode cannot later be set since then we cannot apply the
file create mask. */
- if (mktemp (tmpfname) == NULL)
+ if (__mktemp (tmpfname) == NULL)
return SEM_FAILED;
/* Open the file. Make sure we do not overwrite anything. */
diff --git a/libc/nptl/tst-tls6.sh b/libc/nptl/tst-tls6.sh
index d5513a5e9..fb2351208 100755
--- a/libc/nptl/tst-tls6.sh
+++ b/libc/nptl/tst-tls6.sh
@@ -20,15 +20,13 @@
set -e
common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
+test_via_rtld_prefix=$1; shift
test_wrapper_env=$1; shift
logfile=$common_objpfx/nptl/tst-tls6.out
# We have to find libc and nptl
library_path=${common_objpfx}:${common_objpfx}nptl
-tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
- ${common_objpfx}/nptl/tst-tls5"
+tst_tls5="${test_via_rtld_prefix} ${common_objpfx}/nptl/tst-tls5"
LC_ALL=C
export LC_ALL
diff --git a/libc/ports/ChangeLog.aarch64 b/libc/ports/ChangeLog.aarch64
index dd1d64cb6..c7487f5b7 100644
--- a/libc/ports/ChangeLog.aarch64
+++ b/libc/ports/ChangeLog.aarch64
@@ -1,3 +1,42 @@
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/strlen.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/strcmp.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/bzero.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/memmove.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/memcpy.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/memset.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/sysdep.h (ENTRY_ALIGN): New.
+ * sysdeps/aarch64/memcmp.S: New file.
+
+2013-01-17 Marcus Shawcroft <marcus.shawcroft@linaro.org>
+
+ * sysdeps/aarch64/sysdep.h (ENTRY, END): Adjust
+ whitespace.
+
+2013-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/aarch64/bits/setjmp.h (__jmp_buf): Use __extension__
+ with long long.
+
2013-01-02 Joseph Myers <joseph@codesourcery.com>
* All files with FSF copyright notices: Update copyright dates
diff --git a/libc/ports/ChangeLog.hppa b/libc/ports/ChangeLog.hppa
index 2b798529b..ef904c267 100644
--- a/libc/ports/ChangeLog.hppa
+++ b/libc/ports/ChangeLog.hppa
@@ -1,3 +1,11 @@
+2013-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/hppa/fpu/fpu_control.h (_FPU_GETCW): Use __extension__
+ with long long.
+ (_FPU_SETCW): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/bits/ipc.h (struct ipc_perm):
+ Likewise.
+
2013-01-08 Andreas Jaeger <aj@suse.de>
[BZ# 14985]
diff --git a/libc/ports/ChangeLog.m68k b/libc/ports/ChangeLog.m68k
index b6e93669c..20eaac716 100644
--- a/libc/ports/ChangeLog.m68k
+++ b/libc/ports/ChangeLog.m68k
@@ -1,3 +1,8 @@
+2013-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/m68k/bits/byteswap.h (__bswap_64): Use __extension__
+ with long long.
+
2013-01-04 Andreas Schwab <schwab@suse.de>
* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update.
diff --git a/libc/ports/ChangeLog.mips b/libc/ports/ChangeLog.mips
index 5a80540bc..9e2bcffc6 100644
--- a/libc/ports/ChangeLog.mips
+++ b/libc/ports/ChangeLog.mips
@@ -1,3 +1,8 @@
+2013-01-10 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/bits/sigcontext.h (struct
+ sigcontext): Use __extension__ with long long in all definitions.
+
2013-01-08 Steve Ellcey <sellcey@mips.com>
* sysdeps/mips/memcpy.S: Change prefetch hint, reorder partial
diff --git a/libc/ports/ChangeLog.tile b/libc/ports/ChangeLog.tile
index e70742bb3..a5eaec3a9 100644
--- a/libc/ports/ChangeLog.tile
+++ b/libc/ports/ChangeLog.tile
@@ -1,3 +1,9 @@
+2013-01-10 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed: New file.
+ * sysdeps/unix/sysv/linux/tile/tilegx/configure.in: New file.
+ * sysdeps/unix/sysv/linux/tile/tilegx/configure: New file.
+
2013-01-02 Joseph Myers <joseph@codesourcery.com>
* All files with FSF copyright notices: Update copyright dates
diff --git a/libc/ports/sysdeps/aarch64/bits/setjmp.h b/libc/ports/sysdeps/aarch64/bits/setjmp.h
index 6d78b7e87..6a93e0a25 100644
--- a/libc/ports/sysdeps/aarch64/bits/setjmp.h
+++ b/libc/ports/sysdeps/aarch64/bits/setjmp.h
@@ -27,7 +27,7 @@
/* Jump buffer contains:
x19-x28, x29(fp), x30(lr), (x31)sp, d8-d15. Other registers are not
saved. */
-typedef unsigned long long __jmp_buf [22];
+__extension__ typedef unsigned long long __jmp_buf [22];
#endif
#endif
diff --git a/libc/ports/sysdeps/aarch64/bzero.S b/libc/ports/sysdeps/aarch64/bzero.S
new file mode 100644
index 000000000..228c0a5f3
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/bzero.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 2013 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/>. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY(__bzero)
+ mov x2, x1
+ mov x1, xzr
+ b __memset
+END(__bzero)
+weak_alias (__bzero, bzero)
diff --git a/libc/ports/sysdeps/aarch64/memcmp.S b/libc/ports/sysdeps/aarch64/memcmp.S
new file mode 100644
index 000000000..6398ddd3e
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/memcmp.S
@@ -0,0 +1,151 @@
+/* memcmp - compare memory
+
+ Copyright (C) 2013 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/>. */
+
+#include <sysdep.h>
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+/* Parameters and result. */
+#define src1 x0
+#define src2 x1
+#define limit x2
+#define result x0
+
+/* Internal variables. */
+#define data1 x3
+#define data1w w3
+#define data2 x4
+#define data2w w4
+#define has_nul x5
+#define diff x6
+#define endloop x7
+#define tmp1 x8
+#define tmp2 x9
+#define tmp3 x10
+#define pos x11
+#define limit_wd x12
+#define mask x13
+
+ENTRY_ALIGN (memcmp, 6)
+ cbz limit, L(ret0)
+ eor tmp1, src1, src2
+ tst tmp1, #7
+ b.ne L(misaligned8)
+ ands tmp1, src1, #7
+ b.ne L(mutual_align)
+ add limit_wd, limit, #7
+ lsr limit_wd, limit_wd, #3
+ /* Start of performance-critical section -- one 64B cache line. */
+L(loop_aligned):
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+L(start_realigned):
+ subs limit_wd, limit_wd, #1
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ csinv endloop, diff, xzr, ne /* Last Dword or differences. */
+ cbz endloop, L(loop_aligned)
+ /* End of performance-critical section -- one 64B cache line. */
+
+ /* Not reached the limit, must have found a diff. */
+ cbnz limit_wd, L(not_limit)
+
+ /* Limit % 8 == 0 => all bytes significant. */
+ ands limit, limit, #7
+ b.eq L(not_limit)
+
+ lsl limit, limit, #3 /* Bits -> bytes. */
+ mov mask, #~0
+#ifdef __AARCH64EB__
+ lsr mask, mask, limit
+#else
+ lsl mask, mask, limit
+#endif
+ bic data1, data1, mask
+ bic data2, data2, mask
+
+ orr diff, diff, mask
+L(not_limit):
+
+#ifndef __AARCH64EB__
+ rev diff, diff
+ rev data1, data1
+ rev data2, data2
+#endif
+ /* The MS-non-zero bit of DIFF marks either the first bit
+ that is different, or the end of the significant data.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ clz pos, diff
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ RET
+
+L(mutual_align):
+ /* Sources are mutually aligned, but are not currently at an
+ alignment boundary. Round down the addresses and then mask off
+ the bytes that precede the start point. */
+ bic src1, src1, #7
+ bic src2, src2, #7
+ add limit, limit, tmp1 /* Adjust the limit for the extra. */
+ lsl tmp1, tmp1, #3 /* Bytes beyond alignment -> bits. */
+ ldr data1, [src1], #8
+ neg tmp1, tmp1 /* Bits to alignment -64. */
+ ldr data2, [src2], #8
+ mov tmp2, #~0
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#endif
+ add limit_wd, limit, #7
+ orr data1, data1, tmp2
+ orr data2, data2, tmp2
+ lsr limit_wd, limit_wd, #3
+ b L(start_realigned)
+
+L(ret0):
+ mov result, #0
+ RET
+
+ .p2align 6
+L(misaligned8):
+ sub limit, limit, #1
+1:
+ /* Perhaps we can do better than this. */
+ ldrb data1w, [src1], #1
+ ldrb data2w, [src2], #1
+ subs limit, limit, #1
+ ccmp data1w, data2w, #0, cs /* NZCV = 0b0000. */
+ b.eq 1b
+ sub result, data1, data2
+ RET
+END (memcmp)
+#undef bcmp
+weak_alias (memcmp, bcmp)
+libc_hidden_builtin_def (memcmp)
diff --git a/libc/ports/sysdeps/aarch64/memcpy.S b/libc/ports/sysdeps/aarch64/memcpy.S
new file mode 100644
index 000000000..4f4e36c06
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/memcpy.S
@@ -0,0 +1,176 @@
+/* Copyright (C) 2012-2013 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/>. */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Unaligned accesses
+ *
+ */
+
+#define dstin x0
+#define src x1
+#define count x2
+#define tmp1 x3
+#define tmp1w w3
+#define tmp2 x4
+#define tmp2w w4
+#define tmp3 x5
+#define tmp3w w5
+#define dst x6
+
+#define A_l x7
+#define A_h x8
+#define B_l x9
+#define B_h x10
+#define C_l x11
+#define C_h x12
+#define D_l x13
+#define D_h x14
+
+#include <sysdep.h>
+
+ENTRY_ALIGN (memcpy, 6)
+
+ mov dst, dstin
+ cmp count, #64
+ b.ge L(cpy_not_short)
+ cmp count, #15
+ b.le L(tail15tiny)
+
+ /* Deal with small copies quickly by dropping straight into the
+ * exit block. */
+L(tail63):
+ /* Copy up to 48 bytes of data. At this point we only need the
+ * bottom 6 bits of count to be accurate. */
+ ands tmp1, count, #0x30
+ b.eq L(tail15)
+ add dst, dst, tmp1
+ add src, src, tmp1
+ cmp tmp1w, #0x20
+ b.eq 1f
+ b.lt 2f
+ ldp A_l, A_h, [src, #-48]
+ stp A_l, A_h, [dst, #-48]
+1:
+ ldp A_l, A_h, [src, #-32]
+ stp A_l, A_h, [dst, #-32]
+2:
+ ldp A_l, A_h, [src, #-16]
+ stp A_l, A_h, [dst, #-16]
+
+L(tail15):
+ ands count, count, #15
+ beq 1f
+ add src, src, count
+ ldp A_l, A_h, [src, #-16]
+ add dst, dst, count
+ stp A_l, A_h, [dst, #-16]
+1:
+ RET
+
+L(tail15tiny):
+ /* Copy up to 15 bytes of data. Does not assume additional data
+ being copied. */
+ tbz count, #3, 1f
+ ldr tmp1, [src], #8
+ str tmp1, [dst], #8
+1:
+ tbz count, #2, 1f
+ ldr tmp1w, [src], #4
+ str tmp1w, [dst], #4
+1:
+ tbz count, #1, 1f
+ ldrh tmp1w, [src], #2
+ strh tmp1w, [dst], #2
+1:
+ tbz count, #0, 1f
+ ldrb tmp1w, [src]
+ strb tmp1w, [dst]
+1:
+ RET
+
+L(cpy_not_short):
+ /* We don't much care about the alignment of DST, but we want SRC
+ * to be 128-bit (16 byte) aligned so that we don't cross cache line
+ * boundaries on both loads and stores. */
+ neg tmp2, src
+ ands tmp2, tmp2, #15 /* Bytes to reach alignment. */
+ b.eq 2f
+ sub count, count, tmp2
+ /* Copy more data than needed; it's faster than jumping
+ * around copying sub-Quadword quantities. We know that
+ * it can't overrun. */
+ ldp A_l, A_h, [src]
+ add src, src, tmp2
+ stp A_l, A_h, [dst]
+ add dst, dst, tmp2
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le L(tail63)
+2:
+ subs count, count, #128
+ b.ge L(cpy_body_large)
+ /* Less than 128 bytes to copy, so handle 64 here and then jump
+ * to the tail. */
+ ldp A_l, A_h, [src]
+ ldp B_l, B_h, [src, #16]
+ ldp C_l, C_h, [src, #32]
+ ldp D_l, D_h, [src, #48]
+ stp A_l, A_h, [dst]
+ stp B_l, B_h, [dst, #16]
+ stp C_l, C_h, [dst, #32]
+ stp D_l, D_h, [dst, #48]
+ tst count, #0x3f
+ add src, src, #64
+ add dst, dst, #64
+ b.ne L(tail63)
+ RET
+
+ /* Critical loop. Start at a new cache line boundary. Assuming
+ * 64 bytes per line this ensures the entire loop is in one line. */
+ .p2align 6
+L(cpy_body_large):
+ /* There are at least 128 bytes to copy. */
+ ldp A_l, A_h, [src, #0]
+ sub dst, dst, #16 /* Pre-bias. */
+ ldp B_l, B_h, [src, #16]
+ ldp C_l, C_h, [src, #32]
+ ldp D_l, D_h, [src, #48]! /* src += 64 - Pre-bias. */
+1:
+ stp A_l, A_h, [dst, #16]
+ ldp A_l, A_h, [src, #16]
+ stp B_l, B_h, [dst, #32]
+ ldp B_l, B_h, [src, #32]
+ stp C_l, C_h, [dst, #48]
+ ldp C_l, C_h, [src, #48]
+ stp D_l, D_h, [dst, #64]!
+ ldp D_l, D_h, [src, #64]!
+ subs count, count, #64
+ b.ge 1b
+ stp A_l, A_h, [dst, #16]
+ stp B_l, B_h, [dst, #32]
+ stp C_l, C_h, [dst, #48]
+ stp D_l, D_h, [dst, #64]
+ add src, src, #16
+ add dst, dst, #64 + 16
+ tst count, #0x3f
+ b.ne L(tail63)
+ RET
+END (memcpy)
+libc_hidden_builtin_def (memcpy)
diff --git a/libc/ports/sysdeps/aarch64/memmove.S b/libc/ports/sysdeps/aarch64/memmove.S
new file mode 100644
index 000000000..c42eb1c13
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/memmove.S
@@ -0,0 +1,312 @@
+/* Copyright (C) 2012-2013 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/>. */
+
+#include <sysdep.h>
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Unaligned accesses
+ */
+
+/* Parameters and result. */
+#define dstin x0
+#define src x1
+#define count x2
+#define tmp1 x3
+#define tmp1w w3
+#define tmp2 x4
+#define tmp2w w4
+#define tmp3 x5
+#define tmp3w w5
+#define dst x6
+
+#define A_l x7
+#define A_h x8
+#define B_l x9
+#define B_h x10
+#define C_l x11
+#define C_h x12
+#define D_l x13
+#define D_h x14
+
+ENTRY_ALIGN (memmove, 6)
+
+ cmp dstin, src
+ b.lo L(downwards)
+ add tmp1, src, count
+ cmp dstin, tmp1
+ b.hs memcpy /* No overlap. */
+
+ /* Upwards move with potential overlap.
+ * Need to move from the tail backwards. SRC and DST point one
+ * byte beyond the remaining data to move. */
+ add dst, dstin, count
+ add src, src, count
+ cmp count, #64
+ b.ge L(mov_not_short_up)
+
+ /* Deal with small moves quickly by dropping straight into the
+ * exit block. */
+L(tail63up):
+ /* Move up to 48 bytes of data. At this point we only need the
+ * bottom 6 bits of count to be accurate. */
+ ands tmp1, count, #0x30
+ b.eq L(tail15up)
+ sub dst, dst, tmp1
+ sub src, src, tmp1
+ cmp tmp1w, #0x20
+ b.eq 1f
+ b.lt 2f
+ ldp A_l, A_h, [src, #32]
+ stp A_l, A_h, [dst, #32]
+1:
+ ldp A_l, A_h, [src, #16]
+ stp A_l, A_h, [dst, #16]
+2:
+ ldp A_l, A_h, [src]
+ stp A_l, A_h, [dst]
+L(tail15up):
+ /* Move up to 15 bytes of data. Does not assume additional data
+ * being moved. */
+ tbz count, #3, 1f
+ ldr tmp1, [src, #-8]!
+ str tmp1, [dst, #-8]!
+1:
+ tbz count, #2, 1f
+ ldr tmp1w, [src, #-4]!
+ str tmp1w, [dst, #-4]!
+1:
+ tbz count, #1, 1f
+ ldrh tmp1w, [src, #-2]!
+ strh tmp1w, [dst, #-2]!
+1:
+ tbz count, #0, 1f
+ ldrb tmp1w, [src, #-1]
+ strb tmp1w, [dst, #-1]
+1:
+ RET
+
+L(mov_not_short_up):
+ /* We don't much care about the alignment of DST, but we want SRC
+ * to be 128-bit (16 byte) aligned so that we don't cross cache line
+ * boundaries on both loads and stores. */
+ ands tmp2, src, #15 /* Bytes to reach alignment. */
+ b.eq 2f
+ sub count, count, tmp2
+ /* Move enough data to reach alignment; unlike memcpy, we have to
+ * be aware of the overlap, which means we can't move data twice. */
+ tbz tmp2, #3, 1f
+ ldr tmp1, [src, #-8]!
+ str tmp1, [dst, #-8]!
+1:
+ tbz tmp2, #2, 1f
+ ldr tmp1w, [src, #-4]!
+ str tmp1w, [dst, #-4]!
+1:
+ tbz tmp2, #1, 1f
+ ldrh tmp1w, [src, #-2]!
+ strh tmp1w, [dst, #-2]!
+1:
+ tbz tmp2, #0, 1f
+ ldrb tmp1w, [src, #-1]!
+ strb tmp1w, [dst, #-1]!
+1:
+
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le L(tail63up)
+2:
+ subs count, count, #128
+ b.ge L(mov_body_large_up)
+ /* Less than 128 bytes to move, so handle 64 here and then jump
+ * to the tail. */
+ ldp A_l, A_h, [src, #-64]!
+ ldp B_l, B_h, [src, #16]
+ ldp C_l, C_h, [src, #32]
+ ldp D_l, D_h, [src, #48]
+ stp A_l, A_h, [dst, #-64]!
+ stp B_l, B_h, [dst, #16]
+ stp C_l, C_h, [dst, #32]
+ stp D_l, D_h, [dst, #48]
+ tst count, #0x3f
+ b.ne L(tail63up)
+ RET
+
+ /* Critical loop. Start at a new Icache line boundary. Assuming
+ * 64 bytes per line this ensures the entire loop is in one line. */
+ .p2align 6
+L(mov_body_large_up):
+ /* There are at least 128 bytes to move. */
+ ldp A_l, A_h, [src, #-16]
+ ldp B_l, B_h, [src, #-32]
+ ldp C_l, C_h, [src, #-48]
+ ldp D_l, D_h, [src, #-64]!
+1:
+ stp A_l, A_h, [dst, #-16]
+ ldp A_l, A_h, [src, #-16]
+ stp B_l, B_h, [dst, #-32]
+ ldp B_l, B_h, [src, #-32]
+ stp C_l, C_h, [dst, #-48]
+ ldp C_l, C_h, [src, #-48]
+ stp D_l, D_h, [dst, #-64]!
+ ldp D_l, D_h, [src, #-64]!
+ subs count, count, #64
+ b.ge 1b
+ stp A_l, A_h, [dst, #-16]
+ stp B_l, B_h, [dst, #-32]
+ stp C_l, C_h, [dst, #-48]
+ stp D_l, D_h, [dst, #-64]!
+ tst count, #0x3f
+ b.ne L(tail63up)
+ RET
+
+L(downwards):
+ /* For a downwards move we can safely use memcpy provided that
+ * DST is more than 16 bytes away from SRC. */
+ sub tmp1, src, #16
+ cmp dstin, tmp1
+ b.ls memcpy /* May overlap, but not critically. */
+
+ mov dst, dstin /* Preserve DSTIN for return value. */
+ cmp count, #64
+ b.ge L(mov_not_short_down)
+
+ /* Deal with small moves quickly by dropping straight into the
+ * exit block. */
+L(tail63down):
+ /* Move up to 48 bytes of data. At this point we only need the
+ * bottom 6 bits of count to be accurate. */
+ ands tmp1, count, #0x30
+ b.eq L(tail15down)
+ add dst, dst, tmp1
+ add src, src, tmp1
+ cmp tmp1w, #0x20
+ b.eq 1f
+ b.lt 2f
+ ldp A_l, A_h, [src, #-48]
+ stp A_l, A_h, [dst, #-48]
+1:
+ ldp A_l, A_h, [src, #-32]
+ stp A_l, A_h, [dst, #-32]
+2:
+ ldp A_l, A_h, [src, #-16]
+ stp A_l, A_h, [dst, #-16]
+L(tail15down):
+ /* Move up to 15 bytes of data. Does not assume additional data
+ being moved. */
+ tbz count, #3, 1f
+ ldr tmp1, [src], #8
+ str tmp1, [dst], #8
+1:
+ tbz count, #2, 1f
+ ldr tmp1w, [src], #4
+ str tmp1w, [dst], #4
+1:
+ tbz count, #1, 1f
+ ldrh tmp1w, [src], #2
+ strh tmp1w, [dst], #2
+1:
+ tbz count, #0, 1f
+ ldrb tmp1w, [src]
+ strb tmp1w, [dst]
+1:
+ RET
+
+L(mov_not_short_down):
+ /* We don't much care about the alignment of DST, but we want SRC
+ * to be 128-bit (16 byte) aligned so that we don't cross cache line
+ * boundaries on both loads and stores. */
+ neg tmp2, src
+ ands tmp2, tmp2, #15 /* Bytes to reach alignment. */
+ b.eq 2f
+ sub count, count, tmp2
+ /* Move enough data to reach alignment; unlike memcpy, we have to
+ * be aware of the overlap, which means we can't move data twice. */
+ tbz tmp2, #3, 1f
+ ldr tmp1, [src], #8
+ str tmp1, [dst], #8
+1:
+ tbz tmp2, #2, 1f
+ ldr tmp1w, [src], #4
+ str tmp1w, [dst], #4
+1:
+ tbz tmp2, #1, 1f
+ ldrh tmp1w, [src], #2
+ strh tmp1w, [dst], #2
+1:
+ tbz tmp2, #0, 1f
+ ldrb tmp1w, [src], #1
+ strb tmp1w, [dst], #1
+1:
+
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le L(tail63down)
+2:
+ subs count, count, #128
+ b.ge L(mov_body_large_down)
+ /* Less than 128 bytes to move, so handle 64 here and then jump
+ * to the tail. */
+ ldp A_l, A_h, [src]
+ ldp B_l, B_h, [src, #16]
+ ldp C_l, C_h, [src, #32]
+ ldp D_l, D_h, [src, #48]
+ stp A_l, A_h, [dst]
+ stp B_l, B_h, [dst, #16]
+ stp C_l, C_h, [dst, #32]
+ stp D_l, D_h, [dst, #48]
+ tst count, #0x3f
+ add src, src, #64
+ add dst, dst, #64
+ b.ne L(tail63down)
+ RET
+
+ /* Critical loop. Start at a new cache line boundary. Assuming
+ * 64 bytes per line this ensures the entire loop is in one line. */
+ .p2align 6
+L(mov_body_large_down):
+ /* There are at least 128 bytes to move. */
+ ldp A_l, A_h, [src, #0]
+ sub dst, dst, #16 /* Pre-bias. */
+ ldp B_l, B_h, [src, #16]
+ ldp C_l, C_h, [src, #32]
+ ldp D_l, D_h, [src, #48]! /* src += 64 - Pre-bias. */
+1:
+ stp A_l, A_h, [dst, #16]
+ ldp A_l, A_h, [src, #16]
+ stp B_l, B_h, [dst, #32]
+ ldp B_l, B_h, [src, #32]
+ stp C_l, C_h, [dst, #48]
+ ldp C_l, C_h, [src, #48]
+ stp D_l, D_h, [dst, #64]!
+ ldp D_l, D_h, [src, #64]!
+ subs count, count, #64
+ b.ge 1b
+ stp A_l, A_h, [dst, #16]
+ stp B_l, B_h, [dst, #32]
+ stp C_l, C_h, [dst, #48]
+ stp D_l, D_h, [dst, #64]
+ add src, src, #16
+ add dst, dst, #64 + 16
+ tst count, #0x3f
+ b.ne L(tail63down)
+ RET
+END (memmove)
+
+libc_hidden_builtin_def (memmove)
diff --git a/libc/ports/sysdeps/aarch64/memset.S b/libc/ports/sysdeps/aarch64/memset.S
new file mode 100644
index 000000000..f96f6a6ba
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/memset.S
@@ -0,0 +1,229 @@
+/* Copyright (C) 2012-2013 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/>. */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Unaligned accesses
+ *
+ */
+
+#include <sysdep.h>
+
+/* By default we assume that the DC instruction can be used to zero
+ data blocks more efficiently. In some circumstances this might be
+ unsafe, for example in an asymmetric multiprocessor environment with
+ different DC clear lengths (neither the upper nor lower lengths are
+ safe to use). The feature can be disabled by defining DONT_USE_DC.
+
+ If code may be run in a virtualized environment, then define
+ MAYBE_VIRT. This will cause the code to cache the system register
+ values rather than re-reading them each call. */
+
+#define dstin x0
+#define val w1
+#define count x2
+#define tmp1 x3
+#define tmp1w w3
+#define tmp2 x4
+#define tmp2w w4
+#define zva_len_x x5
+#define zva_len w5
+#define zva_bits_x x6
+
+#define A_l x7
+#define A_lw w7
+#define dst x8
+#define tmp3w w9
+
+ENTRY_ALIGN (__memset, 6)
+
+ mov dst, dstin /* Preserve return value. */
+ ands A_lw, val, #255
+#ifndef DONT_USE_DC
+ b.eq L(zero_mem)
+#endif
+ orr A_lw, A_lw, A_lw, lsl #8
+ orr A_lw, A_lw, A_lw, lsl #16
+ orr A_l, A_l, A_l, lsl #32
+L(tail_maybe_long):
+ cmp count, #64
+ b.ge L(not_short)
+L(tail_maybe_tiny):
+ cmp count, #15
+ b.le L(tail15tiny)
+L(tail63):
+ ands tmp1, count, #0x30
+ b.eq L(tail15)
+ add dst, dst, tmp1
+ cmp tmp1w, #0x20
+ b.eq 1f
+ b.lt 2f
+ stp A_l, A_l, [dst, #-48]
+1:
+ stp A_l, A_l, [dst, #-32]
+2:
+ stp A_l, A_l, [dst, #-16]
+
+L(tail15):
+ and count, count, #15
+ add dst, dst, count
+ stp A_l, A_l, [dst, #-16] /* Repeat some/all of last store. */
+ RET
+
+L(tail15tiny):
+ /* Set up to 15 bytes. Does not assume earlier memory
+ being set. */
+ tbz count, #3, 1f
+ str A_l, [dst], #8
+1:
+ tbz count, #2, 1f
+ str A_lw, [dst], #4
+1:
+ tbz count, #1, 1f
+ strh A_lw, [dst], #2
+1:
+ tbz count, #0, 1f
+ strb A_lw, [dst]
+1:
+ RET
+
+ /* Critical loop. Start at a new cache line boundary. Assuming
+ * 64 bytes per line, this ensures the entire loop is in one line. */
+ .p2align 6
+L(not_short):
+ neg tmp2, dst
+ ands tmp2, tmp2, #15
+ b.eq 2f
+ /* Bring DST to 128-bit (16-byte) alignment. We know that there's
+ * more than that to set, so we simply store 16 bytes and advance by
+ * the amount required to reach alignment. */
+ sub count, count, tmp2
+ stp A_l, A_l, [dst]
+ add dst, dst, tmp2
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le L(tail63)
+2:
+ sub dst, dst, #16 /* Pre-bias. */
+ sub count, count, #64
+1:
+ stp A_l, A_l, [dst, #16]
+ stp A_l, A_l, [dst, #32]
+ stp A_l, A_l, [dst, #48]
+ stp A_l, A_l, [dst, #64]!
+ subs count, count, #64
+ b.ge 1b
+ tst count, #0x3f
+ add dst, dst, #16
+ b.ne L(tail63)
+ RET
+
+#ifndef DONT_USE_DC
+ /* For zeroing memory, check to see if we can use the ZVA feature to
+ * zero entire 'cache' lines. */
+L(zero_mem):
+ mov A_l, #0
+ cmp count, #63
+ b.le L(tail_maybe_tiny)
+ neg tmp2, dst
+ ands tmp2, tmp2, #15
+ b.eq 1f
+ sub count, count, tmp2
+ stp A_l, A_l, [dst]
+ add dst, dst, tmp2
+ cmp count, #63
+ b.le L(tail63)
+1:
+ /* For zeroing small amounts of memory, it's not worth setting up
+ * the line-clear code. */
+ cmp count, #128
+ b.lt L(not_short)
+#ifdef MAYBE_VIRT
+ /* For efficiency when virtualized, we cache the ZVA capability. */
+ adrp tmp2, L(cache_clear)
+ ldr zva_len, [tmp2, #:lo12:L(cache_clear)]
+ tbnz zva_len, #31, L(not_short)
+ cbnz zva_len, L(zero_by_line)
+ mrs tmp1, dczid_el0
+ tbz tmp1, #4, 1f
+ /* ZVA not available. Remember this for next time. */
+ mov zva_len, #~0
+ str zva_len, [tmp2, #:lo12:L(cache_clear)]
+ b L(not_short)
+1:
+ mov tmp3w, #4
+ and zva_len, tmp1w, #15 /* Safety: other bits reserved. */
+ lsl zva_len, tmp3w, zva_len
+ str zva_len, [tmp2, #:lo12:L(cache_clear)]
+#else
+ mrs tmp1, dczid_el0
+ tbnz tmp1, #4, L(not_short)
+ mov tmp3w, #4
+ and zva_len, tmp1w, #15 /* Safety: other bits reserved. */
+ lsl zva_len, tmp3w, zva_len
+#endif
+
+L(zero_by_line):
+ /* Compute how far we need to go to become suitably aligned. We're
+ * already at quad-word alignment. */
+ cmp count, zva_len_x
+ b.lt L(not_short) /* Not enough to reach alignment. */
+ sub zva_bits_x, zva_len_x, #1
+ neg tmp2, dst
+ ands tmp2, tmp2, zva_bits_x
+ b.eq 1f /* Already aligned. */
+ /* Not aligned, check that there's enough to copy after alignment. */
+ sub tmp1, count, tmp2
+ cmp tmp1, #64
+ ccmp tmp1, zva_len_x, #8, ge /* NZCV=0b1000 */
+ b.lt L(not_short)
+ /* We know that there's at least 64 bytes to zero and that it's safe
+ * to overrun by 64 bytes. */
+ mov count, tmp1
+2:
+ stp A_l, A_l, [dst]
+ stp A_l, A_l, [dst, #16]
+ stp A_l, A_l, [dst, #32]
+ subs tmp2, tmp2, #64
+ stp A_l, A_l, [dst, #48]
+ add dst, dst, #64
+ b.ge 2b
+ /* We've overrun a bit, so adjust dst downwards. */
+ add dst, dst, tmp2
+1:
+ sub count, count, zva_len_x
+3:
+ dc zva, dst
+ add dst, dst, zva_len_x
+ subs count, count, zva_len_x
+ b.ge 3b
+ ands count, count, zva_bits_x
+ b.ne L(tail_maybe_long)
+ RET
+#ifdef MAYBE_VIRT
+ .bss
+ .p2align 2
+L(cache_clear):
+ .space 4
+#endif
+#endif /* DONT_USE_DC */
+
+END (__memset)
+weak_alias (__memset, memset)
+libc_hidden_builtin_def (memset)
diff --git a/libc/ports/sysdeps/aarch64/strcmp.S b/libc/ports/sysdeps/aarch64/strcmp.S
new file mode 100644
index 000000000..fa4705c8b
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/strcmp.S
@@ -0,0 +1,155 @@
+/* Copyright (C) 2012-2013 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/>. */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <sysdep.h>
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+/* Parameters and result. */
+#define src1 x0
+#define src2 x1
+#define result x0
+
+/* Internal variables. */
+#define data1 x2
+#define data1w w2
+#define data2 x3
+#define data2w w3
+#define has_nul x4
+#define diff x5
+#define syndrome x6
+#define tmp1 x7
+#define tmp2 x8
+#define tmp3 x9
+#define zeroones x10
+#define pos x11
+
+ /* Start of performance-critical section -- one 64B cache line. */
+ENTRY_ALIGN(strcmp, 6)
+
+ eor tmp1, src1, src2
+ mov zeroones, #REP8_01
+ tst tmp1, #7
+ b.ne L(misaligned8)
+ ands tmp1, src1, #7
+ b.ne L(mutual_align)
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. */
+L(loop_aligned):
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+L(start_realigned):
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ bic has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ orr syndrome, diff, has_nul
+ cbz syndrome, L(loop_aligned)
+ /* End of performance-critical section -- one 64B cache line. */
+
+#ifndef __AARCH64EB__
+ rev syndrome, syndrome
+ rev data1, data1
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ clz pos, syndrome
+ rev data2, data2
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ RET
+#else
+ /* For big-endian we cannot use the trick with the syndrome value
+ as carry-propagation can corrupt the upper bits if the trailing
+ bytes in the string contain 0x01. */
+ /* However, if there is no NUL byte in the dword, we can generate
+ the result directly. We can't just subtract the bytes as the
+ MSB might be significant. */
+ cbnz has_nul, 1f
+ cmp data1, data2
+ cset result, ne
+ cneg result, result, lo
+ RET
+1:
+ /* Re-compute the NUL-byte detection, using a byte-reversed value. */
+ rev tmp3, data1
+ sub tmp1, tmp3, zeroones
+ orr tmp2, tmp3, #REP8_7f
+ bic has_nul, tmp1, tmp2
+ rev has_nul, has_nul
+ orr syndrome, diff, has_nul
+ clz pos, syndrome
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ RET
+#endif
+
+L(mutual_align):
+ /* Sources are mutually aligned, but are not currently at an
+ alignment boundary. Round down the addresses and then mask off
+ the bytes that preceed the start point. */
+ bic src1, src1, #7
+ bic src2, src2, #7
+ lsl tmp1, tmp1, #3 /* Bytes beyond alignment -> bits. */
+ ldr data1, [src1], #8
+ neg tmp1, tmp1 /* Bits to alignment -64. */
+ ldr data2, [src2], #8
+ mov tmp2, #~0
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#endif
+ orr data1, data1, tmp2
+ orr data2, data2, tmp2
+ b L(start_realigned)
+
+L(misaligned8):
+ /* We can do better than this. */
+ ldrb data1w, [src1], #1
+ ldrb data2w, [src2], #1
+ cmp data1w, #1
+ ccmp data1w, data2w, #0, cs /* NZCV = 0b0000. */
+ b.eq L(misaligned8)
+ sub result, data1, data2
+ RET
+END(strcmp)
+libc_hidden_builtin_def (strcmp)
diff --git a/libc/ports/sysdeps/aarch64/strlen.S b/libc/ports/sysdeps/aarch64/strlen.S
new file mode 100644
index 000000000..ba05009c6
--- /dev/null
+++ b/libc/ports/sysdeps/aarch64/strlen.S
@@ -0,0 +1,117 @@
+/* Copyright (C) 2012-2013 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/>. */
+
+#include <sysdep.h>
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+/* Arguments and results. */
+#define srcin x0
+#define len x0
+
+/* Locals and temporaries. */
+#define src x1
+#define data1 x2
+#define data2 x3
+#define data2a x4
+#define has_nul1 x5
+#define has_nul2 x6
+#define tmp1 x7
+#define tmp2 x8
+#define tmp3 x9
+#define tmp4 x10
+#define zeroones x11
+#define pos x12
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+ /* Start of critial section -- keep to one 64Byte cache line. */
+ENTRY_ALIGN (strlen, 6)
+ mov zeroones, #REP8_01
+ bic src, srcin, #15
+ ands tmp1, srcin, #15
+ b.ne L(misaligned)
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. */
+ /* The inner loop deals with two Dwords at a time. This has a
+ slightly higher start-up cost, but we should win quite quickly,
+ especially on cores with a high number of issue slots per
+ cycle, as we get much better parallelism out of the operations. */
+L(loop):
+ ldp data1, data2, [src], #16
+L(realigned):
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, #REP8_7f
+ bic has_nul1, tmp1, tmp2
+ bics has_nul2, tmp3, tmp4
+ ccmp has_nul1, #0, #0, eq /* NZCV = 0000 */
+ b.eq L(loop)
+ /* End of critical section -- keep to one 64Byte cache line. */
+
+ sub len, src, srcin
+ cbz has_nul1, L(nul_in_data2)
+#ifdef __AARCH64EB__
+ mov data2, data1
+#endif
+ sub len, len, #8
+ mov has_nul2, has_nul1
+L(nul_in_data2):
+#ifdef __AARCH64EB__
+ /* For big-endian, carry propagation (if the final byte in the
+ string is 0x01) means we cannot use has_nul directly. The
+ easiest way to get the correct byte is to byte-swap the data
+ and calculate the syndrome a second time. */
+ rev data2, data2
+ sub tmp1, data2, zeroones
+ orr tmp2, data2, #REP8_7f
+ bic has_nul2, tmp1, tmp2
+#endif
+ sub len, len, #8
+ rev has_nul2, has_nul2
+ clz pos, has_nul2
+ add len, len, pos, lsr #3 /* Bits to bytes. */
+ RET
+
+L(misaligned):
+ cmp tmp1, #8
+ neg tmp1, tmp1
+ ldp data1, data2, [src], #16
+ lsl tmp1, tmp1, #3 /* Bytes beyond alignment -> bits. */
+ mov tmp2, #~0
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#endif
+ orr data1, data1, tmp2
+ orr data2a, data2, tmp2
+ csinv data1, data1, xzr, le
+ csel data2, data2, data2a, le
+ b L(realigned)
+END (strlen)
+libc_hidden_builtin_def (strlen)
diff --git a/libc/ports/sysdeps/aarch64/sysdep.h b/libc/ports/sysdeps/aarch64/sysdep.h
index d9469b8e6..6b75ada14 100644
--- a/libc/ports/sysdeps/aarch64/sysdep.h
+++ b/libc/ports/sysdeps/aarch64/sysdep.h
@@ -25,24 +25,33 @@
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
/* Define an entry point visible from C. */
-#define ENTRY(name) \
- .globl C_SYMBOL_NAME(name); \
- .type C_SYMBOL_NAME(name),%function; \
- .align 4; \
- C_LABEL(name) \
- cfi_startproc; \
+#define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),%function; \
+ .align 4; \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+/* Define an entry point visible from C. */
+#define ENTRY_ALIGN(name, align) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),%function; \
+ .p2align align; \
+ C_LABEL(name) \
+ cfi_startproc; \
CALL_MCOUNT
#undef END
-#define END(name) \
- cfi_endproc; \
+#define END(name) \
+ cfi_endproc; \
ASM_SIZE_DIRECTIVE(name)
/* If compiled for profiling, call `mcount' at the start of each function. */
#ifdef PROF
-# define CALL_MCOUNT \
- str x30, [sp, #-16]!; \
- bl mcount; \
+# define CALL_MCOUNT \
+ str x30, [sp, #-16]!; \
+ bl mcount; \
ldr x30, [sp], #16 ;
#else
# define CALL_MCOUNT /* Do nothing. */
diff --git a/libc/ports/sysdeps/arm/Makefile b/libc/ports/sysdeps/arm/Makefile
index 355f5b309..7c19398ff 100644
--- a/libc/ports/sysdeps/arm/Makefile
+++ b/libc/ports/sysdeps/arm/Makefile
@@ -39,11 +39,6 @@ endif
ifeq ($(subdir),debug)
CFLAGS-backtrace.c += -funwind-tables
-CFLAGS-tst-backtrace2.c += -funwind-tables
-CFLAGS-tst-backtrace3.c += -funwind-tables
-CFLAGS-tst-backtrace4.c += -funwind-tables
-CFLAGS-tst-backtrace5.c += -funwind-tables
-CFLAGS-tst-backtrace6.c += -funwind-tables
endif
ifeq ($(subdir),math)
diff --git a/libc/ports/sysdeps/hppa/fpu/fpu_control.h b/libc/ports/sysdeps/hppa/fpu/fpu_control.h
index 7aa16c9dd..5cac3344d 100644
--- a/libc/ports/sysdeps/hppa/fpu/fpu_control.h
+++ b/libc/ports/sysdeps/hppa/fpu/fpu_control.h
@@ -44,7 +44,7 @@ typedef unsigned int fpu_control_t;
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(cw) \
({ \
- union { unsigned long long __fpreg; unsigned int __halfreg[2]; } __fullfp; \
+ union { __extension__ unsigned long long __fpreg; unsigned int __halfreg[2]; } __fullfp; \
/* Get the current status word. */ \
__asm__ ("fstd %%fr0,0(%1)\n\t" \
"fldd 0(%1),%%fr0\n\t" \
@@ -54,7 +54,7 @@ typedef unsigned int fpu_control_t;
#define _FPU_SETCW(cw) \
({ \
- union { unsigned long long __fpreg; unsigned int __halfreg[2]; } __fullfp; \
+ union { __extension__ unsigned long long __fpreg; unsigned int __halfreg[2]; } __fullfp; \
__fullfp.__halfreg[0] = cw; \
__asm__ ("fldd 0(%1),%%fr0\n\t" \
: : "m" (__fullfp.__fpreg), "r" (__fullfp.__fpreg) : "%r0" ); \
diff --git a/libc/ports/sysdeps/m68k/bits/byteswap.h b/libc/ports/sysdeps/m68k/bits/byteswap.h
index 4e4dd2341..9f0a7b707 100644
--- a/libc/ports/sysdeps/m68k/bits/byteswap.h
+++ b/libc/ports/sysdeps/m68k/bits/byteswap.h
@@ -74,6 +74,7 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x00000000000000ffull) << 56))
/* Swap bytes in 64 bit value. */
+__extension__
static __inline unsigned long long
__bswap_64 (unsigned long long __bsx)
{
diff --git a/libc/ports/sysdeps/mips/Makefile b/libc/ports/sysdeps/mips/Makefile
index d87b2c406..a1526998e 100644
--- a/libc/ports/sysdeps/mips/Makefile
+++ b/libc/ports/sysdeps/mips/Makefile
@@ -13,11 +13,6 @@ endif
ifeq ($(subdir),debug)
CFLAGS-backtrace.c += -funwind-tables
-CFLAGS-tst-backtrace2.c += -funwind-tables
-CFLAGS-tst-backtrace3.c += -funwind-tables
-CFLAGS-tst-backtrace4.c += -funwind-tables
-CFLAGS-tst-backtrace5.c += -funwind-tables
-CFLAGS-tst-backtrace6.c += -funwind-tables
endif
ifeq ($(subdir),csu)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/ipc.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
index bc07c1fa3..04a75e2e8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
@@ -57,6 +57,6 @@ struct ipc_perm
#endif
unsigned short int __seq; /* Sequence number. */
unsigned int __pad3;
- unsigned long long int __unused1;
- unsigned long long int __unused2;
+ __extension__ unsigned long long int __unused1;
+ __extension__ unsigned long long int __unused2;
};
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
index 085a00d04..f3c5180b8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
@@ -39,16 +39,16 @@
struct sigcontext {
unsigned int sc_regmask;
unsigned int sc_status;
- unsigned long long sc_pc;
- unsigned long long sc_regs[32];
- unsigned long long sc_fpregs[32];
+ __extension__ unsigned long long sc_pc;
+ __extension__ unsigned long long sc_regs[32];
+ __extension__ unsigned long long sc_fpregs[32];
unsigned int sc_ownedfp;
unsigned int sc_fpc_csr;
unsigned int sc_fpc_eir;
unsigned int sc_used_math;
unsigned int sc_dsp;
- unsigned long long sc_mdhi;
- unsigned long long sc_mdlo;
+ __extension__ unsigned long long sc_mdhi;
+ __extension__ unsigned long long sc_mdlo;
unsigned long sc_hi1;
unsigned long sc_lo1;
unsigned long sc_hi2;
@@ -61,17 +61,17 @@ struct sigcontext {
/* This structure changed in 2.6.12-rc4 when DSP support was added. */
struct sigcontext {
- unsigned long long sc_regs[32];
- unsigned long long sc_fpregs[32];
- unsigned long long sc_mdhi;
- unsigned long long sc_hi1;
- unsigned long long sc_hi2;
- unsigned long long sc_hi3;
- unsigned long long sc_mdlo;
- unsigned long long sc_lo1;
- unsigned long long sc_lo2;
- unsigned long long sc_lo3;
- unsigned long long sc_pc;
+ __extension__ unsigned long long sc_regs[32];
+ __extension__ unsigned long long sc_fpregs[32];
+ __extension__ unsigned long long sc_mdhi;
+ __extension__ unsigned long long sc_hi1;
+ __extension__ unsigned long long sc_hi2;
+ __extension__ unsigned long long sc_hi3;
+ __extension__ unsigned long long sc_mdlo;
+ __extension__ unsigned long long sc_lo1;
+ __extension__ unsigned long long sc_lo2;
+ __extension__ unsigned long long sc_lo3;
+ __extension__ unsigned long long sc_pc;
unsigned int sc_fpc_csr;
unsigned int sc_used_math;
unsigned int sc_dsp;
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure
new file mode 100644
index 000000000..bfa30f6dc
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure
@@ -0,0 +1,4 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/tile/tilegx
+
+ldd_rewrite_script=$dir/ldd-rewrite.sed
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure.in b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure.in
new file mode 100644
index 000000000..87d86bd4c
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/configure.in
@@ -0,0 +1,4 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/tile/tilegx
+
+ldd_rewrite_script=$dir/ldd-rewrite.sed
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed
new file mode 100644
index 000000000..8b0bb691c
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib\)\(\|32\)\(/[^/]*\.so\.[0-9.]*\)[ ]*$_\1"\2\4 \232\4"_
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index 00bf7c4b8..70d09ea17 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -118,6 +118,8 @@ tests += tst-exec
tests-$(OPTION_EGLIBC_SPAWN) += tst-spawn
tests-$(OPTION_EGLIBC_WORDEXP) += wordexp-test
endif
+tests-static = tst-exec-static tst-spawn-static
+tests += $(tests-static)
others := getconf
install-bin := getconf
install-others-programs := $(inst_libexecdir)/getconf
@@ -143,13 +145,13 @@ ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
tests: $(objpfx)globtest.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
- $(SHELL) $< $(common-objpfx) '$(run-via-rtld-prefix)' \
- '$(test-wrapper)' '$(test-wrapper-env)'
+ $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
+ '$(test-program-prefix)' '$(test-wrapper-env)'
LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
ifeq (y,$(OPTION_EGLIBC_WORDEXP))
tests: $(objpfx)wordexp-tst.out
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
endif
endif
endif
@@ -201,8 +203,10 @@ CFLAGS-execlp.os = -fomit-frame-pointer
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
-tst-exec-ARGS = -- $(host-built-program-cmd)
-tst-spawn-ARGS = -- $(host-built-program-cmd)
+tst-exec-ARGS = -- $(host-test-program-cmd)
+tst-exec-static-ARGS = $(tst-exec-ARGS)
+tst-spawn-ARGS = -- $(host-test-program-cmd)
+tst-spawn-static-ARGS = $(tst-spawn-ARGS)
tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
tst-chmod-ARGS = $(objdir)
tst-vfork3-ARGS = --test-dir=$(objpfx)
@@ -302,7 +306,7 @@ $(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
# time to process.
$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out
MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \
- $(run-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
+ $(test-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
> /dev/null
$(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
@@ -340,3 +344,8 @@ $(objpfx)getconf.speclist: getconf-speclist.c posix-envs.def
$(compile.c) -E -o - \
| sed -n -e '/@@@PRESENT_/s/@@@PRESENT_//p' > $@.new
mv -f $@.new $@
+
+# This file is only actually needed at install time. But forcing it to
+# be built both makes it available for eyeball inspection and avoids the
+# surprise of things that look like compilation being done by 'make install'.
+others: $(objpfx)getconf.speclist
diff --git a/libc/posix/globtest.sh b/libc/posix/globtest.sh
index 24a1641bd..6f3eaddd8 100755
--- a/libc/posix/globtest.sh
+++ b/libc/posix/globtest.sh
@@ -20,10 +20,9 @@
set -e
common_objpfx=$1; shift
-run_via_rtld_prefix=$1; shift
-test_wrapper=$1; shift
+test_via_rtld_prefix=$1; shift
+test_program_prefix=$1; shift
test_wrapper_env=$1; shift
-run_program_prefix="${test_wrapper} ${run_via_rtld_prefix}"
logfile=$common_objpfx/posix/globtest.out
#CMP=cmp
@@ -78,7 +77,7 @@ rm -f $logfile
# Normal test
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -105,7 +104,7 @@ fi
# Don't let glob sort it
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -s "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -132,7 +131,7 @@ fi
# Mark directories
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -m "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -159,7 +158,7 @@ fi
# Find files starting with .
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -p "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -189,7 +188,7 @@ fi
# Test braces
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -202,7 +201,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -216,7 +215,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "{" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -229,7 +228,7 @@ fi
# Test NOCHECK
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "abc" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -242,7 +241,7 @@ fi
# Test NOMAGIC without magic characters
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "abc" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -255,7 +254,7 @@ fi
# Test NOMAGIC with magic characters
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -268,7 +267,7 @@ fi
# Test NOMAGIC for subdirs
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -281,7 +280,7 @@ fi
# Test subdirs correctly
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -297,7 +296,7 @@ fi
# Test subdirs for invalid names
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -310,7 +309,7 @@ fi
# Test subdirs with wildcard
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -324,7 +323,7 @@ fi
# Test subdirs with ?
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -339,7 +338,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -352,7 +351,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*-/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -364,7 +363,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*-" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -377,7 +376,7 @@ fi
# Test subdirs with ?
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -393,7 +392,7 @@ fi
# Test subdirs with [ .. ]
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -409,7 +408,7 @@ fi
# Test ']' inside bracket expression
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -423,7 +422,7 @@ fi
# Test tilde expansion
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
sort >$testout
echo ~ | $CMP - $testout >> $logfile || failed=1
@@ -438,7 +437,7 @@ fi
# Test tilde expansion with trailing slash
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
sort > $testout
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
@@ -458,7 +457,7 @@ fi
# Test tilde expansion with username
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
sort > $testout
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
@@ -473,7 +472,7 @@ fi
# Tilde expansion shouldn't match a file
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -486,7 +485,7 @@ fi
# Matching \** should only find *file6
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "\**" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -500,7 +499,7 @@ fi
# ... unless NOESCAPE is used, in which case it should entries with a
# leading \.
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -e "$testdir" "\**" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -515,7 +514,7 @@ fi
# Matching \*file6 should find *file6
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "\*file6" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -528,7 +527,7 @@ fi
# GLOB_BRACE alone
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -541,7 +540,7 @@ fi
# GLOB_BRACE and GLOB_NOESCAPE
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -554,7 +553,7 @@ fi
# Escaped comma
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -567,7 +566,7 @@ fi
# Escaped closing brace
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -580,7 +579,7 @@ fi
# Try a recursive failed search
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -593,7 +592,7 @@ fi
# ... with GLOB_ERR
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -606,7 +605,7 @@ fi
# Try a recursive search in unreadable directory
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "noread/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -618,7 +617,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -636,14 +635,14 @@ if test -z "$user"; then
fi
if test "$user" != root; then
# ... with GLOB_ERR
- ${run_program_prefix} \
+ ${test_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
GLOB_ABORTED
EOF
- ${run_program_prefix} \
+ ${test_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -657,7 +656,7 @@ fi # not run as root
# Try multiple patterns (GLOB_APPEND)
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -674,7 +673,7 @@ fi
# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -692,7 +691,7 @@ fi
# Test NOCHECK with non-existing file in subdir.
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -705,7 +704,7 @@ fi
# Test [[:punct:]] not matching leading period.
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -734,10 +733,10 @@ mkdir $testdir/dir6
echo 6 > $testdir/dir6/'file1[a'
echo 7 > $testdir/dir6/'file1[ab]'
failed=0
-v=`${run_program_prefix} \
+v=`${test_program_prefix} \
${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" \
'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
@@ -763,7 +762,7 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
EOF
${test_wrapper_env} \
HOME="$testdir" \
-${run_via_rtld_prefix} \
+${test_via_rtld_prefix} \
${common_objpfx}posix/globtest -ct "$testdir" \
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
'~\/dir1/file1_2' |
@@ -778,15 +777,15 @@ EOF
if eval test -d ~"$USER"/; then
user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
if test -n "$user"; then
- ${run_program_prefix} \
+ ${test_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
sort > $testout
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
- ${run_program_prefix} \
+ ${test_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
sort > $testout
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
- ${run_program_prefix} \
+ ${test_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
sort > $testout
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
diff --git a/libc/posix/sys/types.h b/libc/posix/sys/types.h
index b36b561db..33c2176d0 100644
--- a/libc/posix/sys/types.h
+++ b/libc/posix/sys/types.h
@@ -164,7 +164,7 @@ typedef short int int16_t;
typedef int int32_t;
# if __WORDSIZE == 64
typedef long int int64_t;
-# elif __GLIBC_HAVE_LONG_LONG
+# else
__extension__ typedef long long int int64_t;
# endif
# endif
@@ -175,7 +175,7 @@ typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
# if __WORDSIZE == 64
typedef unsigned long int u_int64_t;
-# elif __GLIBC_HAVE_LONG_LONG
+# else
__extension__ typedef unsigned long long int u_int64_t;
# endif
diff --git a/libc/posix/tst-exec-static.c b/libc/posix/tst-exec-static.c
new file mode 100644
index 000000000..bdd636995
--- /dev/null
+++ b/libc/posix/tst-exec-static.c
@@ -0,0 +1 @@
+#include "tst-exec.c"
diff --git a/libc/posix/tst-exec.c b/libc/posix/tst-exec.c
index 3a76b3229..a1a2c183c 100644
--- a/libc/posix/tst-exec.c
+++ b/libc/posix/tst-exec.c
@@ -126,10 +126,10 @@ do_test (int argc, char *argv[])
int status;
/* We must have
- - four parameters left of called initially
- + path for ld.so
- + "--library-path"
- + the library path
+ - one or four parameters left if called initially
+ + path for ld.so optional
+ + "--library-path" optional
+ + the library path optional
+ the application name
- three parameters left if called through re-execution
+ file descriptor number which is supposed to be closed
@@ -145,7 +145,7 @@ do_test (int argc, char *argv[])
return handle_restart (argv[1], argv[2], argv[3]);
}
- if (argc != 5)
+ if (argc != 2 && argc != 5)
error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc);
/* Prepare the test. We are creating two files: one which file descriptor
@@ -185,8 +185,12 @@ do_test (int argc, char *argv[])
snprintf (fd2name, sizeof fd2name, "%d", fd2);
/* This is the child. Construct the command line. */
- execl (argv[1], argv[1], argv[2], argv[3], argv[4], "--direct",
- "--restart", fd1name, fd2name, name1, NULL);
+ if (argc == 5)
+ execl (argv[1], argv[1], argv[2], argv[3], argv[4], "--direct",
+ "--restart", fd1name, fd2name, name1, NULL);
+ else
+ execl (argv[1], argv[1], "--direct",
+ "--restart", fd1name, fd2name, name1, NULL);
error (EXIT_FAILURE, errno, "cannot exec");
}
diff --git a/libc/posix/tst-spawn-static.c b/libc/posix/tst-spawn-static.c
new file mode 100644
index 000000000..1b1d34fe2
--- /dev/null
+++ b/libc/posix/tst-spawn-static.c
@@ -0,0 +1 @@
+#include "tst-spawn.c"
diff --git a/libc/posix/tst-spawn.c b/libc/posix/tst-spawn.c
index 718602eb3..66fd26bba 100644
--- a/libc/posix/tst-spawn.c
+++ b/libc/posix/tst-spawn.c
@@ -169,12 +169,13 @@ do_test (int argc, char *argv[])
char fd3name[18];
char fd4name[18];
char *spargv[12];
+ int i;
/* We must have
- - four parameters left of called initially
- + path for ld.so
- + "--library-path"
- + the library path
+ - one or four parameters left if called initially
+ + path for ld.so optional
+ + "--library-path" optional
+ + the library path optional
+ the application name
- five parameters left if called through re-execution
+ file descriptor number which is supposed to be closed
@@ -183,7 +184,7 @@ do_test (int argc, char *argv[])
+ thhe duped second descriptor
+ the name of the closed descriptor
*/
- if (argc != (restart ? 6 : 5))
+ if (argc != (restart ? 6 : 2) && argc != (restart ? 6 : 5))
error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc);
if (restart)
@@ -235,18 +236,16 @@ do_test (int argc, char *argv[])
snprintf (fd3name, sizeof fd3name, "%d", fd3);
snprintf (fd4name, sizeof fd4name, "%d", fd4);
- spargv[0] = argv[1];
- spargv[1] = argv[2];
- spargv[2] = argv[3];
- spargv[3] = argv[4];
- spargv[4] = (char *) "--direct";
- spargv[5] = (char *) "--restart";
- spargv[6] = fd1name;
- spargv[7] = fd2name;
- spargv[8] = fd3name;
- spargv[9] = fd4name;
- spargv[10] = name1;
- spargv[11] = NULL;
+ for (i = 0; i < (argc == (restart ? 6 : 5) ? 4 : 1); i++)
+ spargv[i] = argv[i + 1];
+ spargv[i++] = (char *) "--direct";
+ spargv[i++] = (char *) "--restart";
+ spargv[i++] = fd1name;
+ spargv[i++] = fd2name;
+ spargv[i++] = fd3name;
+ spargv[i++] = fd4name;
+ spargv[i++] = name1;
+ spargv[i] = NULL;
if (posix_spawn (&pid, argv[1], &actions, NULL, spargv, environ) != 0)
error (EXIT_FAILURE, errno, "posix_spawn");
diff --git a/libc/posix/wordexp-tst.sh b/libc/posix/wordexp-tst.sh
index 93b507787..5dff727e3 100755
--- a/libc/posix/wordexp-tst.sh
+++ b/libc/posix/wordexp-tst.sh
@@ -24,7 +24,7 @@ set -e
# The others are just there to be parameters.
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
logfile=${common_objpfx}posix/wordexp-tst.out
testout=${common_objpfx}posix/wordexp-test-result
@@ -38,7 +38,7 @@ IFS=" \
export IFS
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
@@ -50,7 +50,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
@@ -63,7 +63,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
@@ -76,7 +76,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
@@ -88,7 +88,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
@@ -102,7 +102,7 @@ fi
# Why? Because bash does it that way..
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
@@ -114,7 +114,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
wordexp returned 0
@@ -129,7 +129,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
wordexp returned 0
@@ -141,7 +141,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
@@ -154,7 +154,7 @@ if test $failed -ne 0; then
status=1
fi
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
cat <<"EOF" | cmp - ${testout}10 || failed=1
wordexp returned 0
diff --git a/libc/rt/Makefile b/libc/rt/Makefile
index e723fdbbe..6a98c8151 100644
--- a/libc/rt/Makefile
+++ b/libc/rt/Makefile
@@ -80,4 +80,4 @@ ifeq (yes,$(build-bounded))
$(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library)
endif
-tst-mqueue7-ARGS = -- $(host-built-program-cmd)
+tst-mqueue7-ARGS = -- $(host-test-program-cmd)
diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile
index f4ec429fa..362f34310 100644
--- a/libc/stdio-common/Makefile
+++ b/libc/stdio-common/Makefile
@@ -82,11 +82,11 @@ tests: do-tst-unbputc do-tst-printf
do-tst-unbputc: $(objpfx)tst-unbputc.out
$(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
do-tst-printf: $(objpfx)tst-printf.out
$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
endif
CFLAGS-vfprintf.c = -Wno-uninitialized
@@ -140,7 +140,7 @@ tst-grouping-ENV = LOCPATH=$(common-objpfx)localedata
CPPFLAGS += $(libio-mtsafe)
$(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1
- $(built-program-cmd) > $@ 2>&1
+ $(test-program-cmd) > $@ 2>&1
cmp tst-setvbuf1.expect $@
ifeq ($(build-shared),yes)
diff --git a/libc/stdio-common/tst-printf.sh b/libc/stdio-common/tst-printf.sh
index 6986c5800..81e1e24af 100644
--- a/libc/stdio-common/tst-printf.sh
+++ b/libc/stdio-common/tst-printf.sh
@@ -20,12 +20,12 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
status=0
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}stdio-common/tst-printf \
> ${common_objpfx}stdio-common/tst-printf.out || status=1
diff --git a/libc/stdio-common/tst-unbputc.sh b/libc/stdio-common/tst-unbputc.sh
index 07da54e79..3ce869640 100755
--- a/libc/stdio-common/tst-unbputc.sh
+++ b/libc/stdio-common/tst-unbputc.sh
@@ -20,11 +20,11 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
status=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}stdio-common/tst-unbputc \
2> ${common_objpfx}stdio-common/tst-unbputc.out || status=1
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 7e9b75dd0..83706707a 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -150,7 +150,7 @@ $(objpfx)isomac: isomac.c
$(native-compile)
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
LDFLAGS-tst-putenv = $(no-as-needed)
diff --git a/libc/stdlib/stdlib.h b/libc/stdlib/stdlib.h
index 6bf708a16..b49a41cc5 100644
--- a/libc/stdlib/stdlib.h
+++ b/libc/stdlib/stdlib.h
@@ -151,7 +151,7 @@ extern long int atol (const char *__nptr)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
__END_NAMESPACE_STD
-#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
+#if defined __USE_ISOC99 || defined __USE_MISC
__BEGIN_NAMESPACE_C99
/* Convert a string to a long long integer. */
__extension__ extern long long int atoll (const char *__nptr)
@@ -189,7 +189,7 @@ extern unsigned long int strtoul (const char *__restrict __nptr,
__THROW __nonnull ((1));
__END_NAMESPACE_STD
-#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD
+#ifdef __USE_BSD
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoq (const char *__restrict __nptr,
@@ -200,9 +200,9 @@ __extension__
extern unsigned long long int strtouq (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
-#endif /* GCC and use BSD. */
+#endif /* Use BSD. */
-#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
+#if defined __USE_ISOC99 || defined __USE_MISC
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
@@ -215,7 +215,7 @@ extern unsigned long long int strtoull (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
__END_NAMESPACE_C99
-#endif /* ISO C99 or GCC and use MISC. */
+#endif /* ISO C99 or use MISC. */
#ifdef __USE_GNU
@@ -415,7 +415,8 @@ struct drand48_data
unsigned short int __old_x[3]; /* Old state. */
unsigned short int __c; /* Additive const. in congruential formula. */
unsigned short int __init; /* Flag for initializing. */
- unsigned long long int __a; /* Factor in congruential formula. */
+ __extension__ unsigned long long int __a; /* Factor in congruential
+ formula. */
};
/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
diff --git a/libc/stdlib/tst-fmtmsg.sh b/libc/stdlib/tst-fmtmsg.sh
index 5227015d7..963c522bb 100755
--- a/libc/stdlib/tst-fmtmsg.sh
+++ b/libc/stdlib/tst-fmtmsg.sh
@@ -20,10 +20,10 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_program_prefix=$2
objpfx=$3
-test="${run_program_prefix} ${objpfx}tst-fmtmsg"
+test="${test_program_prefix} ${objpfx}tst-fmtmsg"
out=${objpfx}tst-fmtmsg.out
LC_ALL=C
diff --git a/libc/string/Makefile b/libc/string/Makefile
index e4bf8d0dd..6447543c3 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -88,6 +88,6 @@ ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-svc.out
$(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
- $(built-program-cmd) < $(word 1,$^) > $@
+ $(test-program-cmd) < $(word 1,$^) > $@
@cmp tst-svc.expect $(objpfx)tst-svc.out
endif
diff --git a/libc/string/byteswap.h b/libc/string/byteswap.h
index a31e902be..705015f05 100644
--- a/libc/string/byteswap.h
+++ b/libc/string/byteswap.h
@@ -33,9 +33,7 @@
/* Return a value with all bytes in the 32 bit argument swapped. */
#define bswap_32(x) __bswap_32 (x)
-#if __GLIBC_HAVE_LONG_LONG
/* Return a value with all bytes in the 64 bit argument swapped. */
-# define bswap_64(x) __bswap_64 (x)
-#endif
+#define bswap_64(x) __bswap_64 (x)
#endif /* byteswap.h */
diff --git a/libc/string/endian.h b/libc/string/endian.h
index 9ae5f2dd7..f414cb150 100644
--- a/libc/string/endian.h
+++ b/libc/string/endian.h
@@ -70,12 +70,10 @@
# define be32toh(x) __bswap_32 (x)
# define le32toh(x) (x)
-# if __GLIBC_HAVE_LONG_LONG
-# define htobe64(x) __bswap_64 (x)
-# define htole64(x) (x)
-# define be64toh(x) __bswap_64 (x)
-# define le64toh(x) (x)
-# endif
+# define htobe64(x) __bswap_64 (x)
+# define htole64(x) (x)
+# define be64toh(x) __bswap_64 (x)
+# define le64toh(x) (x)
# else
# define htobe16(x) (x)
@@ -88,12 +86,10 @@
# define be32toh(x) (x)
# define le32toh(x) __bswap_32 (x)
-# if __GLIBC_HAVE_LONG_LONG
-# define htobe64(x) (x)
-# define htole64(x) __bswap_64 (x)
-# define be64toh(x) (x)
-# define le64toh(x) __bswap_64 (x)
-# endif
+# define htobe64(x) (x)
+# define htole64(x) __bswap_64 (x)
+# define be64toh(x) (x)
+# define le64toh(x) __bswap_64 (x)
# endif
#endif
diff --git a/libc/string/string.h b/libc/string/string.h
index 4b3a686f2..ecc3fef1b 100644
--- a/libc/string/string.h
+++ b/libc/string/string.h
@@ -522,10 +522,8 @@ extern int ffs (int __i) __THROW __attribute__ ((__const__));
platforms. */
# ifdef __USE_GNU
extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
-# ifdef __GNUC__
__extension__ extern int ffsll (long long int __ll)
__THROW __attribute__ ((__const__));
-# endif
# endif
/* Compare S1 and S2, ignoring case. */
diff --git a/libc/sysdeps/generic/inttypes.h b/libc/sysdeps/generic/inttypes.h
index 47fe751e2..dc9751905 100644
--- a/libc/sysdeps/generic/inttypes.h
+++ b/libc/sysdeps/generic/inttypes.h
@@ -286,8 +286,8 @@ typedef struct
/* We have to define the `uintmax_t' type using `lldiv_t'. */
typedef struct
{
- long long int quot; /* Quotient. */
- long long int rem; /* Remainder. */
+ __extension__ long long int quot; /* Quotient. */
+ __extension__ long long int rem; /* Remainder. */
} imaxdiv_t;
#endif
diff --git a/libc/sysdeps/gnu/netinet/tcp.h b/libc/sysdeps/gnu/netinet/tcp.h
index 278fc9d8a..b62a696e5 100644
--- a/libc/sysdeps/gnu/netinet/tcp.h
+++ b/libc/sysdeps/gnu/netinet/tcp.h
@@ -37,20 +37,29 @@
/*
* User-settable options (used with setsockopt).
*/
-#define TCP_NODELAY 1 /* Don't delay send to coalesce packets */
-#define TCP_MAXSEG 2 /* Set maximum segment size */
-#define TCP_CORK 3 /* Control sending of partial frames */
-#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
-#define TCP_KEEPINTVL 5 /* Interval between keepalives */
-#define TCP_KEEPCNT 6 /* Number of keepalives before death */
-#define TCP_SYNCNT 7 /* Number of SYN retransmits */
-#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
-#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
-#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
-#define TCP_INFO 11 /* Information about this connection. */
-#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */
-#define TCP_CONGESTION 13 /* Congestion control algorithm. */
-#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
+#define TCP_NODELAY 1 /* Don't delay send to coalesce packets */
+#define TCP_MAXSEG 2 /* Set maximum segment size */
+#define TCP_CORK 3 /* Control sending of partial frames */
+#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
+#define TCP_KEEPINTVL 5 /* Interval between keepalives */
+#define TCP_KEEPCNT 6 /* Number of keepalives before death */
+#define TCP_SYNCNT 7 /* Number of SYN retransmits */
+#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
+#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
+#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
+#define TCP_INFO 11 /* Information about this connection. */
+#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */
+#define TCP_CONGESTION 13 /* Congestion control algorithm. */
+#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
+#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
+#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
+#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
+#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
+#define TCP_REPAIR 19 /* TCP sock is under repair right now */
+#define TCP_REPAIR_QUEUE 20 /* Set TCP queue to repair */
+#define TCP_QUEUE_SEQ 21 /* Set sequence number of repaired queue. */
+#define TCP_REPAIR_OPTIONS 22 /* Repair TCP connection options */
+#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
#ifdef __USE_MISC
# include <sys/types.h>
@@ -243,6 +252,49 @@ struct tcp_md5sig
u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */
};
+/* For socket repair options. */
+struct tcp_repair_opt
+{
+ u_int32_t opt_code;
+ u_int32_t opt_val;
+};
+
+/* Queue to repair, for TCP_REPAIR_QUEUE. */
+enum
+{
+ TCP_NO_QUEUE,
+ TCP_RECV_QUEUE,
+ TCP_SEND_QUEUE,
+ TCP_QUEUES_NR,
+};
+
+/* For cookie transactions socket options. */
+#define TCP_COOKIE_MIN 8 /* 64-bits */
+#define TCP_COOKIE_MAX 16 /* 128-bits */
+#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX)
+
+/* Flags for both getsockopt and setsockopt */
+#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */
+#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies,
+ * supercedes everything. */
+
+/* Flags for getsockopt */
+#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
+#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
+
+#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */
+#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */
+
+struct tcp_cookie_transactions
+{
+ u_int16_t tcpct_flags;
+ u_int8_t __tcpct_pad1;
+ u_int8_t tcpct_cookie_desired;
+ u_int16_t tcpct_s_data_desired;
+ u_int16_t tcpct_used;
+ u_int8_t tcpct_value[TCP_MSS_DEFAULT];
+};
+
#endif /* Misc. */
#endif /* netinet/tcp.h */
diff --git a/libc/sysdeps/i386/dl-machine.h b/libc/sysdeps/i386/dl-machine.h
index 9e36687ef..a1e40d8eb 100644
--- a/libc/sysdeps/i386/dl-machine.h
+++ b/libc/sysdeps/i386/dl-machine.h
@@ -348,6 +348,12 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
switch (r_type)
{
+# ifndef RTLD_BOOTSTRAP
+ case R_386_SIZE32:
+ /* Set to symbol size plus addend. */
+ *reloc_addr += sym->st_size;
+ break;
+# endif
case R_386_GLOB_DAT:
case R_386_JMP_SLOT:
*reloc_addr = value;
@@ -507,6 +513,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
switch (ELF32_R_TYPE (reloc->r_info))
{
+ case R_386_SIZE32:
+ /* Set to symbol size plus addend. */
+ value = sym->st_size;
case R_386_GLOB_DAT:
case R_386_JMP_SLOT:
case R_386_32:
diff --git a/libc/sysdeps/i386/fpu/fenv_private.h b/libc/sysdeps/i386/fpu/fenv_private.h
index 03f4c97a9..1f8336cf9 100644
--- a/libc/sysdeps/i386/fpu/fenv_private.h
+++ b/libc/sysdeps/i386/fpu/fenv_private.h
@@ -176,7 +176,7 @@ libc_feupdateenv_test_sse (fenv_t *e, int ex)
/* Raise SIGFPE for any new exceptions since the hold. Expect that
the normal environment has all exceptions masked. */
- if (__builtin_expect ((old_mxcsr >> 7) & cur_ex, 0))
+ if (__glibc_unlikely (~(old_mxcsr >> 7) & cur_ex))
__feraiseexcept (cur_ex);
/* Test for exceptions raised since the hold. */
diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps
index 3fc30de46..1525b16f3 100644
--- a/libc/sysdeps/i386/fpu/libm-test-ulps
+++ b/libc/sysdeps/i386/fpu/libm-test-ulps
@@ -303,6 +303,12 @@ float: 1
ifloat: 1
ildouble: 2
ldouble: 2
+Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 - 7.107906849659093345062145442726115449315e2 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 - 8.973081118419833726837456344608533993585e1 i":
+double: 1
+idouble: 1
Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
diff --git a/libc/sysdeps/ieee754/dbl-64/atnat.h b/libc/sysdeps/ieee754/dbl-64/atnat.h
index 2beb33b05..a1a3572f7 100644
--- a/libc/sysdeps/ieee754/dbl-64/atnat.h
+++ b/libc/sysdeps/ieee754/dbl-64/atnat.h
@@ -130,8 +130,6 @@
#endif
#endif
-#define ZERO 0.0
-#define ONE 1.0
#define A a.d
#define B b.d
#define C c.d
@@ -152,7 +150,5 @@
#define U6 u6.d
#define U7 u7.d
#define U8 u8.d
-#define TWO8 0x1.0p8 /* 2^8 */
-#define TWO52 0x1.0p52 /* 2^52 */
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/atnat2.h b/libc/sysdeps/ieee754/dbl-64/atnat2.h
index 10b32535b..f12498bf3 100644
--- a/libc/sysdeps/ieee754/dbl-64/atnat2.h
+++ b/libc/sysdeps/ieee754/dbl-64/atnat2.h
@@ -162,11 +162,4 @@
#endif
#endif
-#define ZERO 0.0 /* 0 */
-#define MZERO -0.0 /* 0 with the sign bit set */
-#define ONE 1.0 /* 1 */
-#define TWO8 0x1.0p8 /* 2^8 */
-#define TWO52 0x1.0p52 /* 2^52 */
-#define TWOM1022 0x1.0p-1022 /* 2^-1022 */
-
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/mpa.c b/libc/sysdeps/ieee754/dbl-64/mpa.c
index 7abad6782..ede8ed198 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpa.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpa.c
@@ -22,9 +22,7 @@
/* FUNCTIONS: */
/* mcr */
/* acr */
-/* cr */
/* cpy */
-/* cpymn */
/* norm */
/* denorm */
/* mp_dbl */
@@ -44,7 +42,6 @@
#include "endian.h"
#include "mpa.h"
-#include "mpa2.h"
#include <sys/param.h>
#ifndef SECTION
@@ -60,30 +57,45 @@ const mp_no mptwo = {1, {1.0, 2.0}};
/* Compare mantissa of two multiple precision numbers regardless of the sign
and exponent of the numbers. */
static int
-mcr(const mp_no *x, const mp_no *y, int p) {
+mcr (const mp_no *x, const mp_no *y, int p)
+{
int i;
- for (i=1; i<=p; i++) {
- if (X[i] == Y[i]) continue;
- else if (X[i] > Y[i]) return 1;
- else return -1; }
+ for (i = 1; i <= p; i++)
+ {
+ if (X[i] == Y[i])
+ continue;
+ else if (X[i] > Y[i])
+ return 1;
+ else
+ return -1;
+ }
return 0;
}
/* Compare the absolute values of two multiple precision numbers. */
int
-__acr(const mp_no *x, const mp_no *y, int p) {
+__acr (const mp_no *x, const mp_no *y, int p)
+{
int i;
- if (X[0] == ZERO) {
- if (Y[0] == ZERO) i= 0;
- else i=-1;
- }
- else if (Y[0] == ZERO) i= 1;
- else {
- if (EX > EY) i= 1;
- else if (EX < EY) i=-1;
- else i= mcr(x,y,p);
- }
+ if (X[0] == ZERO)
+ {
+ if (Y[0] == ZERO)
+ i = 0;
+ else
+ i = -1;
+ }
+ else if (Y[0] == ZERO)
+ i = 1;
+ else
+ {
+ if (EX > EY)
+ i = 1;
+ else if (EX < EY)
+ i = -1;
+ else
+ i = mcr (x, y, p);
+ }
return i;
}
@@ -92,59 +104,86 @@ __acr(const mp_no *x, const mp_no *y, int p) {
#ifndef NO___CPY
/* Copy multiple precision number X into Y. They could be the same
number. */
-void __cpy(const mp_no *x, mp_no *y, int p) {
+void
+__cpy (const mp_no *x, mp_no *y, int p)
+{
EY = EX;
- for (int i=0; i <= p; i++) Y[i] = X[i];
+ for (int i = 0; i <= p; i++)
+ Y[i] = X[i];
}
#endif
#ifndef NO___MP_DBL
/* Convert a multiple precision number *X into a double precision
number *Y, normalized case (|x| >= 2**(-1022))). */
-static void norm(const mp_no *x, double *y, int p)
+static void
+norm (const mp_no *x, double *y, int p)
{
- #define R RADIXI
+#define R RADIXI
int i;
- double a,c,u,v,z[5];
- if (p<5) {
- if (p==1) c = X[1];
- else if (p==2) c = X[1] + R* X[2];
- else if (p==3) c = X[1] + R*(X[2] + R* X[3]);
- else if (p==4) c =(X[1] + R* X[2]) + R*R*(X[3] + R*X[4]);
- }
- else {
- for (a=ONE, z[1]=X[1]; z[1] < TWO23; )
- {a *= TWO; z[1] *= TWO; }
-
- for (i=2; i<5; i++) {
- z[i] = X[i]*a;
- u = (z[i] + CUTTER)-CUTTER;
- if (u > z[i]) u -= RADIX;
- z[i] -= u;
- z[i-1] += u*RADIXI;
- }
-
- u = (z[3] + TWO71) - TWO71;
- if (u > z[3]) u -= TWO19;
- v = z[3]-u;
-
- if (v == TWO18) {
- if (z[4] == ZERO) {
- for (i=5; i <= p; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
- }
- }
- else z[3] += ONE;
+ double a, c, u, v, z[5];
+ if (p < 5)
+ {
+ if (p == 1)
+ c = X[1];
+ else if (p == 2)
+ c = X[1] + R * X[2];
+ else if (p == 3)
+ c = X[1] + R * (X[2] + R * X[3]);
+ else if (p == 4)
+ c = (X[1] + R * X[2]) + R * R * (X[3] + R * X[4]);
}
+ else
+ {
+ for (a = ONE, z[1] = X[1]; z[1] < TWO23;)
+ {
+ a *= TWO;
+ z[1] *= TWO;
+ }
- c = (z[1] + R *(z[2] + R * z[3]))/a;
- }
+ for (i = 2; i < 5; i++)
+ {
+ z[i] = X[i] * a;
+ u = (z[i] + CUTTER) - CUTTER;
+ if (u > z[i])
+ u -= RADIX;
+ z[i] -= u;
+ z[i - 1] += u * RADIXI;
+ }
+
+ u = (z[3] + TWO71) - TWO71;
+ if (u > z[3])
+ u -= TWO19;
+ v = z[3] - u;
+
+ if (v == TWO18)
+ {
+ if (z[4] == ZERO)
+ {
+ for (i = 5; i <= p; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
+ }
+ else
+ z[3] += ONE;
+ }
+
+ c = (z[1] + R * (z[2] + R * z[3])) / a;
+ }
c *= X[0];
- for (i=1; i<EX; i++) c *= RADIX;
- for (i=1; i>EX; i--) c *= RADIXI;
+ for (i = 1; i < EX; i++)
+ c *= RADIX;
+ for (i = 1; i > EX; i--)
+ c *= RADIXI;
*y = c;
#undef R
@@ -152,58 +191,129 @@ static void norm(const mp_no *x, double *y, int p)
/* Convert a multiple precision number *X into a double precision
number *Y, Denormal case (|x| < 2**(-1022))). */
-static void denorm(const mp_no *x, double *y, int p)
+static void
+denorm (const mp_no *x, double *y, int p)
{
- int i,k;
- double c,u,z[5];
+ int i, k;
+ double c, u, z[5];
#define R RADIXI
- if (EX<-44 || (EX==-44 && X[1]<TWO5))
- { *y=ZERO; return; }
-
- if (p==1) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=ZERO; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=ZERO; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else if (p==2) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=X[2]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; k=1;}
- z[3] = X[k];
- }
+ if (EX < -44 || (EX == -44 && X[1] < TWO5))
+ {
+ *y = ZERO;
+ return;
+ }
+
+ if (p == 1)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = ZERO;
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = ZERO;
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else if (p == 2)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = X[2];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ k = 1;
+ }
+ z[3] = X[k];
+ }
u = (z[3] + TWO57) - TWO57;
- if (u > z[3]) u -= TWO5;
+ if (u > z[3])
+ u -= TWO5;
- if (u==z[3]) {
- for (i=k+1; i <= p; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
+ if (u == z[3])
+ {
+ for (i = k + 1; i <= p; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
}
- }
- c = X[0]*((z[1] + R*(z[2] + R*z[3])) - TWO10);
+ c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10);
- *y = c*TWOM1032;
+ *y = c * TWOM1032;
#undef R
}
/* Convert multiple precision number *X into double precision number *Y. The
result is correctly rounded to the nearest/even. */
-void __mp_dbl(const mp_no *x, double *y, int p) {
-
- if (X[0] == ZERO) {*y = ZERO; return; }
+void
+__mp_dbl (const mp_no *x, double *y, int p)
+{
+ if (X[0] == ZERO)
+ {
+ *y = ZERO;
+ return;
+ }
if (__glibc_likely (EX > -42 || (EX == -42 && X[1] >= TWO10)))
- norm(x,y,p);
+ norm (x, y, p);
else
- denorm(x,y,p);
+ denorm (x, y, p);
}
#endif
@@ -211,27 +321,44 @@ void __mp_dbl(const mp_no *x, double *y, int p) {
small, the result is truncated. */
void
SECTION
-__dbl_mp(double x, mp_no *y, int p) {
-
- int i,n;
+__dbl_mp (double x, mp_no *y, int p)
+{
+ int i, n;
double u;
/* Sign. */
- if (x == ZERO) {Y[0] = ZERO; return; }
- else if (x > ZERO) Y[0] = ONE;
- else {Y[0] = MONE; x=-x; }
+ if (x == ZERO)
+ {
+ Y[0] = ZERO;
+ return;
+ }
+ else if (x > ZERO)
+ Y[0] = ONE;
+ else
+ {
+ Y[0] = MONE;
+ x = -x;
+ }
/* Exponent. */
- for (EY=ONE; x >= RADIX; EY += ONE) x *= RADIXI;
- for ( ; x < ONE; EY -= ONE) x *= RADIX;
+ for (EY = ONE; x >= RADIX; EY += ONE)
+ x *= RADIXI;
+ for (; x < ONE; EY -= ONE)
+ x *= RADIX;
/* Digits. */
- n=MIN(p,4);
- for (i=1; i<=n; i++) {
- u = (x + TWO52) - TWO52;
- if (u>x) u -= ONE;
- Y[i] = u; x -= u; x *= RADIX; }
- for ( ; i<=p; i++) Y[i] = ZERO;
+ n = MIN (p, 4);
+ for (i = 1; i <= n; i++)
+ {
+ u = (x + TWO52) - TWO52;
+ if (u > x)
+ u -= ONE;
+ Y[i] = u;
+ x -= u;
+ x *= RADIX;
+ }
+ for (; i <= p; i++)
+ Y[i] = ZERO;
}
/* Add magnitudes of *X and *Y assuming that abs (*X) >= abs (*Y) > 0. The
@@ -240,39 +367,55 @@ __dbl_mp(double x, mp_no *y, int p) {
truncated. */
static void
SECTION
-add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- int i,j,k;
+add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ int i, j, k;
EZ = EX;
- i=p; j=p+ EY - EX; k=p+1;
-
- if (j<1)
- {__cpy(x,z,p); return; }
- else Z[k] = ZERO;
-
- for (; j>0; i--,j--) {
- Z[k] += X[i] + Y[j];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- if (Z[1] == ZERO) {
- for (i=1; i<=p; i++) Z[i] = Z[i+1]; }
- else EZ += ONE;
+ i = p;
+ j = p + EY - EX;
+ k = p + 1;
+
+ if (j < 1)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ Z[k] = ZERO;
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += X[i] + Y[j];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p; i++)
+ Z[i] = Z[i + 1];
+ }
+ else
+ EZ += ONE;
}
/* Subtract the magnitudes of *X and *Y assuming that abs (*x) > abs (*y) > 0.
@@ -281,52 +424,73 @@ add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
ULP. */
static void
SECTION
-sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- int i,j,k;
+sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ int i, j, k;
EZ = EX;
- if (EX == EY) {
- i=j=k=p;
- Z[k] = Z[k+1] = ZERO; }
- else {
- j= EX - EY;
- if (j > p) {__cpy(x,z,p); return; }
- else {
- i=p; j=p+1-j; k=p;
- if (Y[j] > ZERO) {
- Z[k+1] = RADIX - Y[j--];
- Z[k] = MONE; }
- else {
- Z[k+1] = ZERO;
- Z[k] = ZERO; j--;}
- }
- }
-
- for (; j>0; i--,j--) {
- Z[k] += (X[i] - Y[j]);
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (i=1; Z[i] == ZERO; i++) ;
+ if (EX == EY)
+ {
+ i = j = k = p;
+ Z[k] = Z[k + 1] = ZERO;
+ }
+ else
+ {
+ j = EX - EY;
+ if (j > p)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ {
+ i = p;
+ j = p + 1 - j;
+ k = p;
+ if (Y[j] > ZERO)
+ {
+ Z[k + 1] = RADIX - Y[j--];
+ Z[k] = MONE;
+ }
+ else
+ {
+ Z[k + 1] = ZERO;
+ Z[k] = ZERO;
+ j--;
+ }
+ }
+ }
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += (X[i] - Y[j]);
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (i = 1; Z[i] == ZERO; i++);
EZ = EZ - i + 1;
- for (k=1; i <= p+1; )
+ for (k = 1; i <= p + 1;)
Z[k++] = Z[i++];
- for (; k <= p; )
+ for (; k <= p;)
Z[k++] = ZERO;
}
@@ -335,22 +499,49 @@ sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
ULP. */
void
SECTION
-__add(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+__add (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] == Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] == Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
}
/* Subtract *Y from *X and return the result in *Z. X and Y may overlap but
@@ -358,22 +549,50 @@ __add(const mp_no *x, const mp_no *y, mp_no *z, int p) {
one ULP. */
void
SECTION
-__sub(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+__sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); Z[0] = -Z[0]; return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] != Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ Z[0] = -Z[0];
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] != Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
}
/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
@@ -381,52 +600,54 @@ __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) {
digits. In case P > 3 the error is bounded by 1.001 ULP. */
void
SECTION
-__mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int i, j, k, k2;
- double u;
+ double u, zk;
/* Is z=0? */
if (__glibc_unlikely (X[0] * Y[0] == ZERO))
{
- Z[0]=ZERO;
+ Z[0] = ZERO;
return;
}
/* Multiply, add and carry. */
k2 = (__glibc_unlikely (p < 3)) ? p + p : p + 3;
- Z[k2] = ZERO;
+ zk = Z[k2] = ZERO;
- for (k = k2; k > p; )
+ for (k = k2; k > p; k--)
{
for (i = k - p, j = p; i < p + 1; i++, j--)
- Z[k] += X[i] * Y[j];
+ zk += X[i] * Y[j];
- u = (Z[k] + CUTTER) - CUTTER;
- if (u > Z[k])
+ u = (zk + CUTTER) - CUTTER;
+ if (u > zk)
u -= RADIX;
- Z[k] -= u;
- Z[--k] = u * RADIXI;
+ Z[k] = zk - u;
+ zk = u * RADIXI;
}
while (k > 1)
{
- for (i = 1,j = k - 1; i < k; i++, j--)
- Z[k] += X[i] * Y[j];
+ for (i = 1, j = k - 1; i < k; i++, j--)
+ zk += X[i] * Y[j];
- u = (Z[k] + CUTTER) - CUTTER;
- if (u > Z[k])
+ u = (zk + CUTTER) - CUTTER;
+ if (u > zk)
u -= RADIX;
- Z[k] -= u;
- Z[--k] = u * RADIXI;
+ Z[k] = zk - u;
+ zk = u * RADIXI;
+ k--;
}
+ Z[k] = zk;
EZ = EX + EY;
/* Is there a carry beyond the most significant digit? */
if (__glibc_unlikely (Z[1] == ZERO))
{
for (i = 1; i <= p; i++)
- Z[i] = Z[i+1];
+ Z[i] = Z[i + 1];
EZ--;
}
@@ -439,24 +660,32 @@ __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
- For P > 3: 2.001 * R ^ (1 - P)
*X = 0 is not permissible. */
-static
+static void
SECTION
-void __inv(const mp_no *x, mp_no *y, int p) {
+__inv (const mp_no *x, mp_no *y, int p)
+{
int i;
double t;
- mp_no z,w;
- static const int np1[] = {0,0,0,0,1,2,2,2,2,3,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4};
-
- __cpy(x,&z,p); z.e=0; __mp_dbl(&z,&t,p);
- t=ONE/t; __dbl_mp(t,y,p); EY -= EX;
-
- for (i=0; i<np1[p]; i++) {
- __cpy(y,&w,p);
- __mul(x,&w,y,p);
- __sub(&mptwo,y,&z,p);
- __mul(&w,&z,y,p);
- }
+ mp_no z, w;
+ static const int np1[] =
+ { 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ };
+
+ __cpy (x, &z, p);
+ z.e = 0;
+ __mp_dbl (&z, &t, p);
+ t = ONE / t;
+ __dbl_mp (t, y, p);
+ EY -= EX;
+
+ for (i = 0; i < np1[p]; i++)
+ {
+ __cpy (y, &w, p);
+ __mul (x, &w, y, p);
+ __sub (&mptwo, y, &z, p);
+ __mul (&w, &z, y, p);
+ }
}
/* Divide *X by *Y and store result in *Z. X and Y may overlap but not X and Z
@@ -468,10 +697,15 @@ void __inv(const mp_no *x, mp_no *y, int p) {
*X = 0 is not permissible. */
void
SECTION
-__dvd(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+__dvd (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
mp_no w;
- if (X[0] == ZERO) Z[0] = ZERO;
- else {__inv(y,&w,p); __mul(x,&w,z,p);}
+ if (X[0] == ZERO)
+ Z[0] = ZERO;
+ else
+ {
+ __inv (y, &w, p);
+ __mul (x, &w, z, p);
+ }
}
diff --git a/libc/sysdeps/ieee754/dbl-64/mpa.h b/libc/sysdeps/ieee754/dbl-64/mpa.h
index 77715fc05..06343d46d 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpa.h
+++ b/libc/sysdeps/ieee754/dbl-64/mpa.h
@@ -82,6 +82,32 @@ extern const mp_no mptwo;
#define ABS(x) ((x) < 0 ? -(x) : (x))
+#define RADIX 0x1.0p24 /* 2^24 */
+#define RADIXI 0x1.0p-24 /* 2^-24 */
+#define CUTTER 0x1.0p76 /* 2^76 */
+
+#define ZERO 0.0 /* 0 */
+#define MZERO -0.0 /* 0 with the sign bit set */
+#define ONE 1.0 /* 1 */
+#define MONE -1.0 /* -1 */
+#define TWO 2.0 /* 2 */
+
+#define TWO5 0x1.0p5 /* 2^5 */
+#define TWO8 0x1.0p8 /* 2^52 */
+#define TWO10 0x1.0p10 /* 2^10 */
+#define TWO18 0x1.0p18 /* 2^18 */
+#define TWO19 0x1.0p19 /* 2^19 */
+#define TWO23 0x1.0p23 /* 2^23 */
+#define TWO52 0x1.0p52 /* 2^52 */
+#define TWO57 0x1.0p57 /* 2^57 */
+#define TWO71 0x1.0p71 /* 2^71 */
+#define TWOM1032 0x1.0p-1032 /* 2^-1032 */
+#define TWOM1022 0x1.0p-1022 /* 2^-1022 */
+
+#define HALF 0x1.0p-1 /* 1/2 */
+#define MHALF -0x1.0p-1 /* -1/2 */
+#define HALFRAD 0x1.0p23 /* 2^23 */
+
int __acr (const mp_no *, const mp_no *, int);
void __cpy (const mp_no *, mp_no *, int);
void __mp_dbl (const mp_no *, double *, int);
@@ -97,3 +123,33 @@ extern void __mpsqrt (mp_no *, mp_no *, int);
extern void __mpexp (mp_no *, mp_no *, int);
extern void __c32 (mp_no *, mp_no *, mp_no *, int);
extern int __mpranred (double, mp_no *, int);
+
+/* Given a power POW, build a multiprecision number 2^POW. */
+static inline void
+__pow_mp (int pow, mp_no *y, int p)
+{
+ int i, rem;
+
+ /* The exponent is E such that E is a factor of 2^24. The remainder (of the
+ form 2^x) goes entirely into the first digit of the mantissa as it is
+ always less than 2^24. */
+ EY = pow / 24;
+ rem = pow - EY * 24;
+ EY++;
+
+ /* If the remainder is negative, it means that POW was negative since
+ |EY * 24| <= |pow|. Adjust so that REM is positive and still less than
+ 24 because of which, the mantissa digit is less than 2^24. */
+ if (rem < 0)
+ {
+ EY--;
+ rem += 24;
+ }
+ /* The sign of any 2^x is always positive. */
+ Y[0] = ONE;
+ Y[1] = 1 << rem;
+
+ /* Everything else is ZERO. */
+ for (i = 2; i <= p; i++)
+ Y[i] = ZERO;
+}
diff --git a/libc/sysdeps/ieee754/dbl-64/mpa2.h b/libc/sysdeps/ieee754/dbl-64/mpa2.h
deleted file mode 100644
index b80bf412e..000000000
--- a/libc/sysdeps/ieee754/dbl-64/mpa2.h
+++ /dev/null
@@ -1,50 +0,0 @@
-
-/*
- * IBM Accurate Mathematical Library
- * Written by International Business Machines Corp.
- * Copyright (C) 2001-2013 Free Software Foundation, Inc.
- *
- * This program 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.
- *
- * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/**************************************************************************/
-/* */
-/* MODULE_NAME:mpa2.h */
-/* */
-/* */
-/* variables prototype and definition according to type of processor */
-/* types definition */
-/**************************************************************************/
-
-#ifndef MPA2_H
-#define MPA2_H
-
-#define RADIX 0x1.0p24 /* 2^24 */
-#define RADIXI 0x1.0p-24 /* 2^-24 */
-#define CUTTER 0x1.0p76 /* 2^76 */
-#define ZERO 0.0 /* 0 */
-#define ONE 1.0 /* 1 */
-#define MONE -1.0 /* -1 */
-#define TWO -2.0 /* -2 */
-#define TWO5 0x1.0p5 /* 2^5 */
-#define TWO10 0x1.0p10 /* 2^10 */
-#define TWO18 0x1.0p18 /* 2^18 */
-#define TWO19 0x1.0p19 /* 2^19 */
-#define TWO23 0x1.0p23 /* 2^23 */
-#define TWO52 0x1.0p52 /* 2^52 */
-#define TWO57 0x1.0p57 /* 2^57 */
-#define TWO71 0x1.0p71 /* 2^71 */
-#define TWOM1032 0x1.0p-1032 /* 2^-1032 */
-
-#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan.h b/libc/sysdeps/ieee754/dbl-64/mpatan.h
index d8e758916..743a1b98c 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpatan.h
+++ b/libc/sysdeps/ieee754/dbl-64/mpatan.h
@@ -143,6 +143,3 @@ __atan_twonm1[33] = { /* 2n-1 */
#endif
#endif
-
-#define ONE 1.0
-#define TWO 2.0
diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan2.c b/libc/sysdeps/ieee754/dbl-64/mpatan2.c
index 9084d98d6..c0b9aea1e 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpatan2.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpatan2.c
@@ -49,8 +49,6 @@ void
SECTION
__mpatan2(mp_no *y, mp_no *x, mp_no *z, int p) {
- static const double ZERO = 0.0, ONE = 1.0;
-
mp_no mpt1,mpt2,mpt3;
diff --git a/libc/sysdeps/ieee754/dbl-64/mpexp.c b/libc/sysdeps/ieee754/dbl-64/mpexp.c
index c4048207e..8d288ff9a 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpexp.c
+++ b/libc/sysdeps/ieee754/dbl-64/mpexp.c
@@ -30,48 +30,75 @@
#include "endian.h"
#include "mpa.h"
-#include "mpexp.h"
#include <assert.h>
#ifndef SECTION
# define SECTION
#endif
-/* Multi-Precision exponential function subroutine (for p >= 4, */
-/* 2**(-55) <= abs(x) <= 1024). */
+/* Multi-Precision exponential function subroutine (for p >= 4,
+ 2**(-55) <= abs(x) <= 1024). */
void
SECTION
-__mpexp(mp_no *x, mp_no *y, int p) {
-
- int i,j,k,m,m1,m2,n;
- double a,b;
- static const int np[33] = {0,0,0,0,3,3,4,4,5,4,4,5,5,5,6,6,6,6,6,6,
- 6,6,6,6,7,7,7,7,8,8,8,8,8};
- static const int m1p[33]= {0,0,0,0,17,23,23,28,27,38,42,39,43,47,43,47,50,54,
- 57,60,64,67,71,74,68,71,74,77,70,73,76,78,81};
- static const int m1np[7][18] = {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0,36,48,60,72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0,24,32,40,48,56,64,72, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0,17,23,29,35,41,47,53,59,65, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0,23,28,33,38,42,47,52,57,62,66, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 0,39,43,47,51,55,59,63},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43,47,50,54}};
- mp_no mpk = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
- mp_no mps,mpak,mpt1,mpt2;
+__mpexp (mp_no *x, mp_no *y, int p)
+{
+ int i, j, k, m, m1, m2, n;
+ double b;
+ static const int np[33] =
+ {
+ 0, 0, 0, 0, 3, 3, 4, 4, 5, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8
+ };
+ static const int m1p[33] =
+ {
+ 0, 0, 0, 0,
+ 17, 23, 23, 28,
+ 27, 38, 42, 39,
+ 43, 47, 43, 47,
+ 50, 54, 57, 60,
+ 64, 67, 71, 74,
+ 68, 71, 74, 77,
+ 70, 73, 76, 78,
+ 81
+ };
+ static const int m1np[7][18] =
+ {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 36, 48, 60, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 24, 32, 40, 48, 56, 64, 72, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 17, 23, 29, 35, 41, 47, 53, 59, 65, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 23, 28, 33, 38, 42, 47, 52, 57, 62, 66, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 39, 43, 47, 51, 55, 59, 63},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 47, 50, 54}
+ };
+ mp_no mpk =
+ {
+ 0,
+ {
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
+ }
+ };
+ mp_no mps, mpak, mpt1, mpt2;
- /* Choose m,n and compute a=2**(-m) */
- n = np[p]; m1 = m1p[p]; a = __mpexp_twomm1[p].d;
- for (i=0; i<EX; i++) a *= RADIXI;
- for ( ; i>EX; i--) a *= RADIX;
- b = X[1]*RADIXI; m2 = 24*EX;
- for (; b<HALF; m2--) { a *= TWO; b *= TWO; }
- if (b == HALF) {
- for (i=2; i<=p; i++) { if (X[i]!=ZERO) break; }
- if (i==p+1) { m2--; a *= TWO; }
- }
+ /* Choose m,n and compute a=2**(-m). */
+ n = np[p];
+ m1 = m1p[p];
+ b = X[1];
+ m2 = 24 * EX;
+ for (; b < HALFRAD; m2--)
+ b *= TWO;
+ if (b == HALFRAD)
+ {
+ for (i = 2; i <= p; i++)
+ {
+ if (X[i] != ZERO)
+ break;
+ }
+ if (i == p + 1)
+ m2--;
+ }
m = m1 + m2;
if (__glibc_unlikely (m <= 0))
@@ -83,36 +110,47 @@ __mpexp(mp_no *x, mp_no *y, int p) {
than 2^-55. */
assert (p < 18);
m = 0;
- a = ONE;
for (i = n - 1; i > 0; i--, n--)
if (m1np[i][p] + m2 > 0)
break;
}
- /* Compute s=x*2**(-m). Put result in mps */
- __dbl_mp(a,&mpt1,p);
- __mul(x,&mpt1,&mps,p);
+ /* Compute s=x*2**(-m). Put result in mps. */
+ __pow_mp (-m, &mpt1, p);
+ __mul (x, &mpt1, &mps, p);
- /* Evaluate the polynomial. Put result in mpt2 */
- mpk.e = 1; mpk.d[0] = ONE; mpk.d[1]=n;
- __dvd(&mps,&mpk,&mpt1,p);
- __add(&mpone,&mpt1,&mpak,p);
- for (k=n-1; k>1; k--) {
- __mul(&mps,&mpak,&mpt1,p);
- mpk.d[1] = k;
- __dvd(&mpt1,&mpk,&mpt2,p);
- __add(&mpone,&mpt2,&mpak,p);
- }
- __mul(&mps,&mpak,&mpt1,p);
- __add(&mpone,&mpt1,&mpt2,p);
+ /* Evaluate the polynomial. Put result in mpt2. */
+ mpk.e = 1;
+ mpk.d[0] = ONE;
+ mpk.d[1] = n;
+ __dvd (&mps, &mpk, &mpt1, p);
+ __add (&mpone, &mpt1, &mpak, p);
+ for (k = n - 1; k > 1; k--)
+ {
+ __mul (&mps, &mpak, &mpt1, p);
+ mpk.d[1] = k;
+ __dvd (&mpt1, &mpk, &mpt2, p);
+ __add (&mpone, &mpt2, &mpak, p);
+ }
+ __mul (&mps, &mpak, &mpt1, p);
+ __add (&mpone, &mpt1, &mpt2, p);
- /* Raise polynomial value to the power of 2**m. Put result in y */
- for (k=0,j=0; k<m; ) {
- __mul(&mpt2,&mpt2,&mpt1,p); k++;
- if (k==m) { j=1; break; }
- __mul(&mpt1,&mpt1,&mpt2,p); k++;
- }
- if (j) __cpy(&mpt1,y,p);
- else __cpy(&mpt2,y,p);
+ /* Raise polynomial value to the power of 2**m. Put result in y. */
+ for (k = 0, j = 0; k < m;)
+ {
+ __mul (&mpt2, &mpt2, &mpt1, p);
+ k++;
+ if (k == m)
+ {
+ j = 1;
+ break;
+ }
+ __mul (&mpt1, &mpt1, &mpt2, p);
+ k++;
+ }
+ if (j)
+ __cpy (&mpt1, y, p);
+ else
+ __cpy (&mpt2, y, p);
return;
}
diff --git a/libc/sysdeps/ieee754/dbl-64/mpexp.h b/libc/sysdeps/ieee754/dbl-64/mpexp.h
deleted file mode 100644
index 2b2638607..000000000
--- a/libc/sysdeps/ieee754/dbl-64/mpexp.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * IBM Accurate Mathematical Library
- * Written by International Business Machines Corp.
- * Copyright (C) 2001-2013 Free Software Foundation, Inc.
- *
- * This program 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.
- *
- * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/******************************************************************/
-/* */
-/* MODULE_NAME:mpexp.h */
-/* */
-/* common data and variables prototype and definition */
-/******************************************************************/
-
-#ifndef MPEXP_H
-#define MPEXP_H
-
-extern const number __mpexp_twomm1[33] attribute_hidden;
-
-#ifndef AVOID_MPEXP_H
-#ifdef BIG_ENDI
- const number
- __mpexp_twomm1[33] = { /* 2**-m1 */
-/**/ {{0x3ff00000, 0x00000000} }, /* 1 */
-/**/ {{0x3ff00000, 0x00000000} }, /* 1 */
-/**/ {{0x3ff00000, 0x00000000} }, /* 1 */
-/**/ {{0x3ff00000, 0x00000000} }, /* 1 */
-/**/ {{0x3ee00000, 0x00000000} }, /* 2**-17 */
-/**/ {{0x3e800000, 0x00000000} }, /* 2**-23 */
-/**/ {{0x3e800000, 0x00000000} }, /* 2**-23 */
-/**/ {{0x3e300000, 0x00000000} }, /* 2**-28 */
-/**/ {{0x3e400000, 0x00000000} }, /* 2**-27 */
-/**/ {{0x3d900000, 0x00000000} }, /* 2**-38 */
-/**/ {{0x3d500000, 0x00000000} }, /* 2**-42 */
-/**/ {{0x3d800000, 0x00000000} }, /* 2**-39 */
-/**/ {{0x3d400000, 0x00000000} }, /* 2**-43 */
-/**/ {{0x3d000000, 0x00000000} }, /* 2**-47 */
-/**/ {{0x3d400000, 0x00000000} }, /* 2**-43 */
-/**/ {{0x3d000000, 0x00000000} }, /* 2**-47 */
-/**/ {{0x3cd00000, 0x00000000} }, /* 2**-50 */
-/**/ {{0x3c900000, 0x00000000} }, /* 2**-54 */
-/**/ {{0x3c600000, 0x00000000} }, /* 2**-57 */
-/**/ {{0x3c300000, 0x00000000} }, /* 2**-60 */
-/**/ {{0x3bf00000, 0x00000000} }, /* 2**-64 */
-/**/ {{0x3bc00000, 0x00000000} }, /* 2**-67 */
-/**/ {{0x3b800000, 0x00000000} }, /* 2**-71 */
-/**/ {{0x3b500000, 0x00000000} }, /* 2**-74 */
-/**/ {{0x3bb00000, 0x00000000} }, /* 2**-68 */
-/**/ {{0x3b800000, 0x00000000} }, /* 2**-71 */
-/**/ {{0x3b500000, 0x00000000} }, /* 2**-74 */
-/**/ {{0x3b200000, 0x00000000} }, /* 2**-77 */
-/**/ {{0x3b900000, 0x00000000} }, /* 2**-70 */
-/**/ {{0x3b600000, 0x00000000} }, /* 2**-73 */
-/**/ {{0x3b300000, 0x00000000} }, /* 2**-76 */
-/**/ {{0x3b100000, 0x00000000} }, /* 2**-78 */
-/**/ {{0x3ae00000, 0x00000000} }, /* 2**-81 */
- };
-
-#else
-#ifdef LITTLE_ENDI
- const number
- __mpexp_twomm1[33] = { /* 2**-m1 */
-/**/ {{0x00000000, 0x3ff00000} }, /* 1 */
-/**/ {{0x00000000, 0x3ff00000} }, /* 1 */
-/**/ {{0x00000000, 0x3ff00000} }, /* 1 */
-/**/ {{0x00000000, 0x3ff00000} }, /* 1 */
-/**/ {{0x00000000, 0x3ee00000} }, /* 2**-17 */
-/**/ {{0x00000000, 0x3e800000} }, /* 2**-23 */
-/**/ {{0x00000000, 0x3e800000} }, /* 2**-23 */
-/**/ {{0x00000000, 0x3e300000} }, /* 2**-28 */
-/**/ {{0x00000000, 0x3e400000} }, /* 2**-27 */
-/**/ {{0x00000000, 0x3d900000} }, /* 2**-38 */
-/**/ {{0x00000000, 0x3d500000} }, /* 2**-42 */
-/**/ {{0x00000000, 0x3d800000} }, /* 2**-39 */
-/**/ {{0x00000000, 0x3d400000} }, /* 2**-43 */
-/**/ {{0x00000000, 0x3d000000} }, /* 2**-47 */
-/**/ {{0x00000000, 0x3d400000} }, /* 2**-43 */
-/**/ {{0x00000000, 0x3d000000} }, /* 2**-47 */
-/**/ {{0x00000000, 0x3cd00000} }, /* 2**-50 */
-/**/ {{0x00000000, 0x3c900000} }, /* 2**-54 */
-/**/ {{0x00000000, 0x3c600000} }, /* 2**-57 */
-/**/ {{0x00000000, 0x3c300000} }, /* 2**-60 */
-/**/ {{0x00000000, 0x3bf00000} }, /* 2**-64 */
-/**/ {{0x00000000, 0x3bc00000} }, /* 2**-67 */
-/**/ {{0x00000000, 0x3b800000} }, /* 2**-71 */
-/**/ {{0x00000000, 0x3b500000} }, /* 2**-74 */
-/**/ {{0x00000000, 0x3bb00000} }, /* 2**-68 */
-/**/ {{0x00000000, 0x3b800000} }, /* 2**-71 */
-/**/ {{0x00000000, 0x3b500000} }, /* 2**-74 */
-/**/ {{0x00000000, 0x3b200000} }, /* 2**-77 */
-/**/ {{0x00000000, 0x3b900000} }, /* 2**-70 */
-/**/ {{0x00000000, 0x3b600000} }, /* 2**-73 */
-/**/ {{0x00000000, 0x3b300000} }, /* 2**-76 */
-/**/ {{0x00000000, 0x3b100000} }, /* 2**-78 */
-/**/ {{0x00000000, 0x3ae00000} }, /* 2**-81 */
- };
-
-#endif
-#endif
-#endif
-
-#define RADIX 0x1.0p24 /* 2^24 */
-#define RADIXI 0x1.0p-24 /* 2^-24 */
-#define ZERO 0.0 /* 0 */
-#define ONE 1.0 /* 1 */
-#define TWO 2.0 /* 2 */
-#define HALF 0x1.0p-1 /* 1/2 */
-
-#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/mpsqrt.h b/libc/sysdeps/ieee754/dbl-64/mpsqrt.h
index c7354970a..2b83c4cbf 100644
--- a/libc/sysdeps/ieee754/dbl-64/mpsqrt.h
+++ b/libc/sysdeps/ieee754/dbl-64/mpsqrt.h
@@ -35,7 +35,4 @@ extern const int __mpsqrt_mp[33] attribute_hidden;
4,4,4,4,4,4,4,4,4};
#endif
-#define ONE 1.0 /* 1 */
-#define HALFRAD 0x1.0p23 /* 2^23 */
-
#endif
diff --git a/libc/sysdeps/ieee754/dbl-64/mptan.c b/libc/sysdeps/ieee754/dbl-64/mptan.c
index 6e08b0dc8..234108e37 100644
--- a/libc/sysdeps/ieee754/dbl-64/mptan.c
+++ b/libc/sysdeps/ieee754/dbl-64/mptan.c
@@ -47,8 +47,6 @@ void
SECTION
__mptan(double x, mp_no *mpy, int p) {
- static const double MONE = -1.0;
-
int n;
mp_no mpw, mpc, mps;
diff --git a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
index 60afafded..eb40c298b 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
@@ -44,10 +44,10 @@ double __nearbyint(double x)
j0 = ((i0>>20)&0x7ff)-0x3ff;
if(j0<52) {
if(j0<0) {
- feholdexcept (&env);
+ libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
- fesetenv (&env);
+ libc_fesetenv (&env);
GET_HIGH_WORD(i0,t);
SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
return t;
@@ -56,10 +56,10 @@ double __nearbyint(double x)
if(j0==0x400) return x+x; /* inf or NaN */
else return x; /* x is integral */
}
- feholdexcept (&env);
+ libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
- fesetenv (&env);
+ libc_fesetenv (&env);
return t;
}
weak_alias (__nearbyint, nearbyint)
diff --git a/libc/sysdeps/ieee754/dbl-64/ulog.h b/libc/sysdeps/ieee754/dbl-64/ulog.h
index 5afda3cda..eec1eef67 100644
--- a/libc/sysdeps/ieee754/dbl-64/ulog.h
+++ b/libc/sysdeps/ieee754/dbl-64/ulog.h
@@ -173,10 +173,6 @@
#endif
#endif
-#define ZERO 0.0 /* 0 */
-#define ONE 1.0 /* 1 */
-#define HALF 0x1.0p-1 /* 1/2 */
-#define MHALF -0x1.0p-1 /* -1/2 */
#define SQRT_2 sqrt_2.d
#define DEL_U delu.d
#define DEL_V delv.d
diff --git a/libc/sysdeps/ieee754/dbl-64/utan.h b/libc/sysdeps/ieee754/dbl-64/utan.h
index 5ab573ea2..3bdeee1c4 100644
--- a/libc/sysdeps/ieee754/dbl-64/utan.h
+++ b/libc/sysdeps/ieee754/dbl-64/utan.h
@@ -262,10 +262,4 @@
#endif
#endif
-
-#define ZERO 0.0
-#define ONE 1.0
-#define MONE -1.0
-#define TWO8 0x1.0p8 /* 2^8 */
-
#endif
diff --git a/libc/sysdeps/powerpc/bits/mathdef.h b/libc/sysdeps/powerpc/bits/mathdef.h
index 389d09902..b3c21fee6 100644
--- a/libc/sysdeps/powerpc/bits/mathdef.h
+++ b/libc/sysdeps/powerpc/bits/mathdef.h
@@ -37,10 +37,10 @@ typedef double double_t;
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
-#ifndef __NO_FPRS__
+# if !defined _SOFT_FLOAT && !defined __NO_FPRS__
/* The powerpc has a combined multiply/add instruction. */
# define FP_FAST_FMA 1
# define FP_FAST_FMAF 1
-#endif
+# endif
#endif /* ISO C99 */
diff --git a/libc/sysdeps/powerpc/fpu/bits/fenvinline.h b/libc/sysdeps/powerpc/fpu/bits/fenvinline.h
index 1bab7d64d..0720795d5 100644
--- a/libc/sysdeps/powerpc/fpu/bits/fenvinline.h
+++ b/libc/sysdeps/powerpc/fpu/bits/fenvinline.h
@@ -16,8 +16,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ \
- && !defined __NO_MATH_INLINES
+#if (defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ \
+ && !defined __NO_MATH_INLINES)
/* Inline definition for fegetround. */
# define fegetround() \
@@ -57,4 +57,4 @@
: 0) \
: (feclearexcept) (__excepts))
-#endif /* __GNUC__ && !__NO_FPRS__ */
+#endif /* __GNUC__ && !_SOFT_FLOAT && !__NO_FPRS__ */
diff --git a/libc/sysdeps/powerpc/fpu/bits/mathinline.h b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
index 75f2983f7..140fff08e 100644
--- a/libc/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -127,4 +127,4 @@ __NTH (fdimf (float __x, float __y))
#endif /* __USE_ISOC99 */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-#endif /* __GNUC__ && !__NO_FPRS__ */
+#endif /* __GNUC__ && !_SOFT_FLOAT && !__NO_FPRS__ */
diff --git a/libc/sysdeps/powerpc/fpu/fpu_control.h b/libc/sysdeps/powerpc/fpu/fpu_control.h
index bb8375ab8..d03b8eb80 100644
--- a/libc/sysdeps/powerpc/fpu/fpu_control.h
+++ b/libc/sysdeps/powerpc/fpu/fpu_control.h
@@ -21,20 +21,20 @@
#ifdef _SOFT_FLOAT
-#define _FPU_RESERVED 0xffffffff
-#define _FPU_DEFAULT 0x00000000 /* Default value. */
+# define _FPU_RESERVED 0xffffffff
+# define _FPU_DEFAULT 0x00000000 /* Default value. */
typedef unsigned int fpu_control_t;
-#define _FPU_GETCW(cw) 0
-#define _FPU_SETCW(cw) do { } while (0)
+# define _FPU_GETCW(cw) (cw) = 0
+# define _FPU_SETCW(cw) (void) (cw)
extern fpu_control_t __fpu_control;
#elif defined __NO_FPRS__ /* E500 */
/* rounding control */
-#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
-#define _FPU_RC_DOWN 0x03
-#define _FPU_RC_UP 0x02
-#define _FPU_RC_ZERO 0x01
+# define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
+# define _FPU_RC_DOWN 0x03
+# define _FPU_RC_UP 0x02
+# define _FPU_RC_ZERO 0x01
/* masking of interrupts */
#define _FPU_MASK_ZM 0x10 /* zero divide */
@@ -71,41 +71,41 @@ extern fpu_control_t __fpu_control;
#else /* PowerPC 6xx floating-point. */
/* rounding control */
-#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
-#define _FPU_RC_DOWN 0x03
-#define _FPU_RC_UP 0x02
-#define _FPU_RC_ZERO 0x01
+# define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
+# define _FPU_RC_DOWN 0x03
+# define _FPU_RC_UP 0x02
+# define _FPU_RC_ZERO 0x01
-#define _FPU_MASK_NI 0x04 /* non-ieee mode */
+# define _FPU_MASK_NI 0x04 /* non-ieee mode */
/* masking of interrupts */
-#define _FPU_MASK_ZM 0x10 /* zero divide */
-#define _FPU_MASK_OM 0x40 /* overflow */
-#define _FPU_MASK_UM 0x20 /* underflow */
-#define _FPU_MASK_XM 0x08 /* inexact */
-#define _FPU_MASK_IM 0x80 /* invalid operation */
+# define _FPU_MASK_ZM 0x10 /* zero divide */
+# define _FPU_MASK_OM 0x40 /* overflow */
+# define _FPU_MASK_UM 0x20 /* underflow */
+# define _FPU_MASK_XM 0x08 /* inexact */
+# define _FPU_MASK_IM 0x80 /* invalid operation */
-#define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
+# define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
/* The fdlibm code requires no interrupts for exceptions. */
-#define _FPU_DEFAULT 0x00000000 /* Default value. */
+# define _FPU_DEFAULT 0x00000000 /* Default value. */
/* IEEE: same as above, but (some) exceptions;
we leave the 'inexact' exception off.
*/
-#define _FPU_IEEE 0x000000f0
+# define _FPU_IEEE 0x000000f0
/* Type of the control word. */
typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
/* Macros for accessing the hardware control word. */
-#define _FPU_GETCW(__cw) ( { \
+# define _FPU_GETCW(__cw) ( { \
union { double d; fpu_control_t cw[2]; } \
tmp __attribute__ ((__aligned__(8))); \
__asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
(__cw)=tmp.cw[1]; \
tmp.cw[1]; } )
-#define _FPU_SETCW(__cw) { \
+# define _FPU_SETCW(__cw) { \
union { double d; fpu_control_t cw[2]; } \
tmp __attribute__ ((__aligned__(8))); \
tmp.cw[0] = 0xFFF80000; /* More-or-less arbitrary; this is a QNaN. */ \
@@ -116,6 +116,6 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
-#endif
+#endif /* PowerPC 6xx floating-point. */
#endif /* _FPU_CONTROL_H */
diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c b/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
index 9fcaa763c..16cb57785 100644
--- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
+++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
@@ -51,91 +51,135 @@ const mp_no mptwo = {1, {1.0, 2.0}};
/* Compare mantissa of two multiple precision numbers regardless of the sign
and exponent of the numbers. */
-static int mcr(const mp_no *x, const mp_no *y, int p) {
+static int
+mcr (const mp_no *x, const mp_no *y, int p)
+{
long i;
long p2 = p;
- for (i=1; i<=p2; i++) {
- if (X[i] == Y[i]) continue;
- else if (X[i] > Y[i]) return 1;
- else return -1; }
+ for (i = 1; i <= p2; i++)
+ {
+ if (X[i] == Y[i])
+ continue;
+ else if (X[i] > Y[i])
+ return 1;
+ else
+ return -1;
+ }
return 0;
}
/* Compare the absolute values of two multiple precision numbers. */
-int __acr(const mp_no *x, const mp_no *y, int p) {
+int
+__acr (const mp_no *x, const mp_no *y, int p)
+{
long i;
- if (X[0] == ZERO) {
- if (Y[0] == ZERO) i= 0;
- else i=-1;
- }
- else if (Y[0] == ZERO) i= 1;
- else {
- if (EX > EY) i= 1;
- else if (EX < EY) i=-1;
- else i= mcr(x,y,p);
- }
+ if (X[0] == ZERO)
+ {
+ if (Y[0] == ZERO)
+ i = 0;
+ else
+ i = -1;
+ }
+ else if (Y[0] == ZERO)
+ i = 1;
+ else
+ {
+ if (EX > EY)
+ i = 1;
+ else if (EX < EY)
+ i = -1;
+ else
+ i = mcr (x, y, p);
+ }
return i;
}
/* Copy multiple precision number X into Y. They could be the same
number. */
-void __cpy(const mp_no *x, mp_no *y, int p) {
+void
+__cpy (const mp_no *x, mp_no *y, int p)
+{
long i;
EY = EX;
- for (i=0; i <= p; i++) Y[i] = X[i];
+ for (i = 0; i <= p; i++)
+ Y[i] = X[i];
return;
}
/* Convert a multiple precision number *X into a double precision
number *Y, normalized case (|x| >= 2**(-1022))). */
-static void norm(const mp_no *x, double *y, int p)
+static void
+norm (const mp_no *x, double *y, int p)
{
- #define R RADIXI
+#define R RADIXI
long i;
- double a,c,u,v,z[5];
- if (p<5) {
- if (p==1) c = X[1];
- else if (p==2) c = X[1] + R* X[2];
- else if (p==3) c = X[1] + R*(X[2] + R* X[3]);
- else if (p==4) c =(X[1] + R* X[2]) + R*R*(X[3] + R*X[4]);
- }
- else {
- for (a=ONE, z[1]=X[1]; z[1] < TWO23; )
- {a *= TWO; z[1] *= TWO; }
-
- for (i=2; i<5; i++) {
- z[i] = X[i]*a;
- u = (z[i] + CUTTER)-CUTTER;
- if (u > z[i]) u -= RADIX;
- z[i] -= u;
- z[i-1] += u*RADIXI;
- }
-
- u = (z[3] + TWO71) - TWO71;
- if (u > z[3]) u -= TWO19;
- v = z[3]-u;
-
- if (v == TWO18) {
- if (z[4] == ZERO) {
- for (i=5; i <= p; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
- }
- }
- else z[3] += ONE;
- }
-
- c = (z[1] + R *(z[2] + R * z[3]))/a;
- }
+ double a, c, u, v, z[5];
+ if (p < 5)
+ {
+ if (p == 1)
+ c = X[1];
+ else if (p == 2)
+ c = X[1] + R * X[2];
+ else if (p == 3)
+ c = X[1] + R * (X[2] + R * X[3]);
+ else if (p == 4)
+ c = (X[1] + R * X[2]) + R * R * (X[3] + R * X[4]);
+ }
+ else
+ {
+ for (a = ONE, z[1] = X[1]; z[1] < TWO23;)
+ {
+ a *= TWO;
+ z[1] *= TWO;
+ }
+
+ for (i = 2; i < 5; i++)
+ {
+ z[i] = X[i] * a;
+ u = (z[i] + CUTTER) - CUTTER;
+ if (u > z[i])
+ u -= RADIX;
+ z[i] -= u;
+ z[i - 1] += u * RADIXI;
+ }
+
+ u = (z[3] + TWO71) - TWO71;
+ if (u > z[3])
+ u -= TWO19;
+ v = z[3] - u;
+
+ if (v == TWO18)
+ {
+ if (z[4] == ZERO)
+ {
+ for (i = 5; i <= p; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
+ }
+ else
+ z[3] += ONE;
+ }
+
+ c = (z[1] + R * (z[2] + R * z[3])) / a;
+ }
c *= X[0];
- for (i=1; i<EX; i++) c *= RADIX;
- for (i=1; i>EX; i--) c *= RADIXI;
+ for (i = 1; i < EX; i++)
+ c *= RADIX;
+ for (i = 1; i > EX; i--)
+ c *= RADIXI;
*y = c;
return;
@@ -144,46 +188,112 @@ static void norm(const mp_no *x, double *y, int p)
/* Convert a multiple precision number *X into a double precision
number *Y, Denormal case (|x| < 2**(-1022))). */
-static void denorm(const mp_no *x, double *y, int p)
+static void
+denorm (const mp_no *x, double *y, int p)
{
- long i,k;
+ long i, k;
long p2 = p;
- double c,u,z[5];
+ double c, u, z[5];
#define R RADIXI
- if (EX<-44 || (EX==-44 && X[1]<TWO5))
- { *y=ZERO; return; }
-
- if (p2==1) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=ZERO; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=ZERO; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else if (p2==2) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=X[2]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; k=1;}
- z[3] = X[k];
- }
+ if (EX < -44 || (EX == -44 && X[1] < TWO5))
+ {
+ *y = ZERO;
+ return;
+ }
+
+ if (p2 == 1)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = ZERO;
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = ZERO;
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else if (p2 == 2)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = X[2];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ k = 1;
+ }
+ z[3] = X[k];
+ }
u = (z[3] + TWO57) - TWO57;
- if (u > z[3]) u -= TWO5;
+ if (u > z[3])
+ u -= TWO5;
- if (u==z[3]) {
- for (i=k+1; i <= p2; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
+ if (u == z[3])
+ {
+ for (i = k + 1; i <= p2; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
}
- }
- c = X[0]*((z[1] + R*(z[2] + R*z[3])) - TWO10);
+ c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10);
- *y = c*TWOM1032;
+ *y = c * TWOM1032;
return;
#undef R
@@ -191,39 +301,65 @@ static void denorm(const mp_no *x, double *y, int p)
/* Convert multiple precision number *X into double precision number *Y. The
result is correctly rounded to the nearest/even. */
-void __mp_dbl(const mp_no *x, double *y, int p) {
-
- if (X[0] == ZERO) {*y = ZERO; return; }
+void
+__mp_dbl (const mp_no *x, double *y, int p)
+{
+ if (X[0] == ZERO)
+ {
+ *y = ZERO;
+ return;
+ }
- if (EX> -42) norm(x,y,p);
- else if (EX==-42 && X[1]>=TWO10) norm(x,y,p);
- else denorm(x,y,p);
+ if (EX > -42)
+ norm (x, y, p);
+ else if (EX == -42 && X[1] >= TWO10)
+ norm (x, y, p);
+ else
+ denorm (x, y, p);
}
/* Get the multiple precision equivalent of X into *Y. If the precision is too
small, the result is truncated. */
-void __dbl_mp(double x, mp_no *y, int p) {
-
- long i,n;
+void
+__dbl_mp (double x, mp_no *y, int p)
+{
+ long i, n;
long p2 = p;
double u;
/* Sign. */
- if (x == ZERO) {Y[0] = ZERO; return; }
- else if (x > ZERO) Y[0] = ONE;
- else {Y[0] = MONE; x=-x; }
+ if (x == ZERO)
+ {
+ Y[0] = ZERO;
+ return;
+ }
+ else if (x > ZERO)
+ Y[0] = ONE;
+ else
+ {
+ Y[0] = MONE;
+ x = -x;
+ }
/* Exponent. */
- for (EY=ONE; x >= RADIX; EY += ONE) x *= RADIXI;
- for ( ; x < ONE; EY -= ONE) x *= RADIX;
+ for (EY = ONE; x >= RADIX; EY += ONE)
+ x *= RADIXI;
+ for (; x < ONE; EY -= ONE)
+ x *= RADIX;
/* Digits. */
- n=MIN(p2,4);
- for (i=1; i<=n; i++) {
- u = (x + TWO52) - TWO52;
- if (u>x) u -= ONE;
- Y[i] = u; x -= u; x *= RADIX; }
- for ( ; i<=p2; i++) Y[i] = ZERO;
+ n = MIN (p2, 4);
+ for (i = 1; i <= n; i++)
+ {
+ u = (x + TWO52) - TWO52;
+ if (u > x)
+ u -= ONE;
+ Y[i] = u;
+ x -= u;
+ x *= RADIX;
+ }
+ for (; i <= p2; i++)
+ Y[i] = ZERO;
return;
}
@@ -231,93 +367,132 @@ void __dbl_mp(double x, mp_no *y, int p) {
sign of the sum *Z is not changed. X and Y may overlap but not X and Z or
Y and Z. No guard digit is used. The result equals the exact sum,
truncated. */
-static void add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- long i,j,k;
+static void
+add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ long i, j, k;
long p2 = p;
EZ = EX;
- i=p2; j=p2+ EY - EX; k=p2+1;
-
- if (j<1)
- {__cpy(x,z,p); return; }
- else Z[k] = ZERO;
-
- for (; j>0; i--,j--) {
- Z[k] += X[i] + Y[j];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- if (Z[1] == ZERO) {
- for (i=1; i<=p2; i++) Z[i] = Z[i+1]; }
- else EZ += ONE;
+ i = p2;
+ j = p2 + EY - EX;
+ k = p2 + 1;
+
+ if (j < 1)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ Z[k] = ZERO;
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += X[i] + Y[j];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p2; i++)
+ Z[i] = Z[i + 1];
+ }
+ else
+ EZ += ONE;
}
/* Subtract the magnitudes of *X and *Y assuming that abs (*x) > abs (*y) > 0.
The sign of the difference *Z is not changed. X and Y may overlap but not X
and Z or Y and Z. One guard digit is used. The error is less than one
ULP. */
-static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- long i,j,k;
+static void
+sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ long i, j, k;
long p2 = p;
EZ = EX;
- if (EX == EY) {
- i=j=k=p2;
- Z[k] = Z[k+1] = ZERO; }
- else {
- j= EX - EY;
- if (j > p2) {__cpy(x,z,p); return; }
- else {
- i=p2; j=p2+1-j; k=p2;
- if (Y[j] > ZERO) {
- Z[k+1] = RADIX - Y[j--];
- Z[k] = MONE; }
- else {
- Z[k+1] = ZERO;
- Z[k] = ZERO; j--;}
- }
- }
-
- for (; j>0; i--,j--) {
- Z[k] += (X[i] - Y[j]);
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (i=1; Z[i] == ZERO; i++) ;
+ if (EX == EY)
+ {
+ i = j = k = p2;
+ Z[k] = Z[k + 1] = ZERO;
+ }
+ else
+ {
+ j = EX - EY;
+ if (j > p2)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ {
+ i = p2;
+ j = p2 + 1 - j;
+ k = p2;
+ if (Y[j] > ZERO)
+ {
+ Z[k + 1] = RADIX - Y[j--];
+ Z[k] = MONE;
+ }
+ else
+ {
+ Z[k + 1] = ZERO;
+ Z[k] = ZERO;
+ j--;
+ }
+ }
+ }
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += (X[i] - Y[j]);
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (i = 1; Z[i] == ZERO; i++);
EZ = EZ - i + 1;
- for (k=1; i <= p2+1; )
+ for (k = 1; i <= p2 + 1;)
Z[k++] = Z[i++];
- for (; k <= p2; )
+ for (; k <= p2;)
Z[k++] = ZERO;
return;
@@ -326,111 +501,186 @@ static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
/* Add *X and *Y and store the result in *Z. X and Y may overlap, but not X
and Z or Y and Z. One guard digit is used. The error is less than one
ULP. */
-void __add(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__add (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] == Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] == Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
return;
}
/* Subtract *Y from *X and return the result in *Z. X and Y may overlap but
not X and Z or Y and Z. One guard digit is used. The error is less than
one ULP. */
-void __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); Z[0] = -Z[0]; return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] != Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ Z[0] = -Z[0];
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] != Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
return;
}
/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P
digits. In case P > 3 the error is bounded by 1.001 ULP. */
-void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
long i, i1, i2, j, k, k2;
long p2 = p;
double u, zk, zk2;
- /* Is z=0? */
- if (X[0]*Y[0]==ZERO)
- { Z[0]=ZERO; return; }
+ /* Is z=0? */
+ if (X[0] * Y[0] == ZERO)
+ {
+ Z[0] = ZERO;
+ return;
+ }
- /* Multiply, add and carry */
- k2 = (p2<3) ? p2+p2 : p2+3;
- zk = Z[k2]=ZERO;
- for (k=k2; k>1; ) {
- if (k > p2) {i1=k-p2; i2=p2+1; }
- else {i1=1; i2=k; }
-#if 1
- /* Rearrange this inner loop to allow the fmadd instructions to be
- independent and execute in parallel on processors that have
- dual symmetrical FP pipelines. */
- if (i1 < (i2-1))
+ /* Multiply, add and carry */
+ k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
+ zk = Z[k2] = ZERO;
+ for (k = k2; k > 1;)
{
- /* Make sure we have at least 2 iterations. */
- if (((i2 - i1) & 1L) == 1L)
+ if (k > p2)
{
- /* Handle the odd iterations case. */
- zk2 = x->d[i2-1]*y->d[i1];
+ i1 = k - p2;
+ i2 = p2 + 1;
}
- else
- zk2 = 0.0;
- /* Do two multiply/adds per loop iteration, using independent
- accumulators; zk and zk2. */
- for (i=i1,j=i2-1; i<i2-1; i+=2,j-=2)
+ else
{
- zk += x->d[i]*y->d[j];
- zk2 += x->d[i+1]*y->d[j-1];
+ i1 = 1;
+ i2 = k;
+ }
+#if 1
+ /* Rearrange this inner loop to allow the fmadd instructions to be
+ independent and execute in parallel on processors that have
+ dual symmetrical FP pipelines. */
+ if (i1 < (i2 - 1))
+ {
+ /* Make sure we have at least 2 iterations. */
+ if (((i2 - i1) & 1L) == 1L)
+ {
+ /* Handle the odd iterations case. */
+ zk2 = x->d[i2 - 1] * y->d[i1];
+ }
+ else
+ zk2 = 0.0;
+ /* Do two multiply/adds per loop iteration, using independent
+ accumulators; zk and zk2. */
+ for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
+ {
+ zk += x->d[i] * y->d[j];
+ zk2 += x->d[i + 1] * y->d[j - 1];
+ }
+ zk += zk2; /* Final sum. */
+ }
+ else
+ {
+ /* Special case when iterations is 1. */
+ zk += x->d[i1] * y->d[i1];
}
- zk += zk2; /* Final sum. */
- }
- else
- {
- /* Special case when iterations is 1. */
- zk += x->d[i1]*y->d[i1];
- }
#else
- /* The original code. */
- for (i=i1,j=i2-1; i<i2; i++,j--) zk += X[i]*Y[j];
+ /* The original code. */
+ for (i = i1, j = i2 - 1; i < i2; i++, j--)
+ zk += X[i] * Y[j];
#endif
- u = (zk + CUTTER)-CUTTER;
- if (u > zk) u -= RADIX;
- Z[k] = zk - u;
- zk = u*RADIXI;
- --k;
- }
+ u = (zk + CUTTER) - CUTTER;
+ if (u > zk)
+ u -= RADIX;
+ Z[k] = zk - u;
+ zk = u * RADIXI;
+ --k;
+ }
Z[k] = zk;
/* Is there a carry beyond the most significant digit? */
- if (Z[1] == ZERO) {
- for (i=1; i<=p2; i++) Z[i]=Z[i+1];
- EZ = EX + EY - 1; }
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p2; i++)
+ Z[i] = Z[i + 1];
+ EZ = EX + EY - 1;
+ }
else
EZ = EX + EY;
@@ -444,26 +694,31 @@ void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
- For P > 3: 2.001 * R ^ (1 - P)
*X = 0 is not permissible. */
-void __inv(const mp_no *x, mp_no *y, int p) {
+void
+__inv (const mp_no *x, mp_no *y, int p)
+{
long i;
double t;
- mp_no z,w;
- static const int np1[] = {0,0,0,0,1,2,2,2,2,3,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4};
- const mp_no mptwo = {1,{1.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
-
- __cpy(x,&z,p); z.e=0; __mp_dbl(&z,&t,p);
- t=ONE/t; __dbl_mp(t,y,p); EY -= EX;
-
- for (i=0; i<np1[p]; i++) {
- __cpy(y,&w,p);
- __mul(x,&w,y,p);
- __sub(&mptwo,y,&z,p);
- __mul(&w,&z,y,p);
- }
+ mp_no z, w;
+ static const int np1[] =
+ { 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ };
+
+ __cpy (x, &z, p);
+ z.e = 0;
+ __mp_dbl (&z, &t, p);
+ t = ONE / t;
+ __dbl_mp (t, y, p);
+ EY -= EX;
+
+ for (i = 0; i < np1[p]; i++)
+ {
+ __cpy (y, &w, p);
+ __mul (x, &w, y, p);
+ __sub (&mptwo, y, &z, p);
+ __mul (&w, &z, y, p);
+ }
return;
}
@@ -474,11 +729,17 @@ void __inv(const mp_no *x, mp_no *y, int p) {
- For P > 3: 3.001 * R ^ (1 - P)
*X = 0 is not permissible. */
-void __dvd(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__dvd (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
mp_no w;
- if (X[0] == ZERO) Z[0] = ZERO;
- else {__inv(y,&w,p); __mul(x,&w,z,p);}
+ if (X[0] == ZERO)
+ Z[0] = ZERO;
+ else
+ {
+ __inv (y, &w, p);
+ __mul (x, &w, z, p);
+ }
return;
}
diff --git a/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c b/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c
index 9fcaa763c..16cb57785 100644
--- a/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c
+++ b/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c
@@ -51,91 +51,135 @@ const mp_no mptwo = {1, {1.0, 2.0}};
/* Compare mantissa of two multiple precision numbers regardless of the sign
and exponent of the numbers. */
-static int mcr(const mp_no *x, const mp_no *y, int p) {
+static int
+mcr (const mp_no *x, const mp_no *y, int p)
+{
long i;
long p2 = p;
- for (i=1; i<=p2; i++) {
- if (X[i] == Y[i]) continue;
- else if (X[i] > Y[i]) return 1;
- else return -1; }
+ for (i = 1; i <= p2; i++)
+ {
+ if (X[i] == Y[i])
+ continue;
+ else if (X[i] > Y[i])
+ return 1;
+ else
+ return -1;
+ }
return 0;
}
/* Compare the absolute values of two multiple precision numbers. */
-int __acr(const mp_no *x, const mp_no *y, int p) {
+int
+__acr (const mp_no *x, const mp_no *y, int p)
+{
long i;
- if (X[0] == ZERO) {
- if (Y[0] == ZERO) i= 0;
- else i=-1;
- }
- else if (Y[0] == ZERO) i= 1;
- else {
- if (EX > EY) i= 1;
- else if (EX < EY) i=-1;
- else i= mcr(x,y,p);
- }
+ if (X[0] == ZERO)
+ {
+ if (Y[0] == ZERO)
+ i = 0;
+ else
+ i = -1;
+ }
+ else if (Y[0] == ZERO)
+ i = 1;
+ else
+ {
+ if (EX > EY)
+ i = 1;
+ else if (EX < EY)
+ i = -1;
+ else
+ i = mcr (x, y, p);
+ }
return i;
}
/* Copy multiple precision number X into Y. They could be the same
number. */
-void __cpy(const mp_no *x, mp_no *y, int p) {
+void
+__cpy (const mp_no *x, mp_no *y, int p)
+{
long i;
EY = EX;
- for (i=0; i <= p; i++) Y[i] = X[i];
+ for (i = 0; i <= p; i++)
+ Y[i] = X[i];
return;
}
/* Convert a multiple precision number *X into a double precision
number *Y, normalized case (|x| >= 2**(-1022))). */
-static void norm(const mp_no *x, double *y, int p)
+static void
+norm (const mp_no *x, double *y, int p)
{
- #define R RADIXI
+#define R RADIXI
long i;
- double a,c,u,v,z[5];
- if (p<5) {
- if (p==1) c = X[1];
- else if (p==2) c = X[1] + R* X[2];
- else if (p==3) c = X[1] + R*(X[2] + R* X[3]);
- else if (p==4) c =(X[1] + R* X[2]) + R*R*(X[3] + R*X[4]);
- }
- else {
- for (a=ONE, z[1]=X[1]; z[1] < TWO23; )
- {a *= TWO; z[1] *= TWO; }
-
- for (i=2; i<5; i++) {
- z[i] = X[i]*a;
- u = (z[i] + CUTTER)-CUTTER;
- if (u > z[i]) u -= RADIX;
- z[i] -= u;
- z[i-1] += u*RADIXI;
- }
-
- u = (z[3] + TWO71) - TWO71;
- if (u > z[3]) u -= TWO19;
- v = z[3]-u;
-
- if (v == TWO18) {
- if (z[4] == ZERO) {
- for (i=5; i <= p; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
- }
- }
- else z[3] += ONE;
- }
-
- c = (z[1] + R *(z[2] + R * z[3]))/a;
- }
+ double a, c, u, v, z[5];
+ if (p < 5)
+ {
+ if (p == 1)
+ c = X[1];
+ else if (p == 2)
+ c = X[1] + R * X[2];
+ else if (p == 3)
+ c = X[1] + R * (X[2] + R * X[3]);
+ else if (p == 4)
+ c = (X[1] + R * X[2]) + R * R * (X[3] + R * X[4]);
+ }
+ else
+ {
+ for (a = ONE, z[1] = X[1]; z[1] < TWO23;)
+ {
+ a *= TWO;
+ z[1] *= TWO;
+ }
+
+ for (i = 2; i < 5; i++)
+ {
+ z[i] = X[i] * a;
+ u = (z[i] + CUTTER) - CUTTER;
+ if (u > z[i])
+ u -= RADIX;
+ z[i] -= u;
+ z[i - 1] += u * RADIXI;
+ }
+
+ u = (z[3] + TWO71) - TWO71;
+ if (u > z[3])
+ u -= TWO19;
+ v = z[3] - u;
+
+ if (v == TWO18)
+ {
+ if (z[4] == ZERO)
+ {
+ for (i = 5; i <= p; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
+ }
+ else
+ z[3] += ONE;
+ }
+
+ c = (z[1] + R * (z[2] + R * z[3])) / a;
+ }
c *= X[0];
- for (i=1; i<EX; i++) c *= RADIX;
- for (i=1; i>EX; i--) c *= RADIXI;
+ for (i = 1; i < EX; i++)
+ c *= RADIX;
+ for (i = 1; i > EX; i--)
+ c *= RADIXI;
*y = c;
return;
@@ -144,46 +188,112 @@ static void norm(const mp_no *x, double *y, int p)
/* Convert a multiple precision number *X into a double precision
number *Y, Denormal case (|x| < 2**(-1022))). */
-static void denorm(const mp_no *x, double *y, int p)
+static void
+denorm (const mp_no *x, double *y, int p)
{
- long i,k;
+ long i, k;
long p2 = p;
- double c,u,z[5];
+ double c, u, z[5];
#define R RADIXI
- if (EX<-44 || (EX==-44 && X[1]<TWO5))
- { *y=ZERO; return; }
-
- if (p2==1) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=ZERO; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=ZERO; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else if (p2==2) {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; z[3]=ZERO; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; z[3]=X[2]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; z[3]=X[1]; k=1;}
- }
- else {
- if (EX==-42) {z[1]=X[1]+TWO10; z[2]=X[2]; k=3;}
- else if (EX==-43) {z[1]= TWO10; z[2]=X[1]; k=2;}
- else {z[1]= TWO10; z[2]=ZERO; k=1;}
- z[3] = X[k];
- }
+ if (EX < -44 || (EX == -44 && X[1] < TWO5))
+ {
+ *y = ZERO;
+ return;
+ }
+
+ if (p2 == 1)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = ZERO;
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = ZERO;
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else if (p2 == 2)
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ z[3] = ZERO;
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ z[3] = X[2];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ z[3] = X[1];
+ k = 1;
+ }
+ }
+ else
+ {
+ if (EX == -42)
+ {
+ z[1] = X[1] + TWO10;
+ z[2] = X[2];
+ k = 3;
+ }
+ else if (EX == -43)
+ {
+ z[1] = TWO10;
+ z[2] = X[1];
+ k = 2;
+ }
+ else
+ {
+ z[1] = TWO10;
+ z[2] = ZERO;
+ k = 1;
+ }
+ z[3] = X[k];
+ }
u = (z[3] + TWO57) - TWO57;
- if (u > z[3]) u -= TWO5;
+ if (u > z[3])
+ u -= TWO5;
- if (u==z[3]) {
- for (i=k+1; i <= p2; i++) {
- if (X[i] == ZERO) continue;
- else {z[3] += ONE; break; }
+ if (u == z[3])
+ {
+ for (i = k + 1; i <= p2; i++)
+ {
+ if (X[i] == ZERO)
+ continue;
+ else
+ {
+ z[3] += ONE;
+ break;
+ }
+ }
}
- }
- c = X[0]*((z[1] + R*(z[2] + R*z[3])) - TWO10);
+ c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10);
- *y = c*TWOM1032;
+ *y = c * TWOM1032;
return;
#undef R
@@ -191,39 +301,65 @@ static void denorm(const mp_no *x, double *y, int p)
/* Convert multiple precision number *X into double precision number *Y. The
result is correctly rounded to the nearest/even. */
-void __mp_dbl(const mp_no *x, double *y, int p) {
-
- if (X[0] == ZERO) {*y = ZERO; return; }
+void
+__mp_dbl (const mp_no *x, double *y, int p)
+{
+ if (X[0] == ZERO)
+ {
+ *y = ZERO;
+ return;
+ }
- if (EX> -42) norm(x,y,p);
- else if (EX==-42 && X[1]>=TWO10) norm(x,y,p);
- else denorm(x,y,p);
+ if (EX > -42)
+ norm (x, y, p);
+ else if (EX == -42 && X[1] >= TWO10)
+ norm (x, y, p);
+ else
+ denorm (x, y, p);
}
/* Get the multiple precision equivalent of X into *Y. If the precision is too
small, the result is truncated. */
-void __dbl_mp(double x, mp_no *y, int p) {
-
- long i,n;
+void
+__dbl_mp (double x, mp_no *y, int p)
+{
+ long i, n;
long p2 = p;
double u;
/* Sign. */
- if (x == ZERO) {Y[0] = ZERO; return; }
- else if (x > ZERO) Y[0] = ONE;
- else {Y[0] = MONE; x=-x; }
+ if (x == ZERO)
+ {
+ Y[0] = ZERO;
+ return;
+ }
+ else if (x > ZERO)
+ Y[0] = ONE;
+ else
+ {
+ Y[0] = MONE;
+ x = -x;
+ }
/* Exponent. */
- for (EY=ONE; x >= RADIX; EY += ONE) x *= RADIXI;
- for ( ; x < ONE; EY -= ONE) x *= RADIX;
+ for (EY = ONE; x >= RADIX; EY += ONE)
+ x *= RADIXI;
+ for (; x < ONE; EY -= ONE)
+ x *= RADIX;
/* Digits. */
- n=MIN(p2,4);
- for (i=1; i<=n; i++) {
- u = (x + TWO52) - TWO52;
- if (u>x) u -= ONE;
- Y[i] = u; x -= u; x *= RADIX; }
- for ( ; i<=p2; i++) Y[i] = ZERO;
+ n = MIN (p2, 4);
+ for (i = 1; i <= n; i++)
+ {
+ u = (x + TWO52) - TWO52;
+ if (u > x)
+ u -= ONE;
+ Y[i] = u;
+ x -= u;
+ x *= RADIX;
+ }
+ for (; i <= p2; i++)
+ Y[i] = ZERO;
return;
}
@@ -231,93 +367,132 @@ void __dbl_mp(double x, mp_no *y, int p) {
sign of the sum *Z is not changed. X and Y may overlap but not X and Z or
Y and Z. No guard digit is used. The result equals the exact sum,
truncated. */
-static void add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- long i,j,k;
+static void
+add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ long i, j, k;
long p2 = p;
EZ = EX;
- i=p2; j=p2+ EY - EX; k=p2+1;
-
- if (j<1)
- {__cpy(x,z,p); return; }
- else Z[k] = ZERO;
-
- for (; j>0; i--,j--) {
- Z[k] += X[i] + Y[j];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] >= RADIX) {
- Z[k] -= RADIX;
- Z[--k] = ONE; }
- else
- Z[--k] = ZERO;
- }
-
- if (Z[1] == ZERO) {
- for (i=1; i<=p2; i++) Z[i] = Z[i+1]; }
- else EZ += ONE;
+ i = p2;
+ j = p2 + EY - EX;
+ k = p2 + 1;
+
+ if (j < 1)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ Z[k] = ZERO;
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += X[i] + Y[j];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] >= RADIX)
+ {
+ Z[k] -= RADIX;
+ Z[--k] = ONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p2; i++)
+ Z[i] = Z[i + 1];
+ }
+ else
+ EZ += ONE;
}
/* Subtract the magnitudes of *X and *Y assuming that abs (*x) > abs (*y) > 0.
The sign of the difference *Z is not changed. X and Y may overlap but not X
and Z or Y and Z. One guard digit is used. The error is less than one
ULP. */
-static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
- long i,j,k;
+static void
+sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ long i, j, k;
long p2 = p;
EZ = EX;
- if (EX == EY) {
- i=j=k=p2;
- Z[k] = Z[k+1] = ZERO; }
- else {
- j= EX - EY;
- if (j > p2) {__cpy(x,z,p); return; }
- else {
- i=p2; j=p2+1-j; k=p2;
- if (Y[j] > ZERO) {
- Z[k+1] = RADIX - Y[j--];
- Z[k] = MONE; }
- else {
- Z[k+1] = ZERO;
- Z[k] = ZERO; j--;}
- }
- }
-
- for (; j>0; i--,j--) {
- Z[k] += (X[i] - Y[j]);
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (; i>0; i--) {
- Z[k] += X[i];
- if (Z[k] < ZERO) {
- Z[k] += RADIX;
- Z[--k] = MONE; }
- else
- Z[--k] = ZERO;
- }
-
- for (i=1; Z[i] == ZERO; i++) ;
+ if (EX == EY)
+ {
+ i = j = k = p2;
+ Z[k] = Z[k + 1] = ZERO;
+ }
+ else
+ {
+ j = EX - EY;
+ if (j > p2)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+ else
+ {
+ i = p2;
+ j = p2 + 1 - j;
+ k = p2;
+ if (Y[j] > ZERO)
+ {
+ Z[k + 1] = RADIX - Y[j--];
+ Z[k] = MONE;
+ }
+ else
+ {
+ Z[k + 1] = ZERO;
+ Z[k] = ZERO;
+ j--;
+ }
+ }
+ }
+
+ for (; j > 0; i--, j--)
+ {
+ Z[k] += (X[i] - Y[j]);
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (; i > 0; i--)
+ {
+ Z[k] += X[i];
+ if (Z[k] < ZERO)
+ {
+ Z[k] += RADIX;
+ Z[--k] = MONE;
+ }
+ else
+ Z[--k] = ZERO;
+ }
+
+ for (i = 1; Z[i] == ZERO; i++);
EZ = EZ - i + 1;
- for (k=1; i <= p2+1; )
+ for (k = 1; i <= p2 + 1;)
Z[k++] = Z[i++];
- for (; k <= p2; )
+ for (; k <= p2;)
Z[k++] = ZERO;
return;
@@ -326,111 +501,186 @@ static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) {
/* Add *X and *Y and store the result in *Z. X and Y may overlap, but not X
and Z or Y and Z. One guard digit is used. The error is less than one
ULP. */
-void __add(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__add (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] == Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] == Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
return;
}
/* Subtract *Y from *X and return the result in *Z. X and Y may overlap but
not X and Z or Y and Z. One guard digit is used. The error is less than
one ULP. */
-void __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
int n;
- if (X[0] == ZERO) {__cpy(y,z,p); Z[0] = -Z[0]; return; }
- else if (Y[0] == ZERO) {__cpy(x,z,p); return; }
-
- if (X[0] != Y[0]) {
- if (__acr(x,y,p) > 0) {add_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else {add_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- }
- else {
- if ((n=__acr(x,y,p)) == 1) {sub_magnitudes(x,y,z,p); Z[0] = X[0]; }
- else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = -Y[0]; }
- else Z[0] = ZERO;
- }
+ if (X[0] == ZERO)
+ {
+ __cpy (y, z, p);
+ Z[0] = -Z[0];
+ return;
+ }
+ else if (Y[0] == ZERO)
+ {
+ __cpy (x, z, p);
+ return;
+ }
+
+ if (X[0] != Y[0])
+ {
+ if (__acr (x, y, p) > 0)
+ {
+ add_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else
+ {
+ add_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ }
+ else
+ {
+ if ((n = __acr (x, y, p)) == 1)
+ {
+ sub_magnitudes (x, y, z, p);
+ Z[0] = X[0];
+ }
+ else if (n == -1)
+ {
+ sub_magnitudes (y, x, z, p);
+ Z[0] = -Y[0];
+ }
+ else
+ Z[0] = ZERO;
+ }
return;
}
/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P
digits. In case P > 3 the error is bounded by 1.001 ULP. */
-void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
long i, i1, i2, j, k, k2;
long p2 = p;
double u, zk, zk2;
- /* Is z=0? */
- if (X[0]*Y[0]==ZERO)
- { Z[0]=ZERO; return; }
+ /* Is z=0? */
+ if (X[0] * Y[0] == ZERO)
+ {
+ Z[0] = ZERO;
+ return;
+ }
- /* Multiply, add and carry */
- k2 = (p2<3) ? p2+p2 : p2+3;
- zk = Z[k2]=ZERO;
- for (k=k2; k>1; ) {
- if (k > p2) {i1=k-p2; i2=p2+1; }
- else {i1=1; i2=k; }
-#if 1
- /* Rearrange this inner loop to allow the fmadd instructions to be
- independent and execute in parallel on processors that have
- dual symmetrical FP pipelines. */
- if (i1 < (i2-1))
+ /* Multiply, add and carry */
+ k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
+ zk = Z[k2] = ZERO;
+ for (k = k2; k > 1;)
{
- /* Make sure we have at least 2 iterations. */
- if (((i2 - i1) & 1L) == 1L)
+ if (k > p2)
{
- /* Handle the odd iterations case. */
- zk2 = x->d[i2-1]*y->d[i1];
+ i1 = k - p2;
+ i2 = p2 + 1;
}
- else
- zk2 = 0.0;
- /* Do two multiply/adds per loop iteration, using independent
- accumulators; zk and zk2. */
- for (i=i1,j=i2-1; i<i2-1; i+=2,j-=2)
+ else
{
- zk += x->d[i]*y->d[j];
- zk2 += x->d[i+1]*y->d[j-1];
+ i1 = 1;
+ i2 = k;
+ }
+#if 1
+ /* Rearrange this inner loop to allow the fmadd instructions to be
+ independent and execute in parallel on processors that have
+ dual symmetrical FP pipelines. */
+ if (i1 < (i2 - 1))
+ {
+ /* Make sure we have at least 2 iterations. */
+ if (((i2 - i1) & 1L) == 1L)
+ {
+ /* Handle the odd iterations case. */
+ zk2 = x->d[i2 - 1] * y->d[i1];
+ }
+ else
+ zk2 = 0.0;
+ /* Do two multiply/adds per loop iteration, using independent
+ accumulators; zk and zk2. */
+ for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
+ {
+ zk += x->d[i] * y->d[j];
+ zk2 += x->d[i + 1] * y->d[j - 1];
+ }
+ zk += zk2; /* Final sum. */
+ }
+ else
+ {
+ /* Special case when iterations is 1. */
+ zk += x->d[i1] * y->d[i1];
}
- zk += zk2; /* Final sum. */
- }
- else
- {
- /* Special case when iterations is 1. */
- zk += x->d[i1]*y->d[i1];
- }
#else
- /* The original code. */
- for (i=i1,j=i2-1; i<i2; i++,j--) zk += X[i]*Y[j];
+ /* The original code. */
+ for (i = i1, j = i2 - 1; i < i2; i++, j--)
+ zk += X[i] * Y[j];
#endif
- u = (zk + CUTTER)-CUTTER;
- if (u > zk) u -= RADIX;
- Z[k] = zk - u;
- zk = u*RADIXI;
- --k;
- }
+ u = (zk + CUTTER) - CUTTER;
+ if (u > zk)
+ u -= RADIX;
+ Z[k] = zk - u;
+ zk = u * RADIXI;
+ --k;
+ }
Z[k] = zk;
/* Is there a carry beyond the most significant digit? */
- if (Z[1] == ZERO) {
- for (i=1; i<=p2; i++) Z[i]=Z[i+1];
- EZ = EX + EY - 1; }
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p2; i++)
+ Z[i] = Z[i + 1];
+ EZ = EX + EY - 1;
+ }
else
EZ = EX + EY;
@@ -444,26 +694,31 @@ void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) {
- For P > 3: 2.001 * R ^ (1 - P)
*X = 0 is not permissible. */
-void __inv(const mp_no *x, mp_no *y, int p) {
+void
+__inv (const mp_no *x, mp_no *y, int p)
+{
long i;
double t;
- mp_no z,w;
- static const int np1[] = {0,0,0,0,1,2,2,2,2,3,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4};
- const mp_no mptwo = {1,{1.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
-
- __cpy(x,&z,p); z.e=0; __mp_dbl(&z,&t,p);
- t=ONE/t; __dbl_mp(t,y,p); EY -= EX;
-
- for (i=0; i<np1[p]; i++) {
- __cpy(y,&w,p);
- __mul(x,&w,y,p);
- __sub(&mptwo,y,&z,p);
- __mul(&w,&z,y,p);
- }
+ mp_no z, w;
+ static const int np1[] =
+ { 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ };
+
+ __cpy (x, &z, p);
+ z.e = 0;
+ __mp_dbl (&z, &t, p);
+ t = ONE / t;
+ __dbl_mp (t, y, p);
+ EY -= EX;
+
+ for (i = 0; i < np1[p]; i++)
+ {
+ __cpy (y, &w, p);
+ __mul (x, &w, y, p);
+ __sub (&mptwo, y, &z, p);
+ __mul (&w, &z, y, p);
+ }
return;
}
@@ -474,11 +729,17 @@ void __inv(const mp_no *x, mp_no *y, int p) {
- For P > 3: 3.001 * R ^ (1 - P)
*X = 0 is not permissible. */
-void __dvd(const mp_no *x, const mp_no *y, mp_no *z, int p) {
-
+void
+__dvd (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
mp_no w;
- if (X[0] == ZERO) Z[0] = ZERO;
- else {__inv(y,&w,p); __mul(x,&w,z,p);}
+ if (X[0] == ZERO)
+ Z[0] = ZERO;
+ else
+ {
+ __inv (y, &w, p);
+ __mul (x, &w, z, p);
+ }
return;
}
diff --git a/libc/sysdeps/s390/bits/byteswap.h b/libc/sysdeps/s390/bits/byteswap.h
index 6f9625700..5d289120f 100644
--- a/libc/sysdeps/s390/bits/byteswap.h
+++ b/libc/sysdeps/s390/bits/byteswap.h
@@ -112,7 +112,7 @@ __bswap_32 (unsigned int __bsx)
__r.__l[1] = __bswap_32 (__w.__l[0]); \
__r.__ll; })
# endif
-#elif __GLIBC_HAVE_LONG_LONG
+#else
# define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
@@ -123,6 +123,7 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
+__extension__
static __inline unsigned long long int
__bswap_64 (unsigned long long int __bsx)
{
diff --git a/libc/sysdeps/sh/Makefile b/libc/sysdeps/sh/Makefile
index 34c636a99..bb7c55362 100644
--- a/libc/sysdeps/sh/Makefile
+++ b/libc/sysdeps/sh/Makefile
@@ -4,9 +4,4 @@ endif
ifeq ($(subdir),debug)
CFLAGS-backtrace.c += -funwind-tables
-CFLAGS-tst-backtrace2.c += -funwind-tables
-CFLAGS-tst-backtrace3.c += -funwind-tables
-CFLAGS-tst-backtrace4.c += -funwind-tables
-CFLAGS-tst-backtrace5.c += -funwind-tables
-CFLAGS-tst-backtrace6.c += -funwind-tables
endif
diff --git a/libc/sysdeps/sparc/fpu/libm-test-ulps b/libc/sysdeps/sparc/fpu/libm-test-ulps
index d2770442a..f282a160a 100644
--- a/libc/sysdeps/sparc/fpu/libm-test-ulps
+++ b/libc/sysdeps/sparc/fpu/libm-test-ulps
@@ -198,6 +198,42 @@ double: 1
idouble: 1
ildouble: 1
ldouble: 1
+Test "Real part of: cacos (-0.5 + +0 i) == 2.094395102393195492308428922186335256131 - 0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-0.5 - 0 i) == 2.094395102393195492308428922186335256131 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p500 + 1.0 i) == 3.141592653589793238462643383279502884197 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p500 - 1.0 i) == 3.141592653589793238462643383279502884197 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p5000 + 1.0 i) == 3.141592653589793238462643383279502884197 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-0x1p5000 - 1.0 i) == 3.141592653589793238462643383279502884197 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-1.0 + 0x1p50 i) == 1.570796326794897507409741391764983781004 - 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cacos (-1.0 + 0x1p500 i) == 1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-1.0 + 0x1p5000 i) == 1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacos (-1.0 - 0x1p50 i) == 1.570796326794897507409741391764983781004 + 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cacos (-1.0 - 0x1p500 i) == 1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (-1.0 - 0x1p5000 i) == 1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
@@ -205,6 +241,11 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: cacos (-2 - 3 i) == 2.1414491111159960199416055713254211 + 1.9833870299165354323470769028940395 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Test "Real part of: cacos (0.5 + +0 i) == 1.047197551196597746154214461093167628066 - 0 i":
double: 1
idouble: 1
@@ -221,6 +262,39 @@ ifloat: 1
Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
ildouble: 1
ldouble: 1
+Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 - 7.107906849659093345062145442726115449315e2 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 - 8.973081118419833726837456344608533993585e1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp16383 + 0x1.fp16383 i) == 7.853981633974483096156608458198757210493e-1 - 1.135753137836666928715489992987020363057e4 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p500 + 1.0 i) == 3.054936363499604682051979393213617699789e-151 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p500 - 1.0 i) == 3.054936363499604682051979393213617699789e-151 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p5000 + 1.0 i) == 7.079811261048172892385615158694057552948e-1506 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0x1p5000 - 1.0 i) == 7.079811261048172892385615158694057552948e-1506 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 + 0x1p500 i) == 1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 + 0x1p5000 i) == 1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 - 0x1p500 i) == 1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (1.0 - 0x1p5000 i) == 1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
@@ -407,6 +481,30 @@ double: 1
idouble: 1
ildouble: 1
ldouble: 1
+Test "Imaginary part of: casin (-0x1p500 + 1.0 i) == -1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-0x1p500 - 1.0 i) == -1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-0x1p5000 + 1.0 i) == -1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-0x1p5000 - 1.0 i) == -1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-1.0 + 0x1p500 i) == -3.054936363499604682051979393213617699789e-151 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-1.0 + 0x1p5000 i) == -7.079811261048172892385615158694057552948e-1506 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-1.0 - 0x1p500 i) == -3.054936363499604682051979393213617699789e-151 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (-1.0 - 0x1p5000 i) == -7.079811261048172892385615158694057552948e-1506 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: casin (-1.5 + +0 i) == -pi/2 + 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
@@ -422,6 +520,39 @@ ifloat: 1
Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
ildouble: 1
ldouble: 1
+Test "Imaginary part of: casin (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 + 7.107906849659093345062145442726115449315e2 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: casin (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 + 8.973081118419833726837456344608533993585e1 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: casin (0x1.fp16383 + 0x1.fp16383 i) == 7.853981633974483096156608458198757210493e-1 + 1.135753137836666928715489992987020363057e4 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (0x1p500 + 1.0 i) == 1.570796326794896619231321691639751442099 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (0x1p500 - 1.0 i) == 1.570796326794896619231321691639751442099 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (0x1p5000 + 1.0 i) == 1.570796326794896619231321691639751442099 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (0x1p5000 - 1.0 i) == 1.570796326794896619231321691639751442099 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (1.0 + 0x1p500 i) == 3.054936363499604682051979393213617699789e-151 + 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (1.0 + 0x1p5000 i) == 7.079811261048172892385615158694057552948e-1506 + 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (1.0 - 0x1p500 i) == 3.054936363499604682051979393213617699789e-151 - 3.472667374605326000180332928505464606058e2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casin (1.0 - 0x1p5000 i) == 7.079811261048172892385615158694057552948e-1506 - 3.466429049980286492395577839412341016946e3 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: casin (1.5 + +0 i) == pi/2 + 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
@@ -459,6 +590,18 @@ idouble: 2
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: casinh (-0x1p500 + 1.0 i) == -3.472667374605326000180332928505464606058e2 + 3.054936363499604682051979393213617699789e-151 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (-0x1p500 - 1.0 i) == -3.472667374605326000180332928505464606058e2 - 3.054936363499604682051979393213617699789e-151 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (-0x1p5000 + 1.0 i) == -3.466429049980286492395577839412341016946e3 + 7.079811261048172892385615158694057552948e-1506 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (-0x1p5000 - 1.0 i) == -3.466429049980286492395577839412341016946e3 - 7.079811261048172892385615158694057552948e-1506 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (-1.0 + +0 i) == -0.8813735870195430252326093249797923090282 + +0 i":
double: 2
float: 1
@@ -466,6 +609,12 @@ idouble: 2
ifloat: 1
ildouble: 3
ldouble: 3
+Test "Real part of: casinh (-1.0 + 0x1p500 i) == -3.472667374605326000180332928505464606058e2 + 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (-1.0 + 0x1p5000 i) == -3.466429049980286492395577839412341016946e3 + 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (-1.0 - 0 i) == -0.8813735870195430252326093249797923090282 - 0 i":
double: 2
float: 1
@@ -473,6 +622,12 @@ idouble: 2
ifloat: 1
ildouble: 3
ldouble: 3
+Test "Real part of: casinh (-1.0 - 0x1p500 i) == -3.472667374605326000180332928505464606058e2 - 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (-1.0 - 0x1p5000 i) == -3.466429049980286492395577839412341016946e3 - 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (-1.5 + +0 i) == -1.194763217287109304111930828519090523536 + +0 i":
double: 2
float: 1
@@ -523,6 +678,27 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: casinh (0x1.fp1023 + 0x1.fp1023 i) == 7.107906849659093345062145442726115449315e2 + 7.853981633974483096156608458198757210493e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: casinh (0x1.fp127 + 0x1.fp127 i) == 8.973081118419833726837456344608533993585e1 + 7.853981633974483096156608458198757210493e-1 i":
+double: 1
+idouble: 1
+Test "Real part of: casinh (0x1.fp16383 + 0x1.fp16383 i) == 1.135753137836666928715489992987020363057e4 + 7.853981633974483096156608458198757210493e-1 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (0x1p500 + 1.0 i) == 3.472667374605326000180332928505464606058e2 + 3.054936363499604682051979393213617699789e-151 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (0x1p500 - 1.0 i) == 3.472667374605326000180332928505464606058e2 - 3.054936363499604682051979393213617699789e-151 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (0x1p5000 + 1.0 i) == 3.466429049980286492395577839412341016946e3 + 7.079811261048172892385615158694057552948e-1506 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (0x1p5000 - 1.0 i) == 3.466429049980286492395577839412341016946e3 - 7.079811261048172892385615158694057552948e-1506 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (1.0 + +0 i) == 0.8813735870195430252326093249797923090282 + +0 i":
double: 1
float: 1
@@ -530,6 +706,12 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: casinh (1.0 + 0x1p500 i) == 3.472667374605326000180332928505464606058e2 + 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (1.0 + 0x1p5000 i) == 3.466429049980286492395577839412341016946e3 + 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (1.0 - 0 i) == 0.8813735870195430252326093249797923090282 - 0 i":
double: 1
float: 1
@@ -537,6 +719,12 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: casinh (1.0 - 0x1p500 i) == 3.472667374605326000180332928505464606058e2 - 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (1.0 - 0x1p5000 i) == 3.466429049980286492395577839412341016946e3 - 1.570796326794896619231321691639751442099 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: casinh (1.5 + +0 i) == 1.194763217287109304111930828519090523536 + +0 i":
double: 1
idouble: 1
diff --git a/libc/sysdeps/sparc/sparc-ifunc.h b/libc/sysdeps/sparc/sparc-ifunc.h
index edff5c880..f68161fc5 100644
--- a/libc/sysdeps/sparc/sparc-ifunc.h
+++ b/libc/sysdeps/sparc/sparc-ifunc.h
@@ -51,6 +51,33 @@ ENTRY (__##name) \
mov %o1, %o0; \
END (__##name)
+# define SPARC_ASM_IFUNC2(name, m1, f1, m2, f2, dflt) \
+ENTRY (__##name) \
+ .type __##name, @gnu_indirect_function; \
+ SETUP_PIC_REG_LEAF(o3, o5); \
+ set m1, %o1; \
+ andcc %o0, %o1, %g0; \
+ be 8f; \
+ nop; \
+ sethi %gdop_hix22(f1), %o1; \
+ xor %o1, %gdop_lox10(f1), %o1; \
+ ba 10f; \
+ nop; \
+8: set m2, %o1; \
+ andcc %o0, %o1, %g0; \
+ be 9f; \
+ nop; \
+ sethi %gdop_hix22(f2), %o1; \
+ xor %o1, %gdop_lox10(f2), %o1; \
+ ba 10f; \
+ nop; \
+9: sethi %gdop_hix22(dflt), %o1; \
+ xor %o1, %gdop_lox10(dflt), %o1; \
+10: add %o3, %o1, %o1; \
+ retl; \
+ mov %o1, %o0; \
+END (__##name)
+
# else /* SHARED */
# ifdef __arch64__
@@ -82,19 +109,54 @@ ENTRY (__##name) \
mov %o1, %o0; \
END (__##name)
+# define SPARC_ASM_IFUNC2(name, m1, f1, m2, f2, dflt) \
+ENTRY (__##name) \
+ .type __##name, @gnu_indirect_function; \
+ set m1, %o1; \
+ andcc %o0, %o1, %g0; \
+ be 8f; \
+ nop; \
+ SET(f1, %g1, %o1); \
+ ba 10f; \
+ nop; \
+8: set m2, %o1; \
+ andcc %o0, %o1, %g0; \
+ be 9f; \
+ nop; \
+ SET(f2, %g1, %o1); \
+ ba 10f; \
+ nop; \
+9: SET(dflt, %g1, %o1); \
+10: retl; \
+ mov %o1, %o0; \
+END (__##name)
+
# endif /* SHARED */
+#define SPARC_ASM_VIS2_IFUNC(name) \
+ SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS2, \
+ __##name##_vis2, __##name##_generic)
+
# ifdef HAVE_AS_VIS3_SUPPORT
#define SPARC_ASM_VIS3_IFUNC(name) \
SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS3, \
__##name##_vis3, __##name##_generic)
+#define SPARC_ASM_VIS3_VIS2_IFUNC(name) \
+ SPARC_ASM_IFUNC2(name, HWCAP_SPARC_VIS3, \
+ __##name##_vis3, \
+ HWCAP_SPARC_VIS2, \
+ __##name##_vis2, __##name##_generic)
+
# else /* HAVE_AS_VIS3_SUPPORT */
#define SPARC_ASM_VIS3_IFUNC(name) \
SPARC_ASM_IFUNC_DFLT(name, __##name##_generic)
+#define SPARC_ASM_VIS3_VIS2_IFUNC(name) \
+ SPARC_ASM_VIS2_IFUNC(name)
+
# endif /* HAVE_AS_VIS3_SUPPORT */
diff --git a/libc/sysdeps/sparc/sparc32/fpu/s_fdim.S b/libc/sysdeps/sparc/sparc32/fpu/s_fdim.S
new file mode 100644
index 000000000..2f0c5ce58
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/fpu/s_fdim.S
@@ -0,0 +1,41 @@
+/* Compute positive difference, sparc 32-bit.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fdim)
+ std %o0, [%sp + 72]
+ std %o2, [%sp + 80]
+ ldd [%sp + 72], %f0
+ ldd [%sp + 80], %f2
+ fcmpd %f0, %f2
+ st %g0, [%sp + 72]
+ fbug 1f
+ st %g0, [%sp + 76]
+ ldd [%sp + 72], %f0
+ fnegd %f0, %f2
+1: retl
+ fsubd %f0, %f2, %f0
+END(__fdim)
+weak_alias (__fdim, fdim)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/libc/sysdeps/sparc/sparc32/fpu/s_fdimf.S b/libc/sysdeps/sparc/sparc32/fpu/s_fdimf.S
new file mode 100644
index 000000000..570fdc30b
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/fpu/s_fdimf.S
@@ -0,0 +1,35 @@
+/* Compute positive difference, sparc 32-bit.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__fdimf)
+ st %o0, [%sp + 72]
+ st %o1, [%sp + 76]
+ ld [%sp + 72], %f0
+ ld [%sp + 76], %f1
+ fcmps %f0, %f1
+ fbug 1f
+ st %g0, [%sp + 72]
+ ld [%sp + 72], %f0
+ fnegs %f0, %f1
+1: retl
+ fsubs %f0, %f1, %f0
+END(__fdimf)
+weak_alias (__fdimf, fdimf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S
index 563bfb1c0..7ba81d8a6 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/addmul_1.S
@@ -1 +1,81 @@
-#include <sparcv8/addmul_1.S>
+! SPARC v9 32-bit __mpn_addmul_1 -- Multiply a limb vector with a limb
+! and add the result to a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %i0
+#define s1_ptr %i1
+#define sz_arg %i2
+#define s2l_arg %i3
+#define sz %o4
+#define carry %o5
+#define s2_limb %g1
+#define tmp1 %l0
+#define tmp2 %l1
+#define tmp3 %l2
+#define tmp4 %l3
+#define tmp64_1 %g3
+#define tmp64_2 %o3
+
+ENTRY(__mpn_addmul_1)
+ save %sp, -96, %sp
+ srl sz_arg, 0, sz
+ srl s2l_arg, 0, s2_limb
+ subcc sz, 1, sz
+ be,pn %icc, .Lfinal_limb
+ clr carry
+
+.Lloop:
+ lduw [s1_ptr + 0x00], tmp1
+ lduw [res_ptr + 0x00], tmp3
+ lduw [s1_ptr + 0x04], tmp2
+ lduw [res_ptr + 0x04], tmp4
+ mulx tmp1, s2_limb, tmp64_1
+ add s1_ptr, 8, s1_ptr
+ mulx tmp2, s2_limb, tmp64_2
+ sub sz, 2, sz
+ add res_ptr, 8, res_ptr
+ add tmp3, tmp64_1, tmp64_1
+ add carry, tmp64_1, tmp64_1
+ stw tmp64_1, [res_ptr - 0x08]
+ srlx tmp64_1, 32, carry
+ add tmp4, tmp64_2, tmp64_2
+ add carry, tmp64_2, tmp64_2
+ stw tmp64_2, [res_ptr - 0x04]
+ brgz sz, .Lloop
+ srlx tmp64_2, 32, carry
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ lduw [s1_ptr + 0x00], tmp1
+ lduw [res_ptr + 0x00], tmp3
+ mulx tmp1, s2_limb, tmp64_1
+ add tmp3, tmp64_1, tmp64_1
+ add carry, tmp64_1, tmp64_1
+ stw tmp64_1, [res_ptr + 0x00]
+ srlx tmp64_1, 32, carry
+
+.Lfinish:
+ jmpl %i7 + 0x8, %g0
+ restore carry, 0, %o0
+END(__mpn_addmul_1)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index ee9f6ffce..0d92813d7 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -1,11 +1,15 @@
ifeq ($(subdir),math)
+libm-sysdep_routines += s_ceil-vis2 s_ceilf-vis2 \
+ s_floor-vis2 s_floorf-vis2
ifeq ($(have-as-vis3),yes)
libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_ceilf-vis3 \
s_ceil-vis3 s_fabs-vis3 s_fabsf-vis3 s_floor-vis3 \
s_floorf-vis3 s_llrintf-vis3 s_llrint-vis3 \
s_rintf-vis3 s_rint-vis3 w_sqrt-vis3 w_sqrtf-vis3 \
s_fminf-vis3 s_fmin-vis3 s_fmaxf-vis3 s_fmax-vis3 \
- s_fmaf-vis3 s_fma-vis3
+ s_fmaf-vis3 s_fma-vis3 s_fdimf-vis3 s_fdim-vis3 \
+ s_nearbyint-vis3 s_nearbyintf-vis3 s_truncf-vis3 \
+ s_trunc-vis3
sysdep_routines += s_copysignf-vis3 s_copysign-vis3
endif
endif
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S
new file mode 100644
index 000000000..94388003d
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S
@@ -0,0 +1,61 @@
+/* ceil function, sparc32 v9 vis2 version.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__ceil_vis2)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o0, 32, %o0
+ or %o0, %o1, %o0
+ stx %o0, [%sp + 72]
+ sllx %o2, 32, %o2
+ fzero ZERO
+ ldd [%sp + 72], %f0
+ fnegd ZERO, SIGN_BIT
+ stx %o2, [%sp + 72]
+ fabsd %f0, %f14
+ ldd [%sp + 72], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
+ faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
+ fsubd %f18, %f16, %f18
+ siam (0 << 2)
+ retl
+ for %f18, SIGN_BIT, %f0
+END (__ceil_vis2)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S
index 0c2140d95..aebff5cae 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S
@@ -19,27 +19,21 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
-#define ONE_DOT_ZERO 0x3ff00000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
@@ -47,32 +41,22 @@
ENTRY (__ceil_vis3)
sethi %hi(TWO_FIFTYTWO), %o2
sllx %o0, 32, %o0
- sethi %hi(ONE_DOT_ZERO), %o3
+ sllx %o2, 32, %o2
or %o0, %o1, %o0
movxtod %o0, %f0
- sllx %o2, 32, %o2
fzero ZERO
- sllx %o3, 32, %o3
-
fnegd ZERO, SIGN_BIT
-
movxtod %o2, %f16
fabsd %f0, %f14
-
fcmpd %fcc3, %f14, %f16
-
fmovduge %fcc3, ZERO, %f16
fand %f0, SIGN_BIT, SIGN_BIT
-
for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
fsubd %f18, %f16, %f18
- fcmpd %fcc2, %f18, %f0
- movxtod %o3, %f20
-
- fmovduge %fcc2, ZERO, %f20
- faddd %f18, %f20, %f0
- fabsd %f0, %f0
+ siam (0 << 2)
retl
- for %f0, SIGN_BIT, %f0
+ for %f18, SIGN_BIT, %f0
END (__ceil_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S
index 835703fb9..efc8d4936 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S
@@ -1,7 +1,7 @@
#include <sparc-ifunc.h>
#include <math_ldbl_opt.h>
-SPARC_ASM_VIS3_IFUNC(ceil)
+SPARC_ASM_VIS3_VIS2_IFUNC(ceil)
weak_alias (__ceil, ceil)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S
new file mode 100644
index 000000000..bc516765f
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S
@@ -0,0 +1,58 @@
+/* Float ceil function, sparc32 v9 vis2 version.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__ceilf_vis2)
+ st %o0, [%sp + 68]
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ ld [%sp + 68], %f0
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + 68]
+ fabss %f0, %f14
+ ld [%sp + 68], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f0, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
+ fadds %f0, %f16, %f1
+ siam (1 << 2) | 0
+ fsubs %f1, %f16, %f1
+ siam (0 << 2)
+ retl
+ fors %f1, SIGN_BIT, %f0
+END (__ceilf_vis2)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S
index 7d30c0b84..0a6768ca1 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S
@@ -19,27 +19,21 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
-#define ONE_DOT_ZERO 0x3f800000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
@@ -47,28 +41,19 @@
ENTRY (__ceilf_vis3)
movwtos %o0, %f0
sethi %hi(TWO_TWENTYTHREE), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzeros ZERO
-
fnegs ZERO, SIGN_BIT
-
movwtos %o2, %f16
fabss %f0, %f14
-
fcmps %fcc3, %f14, %f16
-
fmovsuge %fcc3, ZERO, %f16
fands %f0, SIGN_BIT, SIGN_BIT
-
fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
fadds %f0, %f16, %f1
+ siam (1 << 2) | 0
fsubs %f1, %f16, %f1
- fcmps %fcc2, %f1, %f0
- movwtos %o3, %f9
-
- fmovsuge %fcc2, ZERO, %f9
- fadds %f1, %f9, %f0
- fabss %f0, %f0
+ siam (0 << 2)
retl
- fors %f0, SIGN_BIT, %f0
+ fors %f1, SIGN_BIT, %f0
END (__ceilf_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S
index 3047dd8fa..1c72a5728 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(ceilf)
+SPARC_ASM_VIS3_VIS2_IFUNC(ceilf)
weak_alias (__ceilf, ceilf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S
new file mode 100644
index 000000000..5e011a121
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S
@@ -0,0 +1,34 @@
+/* Compute positive difference, sparc 32-bit+v9+vis3.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__fdim_vis3)
+ movwtos %o0, %f0
+ movwtos %o1, %f1
+ movwtos %o2, %f2
+ movwtos %o3, %f3
+ fcmpd %f0, %f2
+ fbug 1f
+ nop
+ fzero %f0
+ fnegd %f0, %f2
+1: retl
+ fsubd %f0, %f2, %f0
+END(__fdim_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S
new file mode 100644
index 000000000..4b1340824
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S
@@ -0,0 +1,19 @@
+#include <sparc-ifunc.h>
+#include <math_ldbl_opt.h>
+
+SPARC_ASM_VIS3_IFUNC(fdim)
+
+weak_alias (__fdim, fdim)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
+
+# undef weak_alias
+# define weak_alias(a, b)
+# undef compat_symbol
+# define compat_symbol(a, b, c, d)
+
+#define __fdim __fdim_generic
+
+#include "../s_fdim.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S
new file mode 100644
index 000000000..c6d571297
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S
@@ -0,0 +1,32 @@
+/* Compute positive difference, sparc 32-bit+v9+vis3.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__fdimf_vis3)
+ movwtos %o0, %f0
+ movwtos %o1, %f1
+ fcmps %f0, %f1
+ fbug 1f
+ nop
+ fzeros %f0
+ fnegs %f0, %f1
+1: retl
+ fsubs %f0, %f1, %f0
+END(__fdimf_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S
new file mode 100644
index 000000000..30381d6a5
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(fdimf)
+
+weak_alias (__fdimf, fdimf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __fdimf __fdimf_generic
+
+#include "../s_fdimf.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S
new file mode 100644
index 000000000..3b5e8fd7c
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S
@@ -0,0 +1,61 @@
+/* floor function, sparc32 v9 vis2 version.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__floor_vis2)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o0, 32, %o0
+ or %o0, %o1, %o0
+ stx %o0, [%sp + 72]
+ sllx %o2, 32, %o2
+ fzero ZERO
+ ldd [%sp + 72], %f0
+ fnegd ZERO, SIGN_BIT
+ stx %o2, [%sp + 72]
+ fabsd %f0, %f14
+ ldd [%sp + 72], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
+ faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
+ fsubd %f18, %f16, %f18
+ siam (0 << 2)
+ retl
+ for %f18, SIGN_BIT, %f0
+END (__floor_vis2)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S
index 8445f1d7a..41fdfac3b 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S
@@ -19,27 +19,21 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
-#define ONE_DOT_ZERO 0x3ff00000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
@@ -47,32 +41,22 @@
ENTRY (__floor_vis3)
sethi %hi(TWO_FIFTYTWO), %o2
sllx %o0, 32, %o0
- sethi %hi(ONE_DOT_ZERO), %o3
+ sllx %o2, 32, %o2
or %o0, %o1, %o0
movxtod %o0, %f0
- sllx %o2, 32, %o2
fzero ZERO
- sllx %o3, 32, %o3
-
fnegd ZERO, SIGN_BIT
-
movxtod %o2, %f16
fabsd %f0, %f14
-
fcmpd %fcc3, %f14, %f16
-
fmovduge %fcc3, ZERO, %f16
fand %f0, SIGN_BIT, SIGN_BIT
-
for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
fsubd %f18, %f16, %f18
- fcmpd %fcc2, %f18, %f0
- movxtod %o3, %f20
-
- fmovdule %fcc2, ZERO, %f20
- fsubd %f18, %f20, %f0
- fabsd %f0, %f0
+ siam (0 << 2)
retl
- for %f0, SIGN_BIT, %f0
+ for %f18, SIGN_BIT, %f0
END (__floor_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S
index 37aeb43b9..1fe4b95ea 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S
@@ -1,7 +1,7 @@
#include <sparc-ifunc.h>
#include <math_ldbl_opt.h>
-SPARC_ASM_VIS3_IFUNC(floor)
+SPARC_ASM_VIS3_VIS2_IFUNC(floor)
weak_alias (__floor, floor)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S
new file mode 100644
index 000000000..4f731212e
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S
@@ -0,0 +1,58 @@
+/* Float floor function, sparc32 v9 vis2 version.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__floorf_vis2)
+ st %o0, [%sp + 68]
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ ld [%sp + 68], %f0
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + 68]
+ fabss %f0, %f14
+ ld [%sp + 68], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f0, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
+ fadds %f0, %f16, %f1
+ siam (1 << 2) | 0
+ fsubs %f1, %f16, %f1
+ siam (0 << 2)
+ retl
+ fors %f1, SIGN_BIT, %f0
+END (__floorf_vis2)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S
index 133a0a4a9..fe2d2da20 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S
@@ -19,27 +19,21 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
-#define ONE_DOT_ZERO 0x3f800000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
@@ -47,28 +41,19 @@
ENTRY (__floorf_vis3)
movwtos %o0, %f0
sethi %hi(TWO_TWENTYTHREE), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzeros ZERO
-
fnegs ZERO, SIGN_BIT
-
movwtos %o2, %f16
fabss %f0, %f14
-
fcmps %fcc3, %f14, %f16
-
fmovsuge %fcc3, ZERO, %f16
fands %f0, SIGN_BIT, SIGN_BIT
-
fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
fadds %f0, %f16, %f1
+ siam (1 << 2) | 0
fsubs %f1, %f16, %f1
- fcmps %fcc2, %f1, %f0
- movwtos %o3, %f9
-
- fmovsule %fcc2, ZERO, %f9
- fsubs %f1, %f9, %f0
- fabss %f0, %f0
+ siam (0 << 2)
retl
- fors %f0, SIGN_BIT, %f0
+ fors %f1, SIGN_BIT, %f0
END (__floorf_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S
index 31cda385b..d2a83cb9b 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(floorf)
+SPARC_ASM_VIS3_VIS2_IFUNC(floorf)
weak_alias (__floorf, floorf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S
new file mode 100644
index 000000000..b509500ed
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S
@@ -0,0 +1,65 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc32 v9 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyint_vis3)
+ st %fsr, [%sp + 88]
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sethi %hi(0xf8003e0), %o5
+ ld [%sp + 88], %o4
+ sllx %o0, 32, %o0
+ or %o5, %lo(0xf8003e0), %o5
+ or %o0, %o1, %o0
+ movxtod %o0, %f0
+ andn %o4, %o5, %o4
+ fzero ZERO
+ st %o4, [%sp + 80]
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ ld [%sp + 80], %fsr
+ movxtod %o2, %f16
+ fabsd %f0, %f14
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ faddd %f0, %f16, %f6
+ fsubd %f6, %f16, %f0
+ fabsd %f0, %f0
+ for %f0, SIGN_BIT, %f0
+ retl
+ ld [%sp + 88], %fsr
+END (__nearbyint_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S
new file mode 100644
index 000000000..47da9eaaf
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S
@@ -0,0 +1,19 @@
+#include <sparc-ifunc.h>
+#include <math_ldbl_opt.h>
+
+SPARC_ASM_VIS3_IFUNC(nearbyint)
+
+weak_alias (__nearbyint, nearbyint)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1)
+#endif
+
+# undef weak_alias
+# define weak_alias(a, b)
+# undef compat_symbol
+# define compat_symbol(a, b, c, d)
+
+#define __nearbyint __nearbyint_generic
+
+#include "../s_nearbyint.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S
new file mode 100644
index 000000000..336126dee
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S
@@ -0,0 +1,61 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc32 v9 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyintf_vis3)
+ st %fsr, [%sp + 88]
+ movwtos %o0, %f1
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ sethi %hi(0xf8003e0), %o5
+ ld [%sp + 88], %o4
+ fzeros ZERO
+ or %o5, %lo(0xf8003e0), %o5
+ fnegs ZERO, SIGN_BIT
+ andn %o4, %o5, %o4
+ st %o4, [%sp + 80]
+ ld [%sp + 80], %fsr
+ movwtos %o2, %f16
+ fabss %f1, %f14
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ fadds %f1, %f16, %f5
+ fsubs %f5, %f16, %f0
+ fabss %f0, %f0
+ fors %f0, SIGN_BIT, %f0
+ retl
+ ld [%sp + 88], %fsr
+END (__nearbyintf_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S
new file mode 100644
index 000000000..95100c1bf
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(nearbyintf)
+
+weak_alias (__nearbyintf, nearbyintf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __nearbyintf __nearbyintf_generic
+
+#include "../s_nearbyintf.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S
new file mode 100644
index 000000000..72ec2826e
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S
@@ -0,0 +1,57 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc32 v9 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__trunc_vis3)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o0, 32, %o0
+ or %o0, %o1, %o0
+ fzero ZERO
+ movxtod %o0, %f0
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ movxtod %o2, %f16
+ fabsd %f0, %f14
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f14
+ fand %f0, SIGN_BIT, SIGN_BIT
+ fdtox %f14, %f14
+ fxtod %f14, %f14
+ faddd %f0, ZERO, %f18
+ fmovduge %fcc3, %f18, %f14
+ retl
+ for %f14, SIGN_BIT, %f0
+END (__trunc_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S
new file mode 100644
index 000000000..3787fa1f1
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S
@@ -0,0 +1,19 @@
+#include <sparc-ifunc.h>
+#include <math_ldbl_opt.h>
+
+SPARC_ASM_VIS3_IFUNC(trunc)
+
+weak_alias (__trunc, trunc)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
+
+# undef weak_alias
+# define weak_alias(a, b)
+# undef compat_symbol
+# define compat_symbol(a, b, c, d)
+
+#define __trunc __trunc_generic
+
+#include "../s_trunc.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S
new file mode 100644
index 000000000..60445dfaa
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S
@@ -0,0 +1,53 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc32 v9 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__truncf_vis3)
+ movwtos %o0, %f1
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ fnegs ZERO, SIGN_BIT
+ movwtos %o2, %f16
+ fabss %f1, %f14
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f14
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fstoi %f14, %f14
+ fitos %f14, %f14
+ fadds %f1, ZERO, %f18
+ fmovsuge %fcc3, %f18, %f14
+ retl
+ fors %f14, SIGN_BIT, %f0
+END (__truncf_vis3)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S
new file mode 100644
index 000000000..2ca251733
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(truncf)
+
+weak_alias (__truncf, truncf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __truncf __truncf_generic
+
+#include "../s_truncf.S"
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S
new file mode 100644
index 000000000..6f26ab7af
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S
@@ -0,0 +1,40 @@
+/* Compute positive difference, sparc 32-bit+v9.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fdim)
+ std %o0, [%sp + 72]
+ std %o2, [%sp + 80]
+ ldd [%sp + 72], %f0
+ ldd [%sp + 80], %f2
+ fcmpd %f0, %f2
+ fbug 1f
+ nop
+ fzero %f0
+ fnegd %f0, %f2
+1: retl
+ fsubd %f0, %f2, %f0
+END(__fdim)
+weak_alias (__fdim, fdim)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S
new file mode 100644
index 000000000..fc55867cd
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S
@@ -0,0 +1,35 @@
+/* Compute positive difference, sparc 32-bit+v9.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__fdimf)
+ st %o0, [%sp + 72]
+ st %o1, [%sp + 76]
+ ld [%sp + 72], %f0
+ ld [%sp + 76], %f1
+ fcmps %f0, %f1
+ fbug 1f
+ nop
+ fzeros %f0
+ fnegs %f0, %f1
+1: retl
+ fsubs %f0, %f1, %f0
+END(__fdimf)
+weak_alias (__fdimf, fdimf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S
new file mode 100644
index 000000000..ee6a575e1
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S
@@ -0,0 +1,72 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc32 v9 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyint)
+ st %fsr, [%sp + 88]
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sethi %hi(0xf8003e0), %o5
+ ld [%sp + 88], %o4
+ sllx %o0, 32, %o0
+ or %o5, %lo(0xf8003e0), %o5
+ or %o0, %o1, %o0
+ andn %o4, %o5, %o4
+ fzero ZERO
+ st %o4, [%sp + 80]
+ stx %o0, [%sp + 72]
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ ldd [%sp + 72], %f0
+ ld [%sp + 80], %fsr
+ stx %o2, [%sp + 72]
+ fabsd %f0, %f14
+ ldd [%sp + 72], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ faddd %f0, %f16, %f6
+ fsubd %f6, %f16, %f0
+ fabsd %f0, %f0
+ for %f0, SIGN_BIT, %f0
+ retl
+ ld [%sp + 88], %fsr
+END (__nearbyint)
+weak_alias (__nearbyint, nearbyint)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1)
+#endif
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S
new file mode 100644
index 000000000..4225b5449
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S
@@ -0,0 +1,64 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc32 v9 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyintf)
+ st %fsr, [%sp + 88]
+ st %o0, [%sp + 68]
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ sethi %hi(0xf8003e0), %o5
+ ld [%sp + 88], %o4
+ fzeros ZERO
+ or %o5, %lo(0xf8003e0), %o5
+ fnegs ZERO, SIGN_BIT
+ andn %o4, %o5, %o4
+ st %o4, [%sp + 80]
+ ld [%sp + 68], %f1
+ ld [%sp + 80], %fsr
+ st %o2, [%sp + 68]
+ fabss %f1, %f14
+ ld [%sp + 68], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ fadds %f1, %f16, %f5
+ fsubs %f5, %f16, %f0
+ fabss %f0, %f0
+ fors %f0, SIGN_BIT, %f0
+ retl
+ ld [%sp + 88], %fsr
+END (__nearbyintf)
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S
new file mode 100644
index 000000000..c451d1d99
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S
@@ -0,0 +1,64 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc32 v9 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__trunc)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o0, 32, %o0
+ or %o0, %o1, %o0
+ fzero ZERO
+ stx %o0, [%sp + 72]
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ ldd [%sp + 72], %f0
+ stx %o2, [%sp + 72]
+ fabsd %f0, %f14
+ ldd [%sp + 72], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f14
+ fand %f0, SIGN_BIT, SIGN_BIT
+ fdtox %f14, %f14
+ fxtod %f14, %f14
+ faddd %f0, ZERO, %f18
+ fmovduge %fcc3, %f18, %f14
+ retl
+ for %f14, SIGN_BIT, %f0
+END (__trunc)
+weak_alias (__trunc, trunc)
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S
new file mode 100644
index 000000000..4e6e25b26
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S
@@ -0,0 +1,56 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc32 v9 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__truncf)
+ st %o0, [%sp + 68]
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ ld [%sp + 68], %f1
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + 68]
+ fabss %f1, %f14
+ ld [%sp + 68], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f14
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fstoi %f14, %f14
+ fitos %f14, %f14
+ fadds %f1, ZERO, %f18
+ fmovsuge %fcc3, %f18, %f14
+ retl
+ fors %f14, SIGN_BIT, %f0
+END (__truncf)
+weak_alias (__truncf, truncf)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S
index 42284eada..e9a537196 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/mul_1.S
@@ -1 +1,70 @@
-#include <sparcv8/mul_1.S>
+! SPARC v9 32-bit __mpn_mul_1 -- Multiply a limb vector with a single
+! limb and store the product in a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %o0
+#define s1_ptr %o1
+#define sz %o2
+#define s2_limb %o3
+#define carry %o5
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+
+ENTRY(__mpn_mul_1)
+ srl sz, 0, sz
+ srl s2_limb, 0, s2_limb
+ subcc sz, 1, sz
+ be,pn %icc, .Lfinal_limb
+ clr carry
+
+.Lloop:
+ lduw [s1_ptr + 0x00], tmp1
+ lduw [s1_ptr + 0x04], tmp2
+ mulx tmp1, s2_limb, tmp3
+ add s1_ptr, 8, s1_ptr
+ mulx tmp2, s2_limb, tmp4
+ sub sz, 2, sz
+ add res_ptr, 8, res_ptr
+ add carry, tmp3, tmp3
+ stw tmp3, [res_ptr - 0x08]
+ srlx tmp3, 32, carry
+ add carry, tmp4, tmp4
+ stw tmp4, [res_ptr - 0x04]
+ brgz sz, .Lloop
+ srlx tmp4, 32, carry
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ lduw [s1_ptr + 0x00], tmp1
+ mulx tmp1, s2_limb, tmp3
+ add carry, tmp3, tmp3
+ stw tmp3, [res_ptr + 0x00]
+ srlx tmp3, 32, carry
+
+.Lfinish:
+ retl
+ mov carry, %o0
+END(__mpn_mul_1)
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S b/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S
index de69533f6..8985e2a4c 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S
+++ b/libc/sysdeps/sparc/sparc32/sparcv9/submul_1.S
@@ -1 +1,82 @@
-#include <sparcv8/submul_1.S>
+! SPARC v9 32-bit __mpn_submul_1 -- Multiply a limb vector with a limb
+! and subtract the result from a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %i0
+#define s1_ptr %i1
+#define sz_arg %i2
+#define s2l_arg %i3
+#define sz %o4
+#define carry %o5
+#define s2_limb %g1
+#define tmp1 %l0
+#define tmp2 %l1
+#define tmp3 %l2
+#define tmp4 %l3
+#define tmp64_1 %g3
+#define tmp64_2 %o3
+
+ENTRY(__mpn_submul_1)
+ save %sp, -96, %sp
+ srl sz_arg, 0, sz
+ srl s2l_arg, 0, s2_limb
+ subcc sz, 1, sz
+ be,pn %icc, .Lfinal_limb
+ subcc %g0, 0, carry
+
+.Lloop:
+ lduw [s1_ptr + 0x00], tmp1
+ lduw [res_ptr + 0x00], tmp3
+ lduw [s1_ptr + 0x04], tmp2
+ lduw [res_ptr + 0x04], tmp4
+ mulx tmp1, s2_limb, tmp64_1
+ add s1_ptr, 8, s1_ptr
+ mulx tmp2, s2_limb, tmp64_2
+ sub sz, 2, sz
+ add res_ptr, 8, res_ptr
+ addx carry, tmp64_1, tmp64_1
+ srlx tmp64_1, 32, carry
+ subcc tmp3, tmp64_1, tmp64_1
+ stw tmp64_1, [res_ptr - 0x08]
+ addx carry, tmp64_2, tmp64_2
+ srlx tmp64_2, 32, carry
+ subcc tmp4, tmp64_2, tmp64_2
+ brgz sz, .Lloop
+ stw tmp64_2, [res_ptr - 0x04]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ lduw [s1_ptr + 0x00], tmp1
+ lduw [res_ptr + 0x00], tmp3
+ mulx tmp1, s2_limb, tmp64_1
+ addx carry, tmp64_1, tmp64_1
+ srlx tmp64_1, 32, carry
+ subcc tmp3, tmp64_1, tmp64_1
+ stw tmp64_1, [res_ptr + 0x00]
+
+.Lfinish:
+ addx carry, 0, carry
+ jmpl %i7 + 0x8, %g0
+ restore carry, 0, %o0
+END(__mpn_submul_1)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/libc/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 83458484a..6a9274b4f 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -1,4 +1,6 @@
ifeq ($(subdir),math)
+libm-sysdep_routines += s_ceil-vis2 s_ceilf-vis2 \
+ s_floor-vis2 s_floorf-vis2
ifeq ($(have-as-vis3),yes)
libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 s_ceilf-vis3 \
s_ceil-vis3 m_finitef-vis3 m_finite-vis3 \
@@ -7,7 +9,8 @@ libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 s_ceilf-vis3 \
s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 \
s_rint-vis3 s_fminf-vis3 s_fmin-vis3 \
s_fmaxf-vis3 s_fmax-vis3 s_fmaf-vis3 \
- s_fma-vis3
+ s_fma-vis3 s_nearbyint-vis3 s_nearbyintf-vis3 \
+ s_truncf-vis3 s_trunc-vis3
sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \
s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
s_isnanf-vis3 s_isnan-vis3
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S
new file mode 100644
index 000000000..50d96a6ef
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S
@@ -0,0 +1,57 @@
+/* ceil function, sparc64 vis2 version.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__ceil_vis2)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ fzero ZERO
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ stx %o2, [%sp + STACK_BIAS + 128]
+ fabsd %f0, %f14
+ ldd [%sp + STACK_BIAS + 128], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
+ faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
+ fsubd %f18, %f16, %f18
+ siam (0 << 2)
+ retl
+ for %f18, SIGN_BIT, %f0
+END (__ceil_vis2)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S
index 9a598ea6f..6acff0999 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S
@@ -19,57 +19,41 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
-#define ONE_DOT_ZERO 0x3ff00000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
ENTRY (__ceil_vis3)
sethi %hi(TWO_FIFTYTWO), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzero ZERO
-
sllx %o2, 32, %o2
fnegd ZERO, SIGN_BIT
-
- sllx %o3, 32, %o3
movxtod %o2, %f16
fabsd %f0, %f14
-
fcmpd %fcc3, %f14, %f16
-
fmovduge %fcc3, ZERO, %f16
fand %f0, SIGN_BIT, SIGN_BIT
-
for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
fsubd %f18, %f16, %f18
- fcmpd %fcc2, %f18, %f0
- movxtod %o3, %f20
-
- fmovduge %fcc2, ZERO, %f20
- faddd %f18, %f20, %f0
- fabsd %f0, %f0
+ siam (0 << 2)
retl
- for %f0, SIGN_BIT, %f0
+ for %f18, SIGN_BIT, %f0
END (__ceil_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S
index fa4c7c353..e7822bc30 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(ceil)
+SPARC_ASM_VIS3_VIS2_IFUNC(ceil)
weak_alias (__ceil, ceil)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S
new file mode 100644
index 000000000..cd5937b38
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S
@@ -0,0 +1,56 @@
+/* Float ceil function, sparc64 vis2 version.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__ceilf_vis2)
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + STACK_BIAS + 128]
+ fabss %f1, %f14
+ ld [%sp + STACK_BIAS + 128], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
+ fadds %f1, %f16, %f5
+ siam (1 << 2) | 0
+ fsubs %f5, %f16, %f5
+ siam (0 << 2)
+ retl
+ fors %f5, SIGN_BIT, %f0
+END (__ceilf_vis2)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S
index 8c635907d..b3ec3484d 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S
@@ -19,55 +19,40 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
-#define ONE_DOT_ZERO 0x3f800000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
ENTRY (__ceilf_vis3)
sethi %hi(TWO_TWENTYTHREE), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzeros ZERO
-
fnegs ZERO, SIGN_BIT
-
movwtos %o2, %f16
fabss %f1, %f14
-
fcmps %fcc3, %f14, %f16
-
fmovsuge %fcc3, ZERO, %f16
fands %f1, SIGN_BIT, SIGN_BIT
-
fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 2
fadds %f1, %f16, %f5
+ siam (1 << 2) | 0
fsubs %f5, %f16, %f5
- fcmps %fcc2, %f5, %f1
- movwtos %o3, %f9
-
- fmovsuge %fcc2, ZERO, %f9
- fadds %f5, %f9, %f0
- fabss %f0, %f0
+ siam (0 << 2)
retl
- fors %f0, SIGN_BIT, %f0
+ fors %f5, SIGN_BIT, %f0
END (__ceilf_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S
index 3047dd8fa..1c72a5728 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(ceilf)
+SPARC_ASM_VIS3_VIS2_IFUNC(ceilf)
weak_alias (__ceilf, ceilf)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S
new file mode 100644
index 000000000..5479ceddf
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S
@@ -0,0 +1,57 @@
+/* floor function, sparc64 vis2 version.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__floor_vis2)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ fzero ZERO
+ sllx %o2, 32, %o2
+ fnegd ZERO, SIGN_BIT
+ stx %o2, [%sp + STACK_BIAS + 128]
+ fabsd %f0, %f14
+ ldd [%sp + STACK_BIAS + 128], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
+ faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
+ fsubd %f18, %f16, %f18
+ siam (0 << 2)
+ retl
+ for %f18, SIGN_BIT, %f0
+END (__floor_vis2)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S
index 169d20654..c2ffe9f41 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S
@@ -19,57 +19,41 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
-#define ONE_DOT_ZERO 0x3ff00000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
ENTRY (__floor_vis3)
sethi %hi(TWO_FIFTYTWO), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzero ZERO
-
sllx %o2, 32, %o2
fnegd ZERO, SIGN_BIT
-
- sllx %o3, 32, %o3
movxtod %o2, %f16
fabsd %f0, %f14
-
fcmpd %fcc3, %f14, %f16
-
fmovduge %fcc3, ZERO, %f16
fand %f0, SIGN_BIT, SIGN_BIT
-
for %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
faddd %f0, %f16, %f18
+ siam (1 << 2) | 0
fsubd %f18, %f16, %f18
- fcmpd %fcc2, %f18, %f0
- movxtod %o3, %f20
-
- fmovdule %fcc2, ZERO, %f20
- fsubd %f18, %f20, %f0
- fabsd %f0, %f0
+ siam (0 << 2)
retl
- for %f0, SIGN_BIT, %f0
+ for %f18, SIGN_BIT, %f0
END (__floor_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S
index 6ae9947a7..989ccab56 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(floor)
+SPARC_ASM_VIS3_VIS2_IFUNC(floor)
weak_alias (__floor, floor)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S
new file mode 100644
index 000000000..935fa853d
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S
@@ -0,0 +1,56 @@
+/* Float floor function, sparc64 vis2 version.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2012.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
+
+ We add then subtract (or subtract than add if the initial
+ value was negative) 2**23 to the value, then subtract it
+ back out.
+
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__floorf_vis2)
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + STACK_BIAS + 128]
+ fabss %f1, %f14
+ ld [%sp + STACK_BIAS + 128], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
+ fadds %f1, %f16, %f5
+ siam (1 << 2) | 0
+ fsubs %f5, %f16, %f5
+ siam (0 << 2)
+ retl
+ fors %f5, SIGN_BIT, %f0
+END (__floorf_vis2)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S
index 65be2977a..225e17ec0 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S
@@ -19,55 +19,40 @@
#include <sysdep.h>
- /* Since changing the rounding mode is extremely expensive, we
- try to round up using a method that is rounding mode
- agnostic.
+ /* 'siam' (Set Interval Arithmetic Mode) is used to quickly override
+ the rounding mode during this routine.
We add then subtract (or subtract than add if the initial
value was negative) 2**23 to the value, then subtract it
back out.
- This will clear out the fractional portion of the value.
- One of two things will happen for non-whole initial values.
- Either the rounding mode will round it up, or it will be
- rounded down. If the value started out whole, it will be
- equal after the addition and subtraction. This means we
- can accurately detect with one test whether we need to add
- another 1.0 to round it up properly.
+ This will clear out the fractional portion of the value and,
+ with suitable 'siam' initiated rouding mode settings, round
+ the final result in the proper direction.
- VIS instructions are used to facilitate the formation of
- easier constants, and the propagation of the sign bit. */
+ We also use VIS3 moves to avoid using the stack to transfer
+ values between float and integer registers. */
#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
-#define ONE_DOT_ZERO 0x3f800000 /* 1.0 */
#define ZERO %f10 /* 0.0 */
#define SIGN_BIT %f12 /* -0.0 */
ENTRY (__floorf_vis3)
sethi %hi(TWO_TWENTYTHREE), %o2
- sethi %hi(ONE_DOT_ZERO), %o3
fzeros ZERO
-
fnegs ZERO, SIGN_BIT
-
- movwtos %o2, %f16
+ movwtos %o2, %f16
fabss %f1, %f14
-
fcmps %fcc3, %f14, %f16
-
fmovsuge %fcc3, ZERO, %f16
fands %f1, SIGN_BIT, SIGN_BIT
-
fors %f16, SIGN_BIT, %f16
+ siam (1 << 2) | 3
fadds %f1, %f16, %f5
+ siam (1 << 2) | 0
fsubs %f5, %f16, %f5
- fcmps %fcc2, %f5, %f1
- movwtos %o3, %f9
-
- fmovsule %fcc2, ZERO, %f9
- fsubs %f5, %f9, %f0
- fabss %f0, %f0
+ siam (0 << 2)
retl
- fors %f0, SIGN_BIT, %f0
+ fors %f5, SIGN_BIT, %f0
END (__floorf_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S
index 31cda385b..d2a83cb9b 100644
--- a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S
@@ -1,6 +1,6 @@
#include <sparc-ifunc.h>
-SPARC_ASM_VIS3_IFUNC(floorf)
+SPARC_ASM_VIS3_VIS2_IFUNC(floorf)
weak_alias (__floorf, floorf)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S
new file mode 100644
index 000000000..f2071d66c
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S
@@ -0,0 +1,61 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc64 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyint_vis3)
+ stx %fsr, [%sp + STACK_BIAS + 144]
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o2, 32, %o2
+ ldx [%sp + STACK_BIAS + 144], %o4
+ sethi %hi(0xf8003e0), %o5
+ fzero ZERO
+ or %o5, %lo(0xf8003e0), %o5
+ fnegd ZERO, SIGN_BIT
+ andn %o4, %o5, %o4
+ movxtod %o2, %f16
+ stx %o4, [%sp + STACK_BIAS + 136]
+ ldx [%sp + STACK_BIAS + 136], %fsr
+ fabsd %f0, %f14
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ faddd %f0, %f16, %f6
+ fsubd %f6, %f16, %f0
+ fabsd %f0, %f0
+ for %f0, SIGN_BIT, %f0
+ retl
+ ldx [%sp + STACK_BIAS + 144], %fsr
+END (__nearbyint_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S
new file mode 100644
index 000000000..bb75ab360
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(nearbyint)
+
+weak_alias (__nearbyint, nearbyint)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __nearbyint __nearbyint_generic
+
+#include "../s_nearbyint.S"
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S
new file mode 100644
index 000000000..b08928f6f
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S
@@ -0,0 +1,60 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc64 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyintf_vis3)
+ stx %fsr, [%sp + STACK_BIAS + 144]
+ sethi %hi(0xf8003e0), %o5
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ ldx [%sp + STACK_BIAS + 144], %o4
+ or %o5, %lo(0xf8003e0), %o5
+ fzeros ZERO
+ andn %o4, %o5, %o4
+ fnegs ZERO, SIGN_BIT
+ movwtos %o2, %f16
+ stx %o4, [%sp + STACK_BIAS + 136]
+ ldx [%sp + STACK_BIAS + 136], %fsr
+ fabss %f1, %f14
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ fadds %f1, %f16, %f5
+ fsubs %f5, %f16, %f0
+ fabss %f0, %f0
+ fors %f0, SIGN_BIT, %f0
+ retl
+ ldx [%sp + STACK_BIAS + 144], %fsr
+END (__nearbyintf_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S
new file mode 100644
index 000000000..95100c1bf
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(nearbyintf)
+
+weak_alias (__nearbyintf, nearbyintf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __nearbyintf __nearbyintf_generic
+
+#include "../s_nearbyintf.S"
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S
new file mode 100644
index 000000000..34ff42da8
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S
@@ -0,0 +1,53 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc64 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__trunc_vis3)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o2, 32, %o2
+ fzero ZERO
+ fnegd ZERO, SIGN_BIT
+ movxtod %o2, %f16
+ fabsd %f0, %f14
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f14
+ fand %f0, SIGN_BIT, SIGN_BIT
+ fdtox %f14, %f14
+ fxtod %f14, %f14
+ faddd %f0, ZERO, %f18
+ fmovduge %fcc3, %f18, %f14
+ retl
+ for %f14, SIGN_BIT, %f0
+END (__trunc_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S
new file mode 100644
index 000000000..0d6f43a18
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(trunc)
+
+weak_alias (__trunc, trunc)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __trunc __trunc_generic
+
+#include "../s_trunc.S"
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S
new file mode 100644
index 000000000..e566b6ba8
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S
@@ -0,0 +1,52 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc64 vis3 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__truncf_vis3)
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ fnegs ZERO, SIGN_BIT
+ movwtos %o2,%f16
+ fabss %f1, %f14
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f14
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fstoi %f14, %f14
+ fitos %f14, %f14
+ fadds %f1, ZERO, %f18
+ fmovsuge %fcc3, %f18, %f14
+ retl
+ fors %f14, SIGN_BIT, %f0
+END (__truncf_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S
new file mode 100644
index 000000000..2ca251733
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S
@@ -0,0 +1,12 @@
+#include <sparc-ifunc.h>
+
+SPARC_ASM_VIS3_IFUNC(truncf)
+
+weak_alias (__truncf, truncf)
+
+# undef weak_alias
+# define weak_alias(a, b)
+
+#define __truncf __truncf_generic
+
+#include "../s_truncf.S"
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_fdim.S b/libc/sysdeps/sparc/sparc64/fpu/s_fdim.S
new file mode 100644
index 000000000..a1c53dfb1
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_fdim.S
@@ -0,0 +1,32 @@
+/* Compute positive difference, sparc 64-bit.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fdim)
+ fcmpd %f0, %f2
+ fbug 1f
+ nop
+ fzero %f0
+ fnegd %f0, %f2
+1: retl
+ fsubd %f0, %f2, %f0
+END(__fdim)
+weak_alias (__fdim, fdim)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_fdimf.S b/libc/sysdeps/sparc/sparc64/fpu/s_fdimf.S
new file mode 100644
index 000000000..61782a5f3
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_fdimf.S
@@ -0,0 +1,31 @@
+/* Compute positive difference, sparc 64-bit.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__fdimf)
+ fcmps %f1, %f3
+ fbug 1f
+ nop
+ fzeros %f1
+ fnegs %f1, %f3
+1: retl
+ fsubs %f1, %f3, %f0
+END(__fdimf)
+weak_alias (__fdimf, fdimf)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_nearbyint.S b/libc/sysdeps/sparc/sparc64/fpu/s_nearbyint.S
new file mode 100644
index 000000000..963e4bc7b
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_nearbyint.S
@@ -0,0 +1,63 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc64 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyint)
+ stx %fsr, [%sp + STACK_BIAS + 144]
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o2, 32, %o2
+ ldx [%sp + STACK_BIAS + 144], %o4
+ sethi %hi(0xf8003e0), %o5
+ fzero ZERO
+ or %o5, %lo(0xf8003e0), %o5
+ fnegd ZERO, SIGN_BIT
+ andn %o4, %o5, %o4
+ stx %o2, [%sp + STACK_BIAS + 128]
+ stx %o4, [%sp + STACK_BIAS + 136]
+ ldx [%sp + STACK_BIAS + 136], %fsr
+ fabsd %f0, %f14
+ ldd [%sp + STACK_BIAS + 128], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f16
+ fand %f0, SIGN_BIT, SIGN_BIT
+ for %f16, SIGN_BIT, %f16
+ faddd %f0, %f16, %f6
+ fsubd %f6, %f16, %f0
+ fabsd %f0, %f0
+ for %f0, SIGN_BIT, %f0
+ retl
+ ldx [%sp + STACK_BIAS + 144], %fsr
+END (__nearbyint)
+weak_alias (__nearbyint, nearbyint)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_nearbyintf.S b/libc/sysdeps/sparc/sparc64/fpu/s_nearbyintf.S
new file mode 100644
index 000000000..4ff29058e
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_nearbyintf.S
@@ -0,0 +1,62 @@
+/* Round float to int floating-point values without generating
+ an inexact exception, sparc64 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__nearbyintf)
+ stx %fsr, [%sp + STACK_BIAS + 144]
+ sethi %hi(0xf8003e0), %o5
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ ldx [%sp + STACK_BIAS + 144], %o4
+ or %o5, %lo(0xf8003e0), %o5
+ fzeros ZERO
+ andn %o4, %o5, %o4
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + STACK_BIAS + 128]
+ stx %o4, [%sp + STACK_BIAS + 136]
+ ldx [%sp + STACK_BIAS + 136], %fsr
+ fabss %f1, %f14
+ ld [%sp + STACK_BIAS + 128], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f16
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fors %f16, SIGN_BIT, %f16
+ fadds %f1, %f16, %f5
+ fsubs %f5, %f16, %f0
+ fabss %f0, %f0
+ fors %f0, SIGN_BIT, %f0
+ retl
+ ldx [%sp + STACK_BIAS + 144], %fsr
+END (__nearbyintf)
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_trunc.S b/libc/sysdeps/sparc/sparc64/fpu/s_trunc.S
new file mode 100644
index 000000000..13d47eb97
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_trunc.S
@@ -0,0 +1,55 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc64 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_FIFTYTWO 0x43300000 /* 2**52 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__trunc)
+ sethi %hi(TWO_FIFTYTWO), %o2
+ sllx %o2, 32, %o2
+ fzero ZERO
+ fnegd ZERO, SIGN_BIT
+ stx %o2, [%sp + STACK_BIAS + 128]
+ fabsd %f0, %f14
+ ldd [%sp + STACK_BIAS + 128], %f16
+ fcmpd %fcc3, %f14, %f16
+ fmovduge %fcc3, ZERO, %f14
+ fand %f0, SIGN_BIT, SIGN_BIT
+ fdtox %f14, %f14
+ fxtod %f14, %f14
+ faddd %f0, ZERO, %f18
+ fmovduge %fcc3, %f18, %f14
+ retl
+ for %f14, SIGN_BIT, %f0
+END (__trunc)
+weak_alias (__trunc, trunc)
diff --git a/libc/sysdeps/sparc/sparc64/fpu/s_truncf.S b/libc/sysdeps/sparc/sparc64/fpu/s_truncf.S
new file mode 100644
index 000000000..e25a1f595
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/fpu/s_truncf.S
@@ -0,0 +1,54 @@
+/* Truncate argument to nearest integral value not larger than
+ the argument, sparc64 version.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@davemloft.net>, 2013.
+
+ 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/>. */
+
+#include <sysdep.h>
+
+ /* We pop constants into the FPU registers using the incoming
+ argument stack slots, since this avoid having to use any PIC
+ references. We also thus avoid having to allocate a register
+ window.
+
+ VIS instructions are used to facilitate the formation of
+ easier constants, and the propagation of the sign bit. */
+
+#define TWO_TWENTYTHREE 0x4b000000 /* 2**23 */
+
+#define ZERO %f10 /* 0.0 */
+#define SIGN_BIT %f12 /* -0.0 */
+
+ENTRY (__truncf)
+ sethi %hi(TWO_TWENTYTHREE), %o2
+ fzeros ZERO
+ fnegs ZERO, SIGN_BIT
+ st %o2, [%sp + STACK_BIAS + 128]
+ fabss %f1, %f14
+ ld [%sp + STACK_BIAS + 128], %f16
+ fcmps %fcc3, %f14, %f16
+ fmovsuge %fcc3, ZERO, %f14
+ fands %f1, SIGN_BIT, SIGN_BIT
+ fstoi %f14, %f14
+ fitos %f14, %f14
+ fadds %f1, ZERO, %f18
+ fmovsuge %fcc3, %f18, %f14
+ retl
+ fors %f14, SIGN_BIT, %f0
+END (__truncf)
+weak_alias (__truncf, truncf)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/Makefile b/libc/sysdeps/sparc/sparc64/multiarch/Makefile
index 4ad7aff91..55b757f9a 100644
--- a/libc/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/libc/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -10,3 +10,12 @@ ifeq ($(subdir),string)
sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
memset-niagara1 memcpy-niagara4 memset-niagara4
endif
+
+ifeq ($(subdir),stdlib)
+sysdep_routines += mul_1-vis3 addmul_1-vis3 submul_1-vis3 add_n-vis3 sub_n-vis3
+endif
+
+ifeq ($(subdir),math)
+gmp-sysdep_routines = mul_1-vis3 addmul_1-vis3 submul_1-vis3 add_n-vis3 \
+ sub_n-vis3
+endif
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/add_n-vis3.S b/libc/sysdeps/sparc/sparc64/multiarch/add_n-vis3.S
new file mode 100644
index 000000000..185f31169
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/add_n-vis3.S
@@ -0,0 +1,67 @@
+! SPARC v9 64-bit VIS3 __mpn_add_n -- Add two limb vectors of the same length > 0 and
+! store sum in a third limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %o0
+#define s1_ptr %o1
+#define s2_ptr %o2
+#define sz %o3
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ENTRY(__mpn_add_n_vis3)
+ subcc sz, 1, sz
+ be .Lfinal_limb
+ cmp %g0, 0
+
+.Lloop:
+ ldx [s2_ptr + 0x00], tmp1
+ add s2_ptr, 0x10, s2_ptr
+ ldx [s1_ptr + 0x00], tmp2
+ add s1_ptr, 0x10, s1_ptr
+ ldx [s2_ptr - 0x08], tmp3
+ add res_ptr, 0x10, res_ptr
+ ldx [s1_ptr - 0x08], tmp4
+ sub sz, 2, sz
+ addxccc tmp1, tmp2, tmp1
+ stx tmp1, [res_ptr - 0x10]
+ addxccc tmp3, tmp4, tmp3
+ brgz sz, .Lloop
+ stx tmp3, [res_ptr - 0x08]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ ldx [s2_ptr + 0x00], tmp1
+ ldx [s1_ptr + 0x00], tmp2
+ addxccc tmp1, tmp2, tmp1
+ stx tmp1, [res_ptr + 0x00]
+
+.Lfinish:
+ retl
+ addxc %g0, %g0, %o0
+END(__mpn_add_n_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/add_n.S b/libc/sysdeps/sparc/sparc64/multiarch/add_n.S
new file mode 100644
index 000000000..25cae3977
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/add_n.S
@@ -0,0 +1,56 @@
+/* Multiple versions of add_n
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__mpn_add_n)
+ .type __mpn_add_n, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_VIS3, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_add_n_vis3), %o1
+ xor %o1, %gdop_lox10(__mpn_add_n_vis3), %o1
+# else
+ set __mpn_add_n_vis3, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_add_n_generic), %o1
+ xor %o1, %gdop_lox10(__mpn_add_n_generic), %o1
+# else
+ set __mpn_add_n_vis3, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__mpn_add_n)
+
+#define __mpn_add_n __mpn_add_n_generic
+#include "../add_n.S"
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S b/libc/sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S
new file mode 100644
index 000000000..f955b27c0
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S
@@ -0,0 +1,87 @@
+! SPARC v9 64-bit VIS3 __mpn_addmul_1 -- Multiply a limb vector with a
+! limb and add the result to a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %i0
+#define s1_ptr %i1
+#define sz %i2
+#define s2_limb %i3
+#define carry %o5
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+#define tmp5 %l0
+#define tmp6 %l1
+#define tmp7 %l2
+#define tmp8 %l3
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ENTRY(__mpn_addmul_1_vis3)
+ save %sp, -176, %sp
+ subcc sz, 1, sz
+ be .Lfinal_limb
+ clr carry
+
+.Lloop:
+ ldx [s1_ptr + 0x00], tmp1
+ ldx [res_ptr + 0x00], tmp3
+ ldx [s1_ptr + 0x08], tmp2
+ ldx [res_ptr + 0x08], tmp4
+ mulx tmp1, s2_limb, tmp5
+ add s1_ptr, 0x10, s1_ptr
+ umulxhi tmp1, s2_limb, tmp6
+ add res_ptr, 0x10, res_ptr
+ mulx tmp2, s2_limb, tmp7
+ sub sz, 2, sz
+ umulxhi tmp2, s2_limb, tmp8
+ addcc carry, tmp5, tmp5
+ addxc %g0, tmp6, carry
+ addcc tmp3, tmp5, tmp5
+ addxc %g0, carry, carry
+ stx tmp5, [res_ptr - 0x10]
+ addcc carry, tmp7, tmp7
+ addxc %g0, tmp8, carry
+ addcc tmp4, tmp7, tmp7
+ addxc %g0, carry, carry
+ brgz sz, .Lloop
+ stx tmp7, [res_ptr - 0x08]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ ldx [s1_ptr + 0x00], tmp1
+ ldx [res_ptr + 0x00], tmp3
+ mulx tmp1, s2_limb, tmp5
+ umulxhi tmp1, s2_limb, tmp6
+ addcc carry, tmp5, tmp5
+ addxc %g0, tmp6, carry
+ addcc tmp3, tmp5, tmp5
+ addxc %g0, carry, carry
+ stx tmp5, [res_ptr + 0x00]
+
+.Lfinish:
+ jmpl %i7 + 8, %g0
+ restore carry, 0, %o0
+END(__mpn_addmul_1_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/addmul_1.S b/libc/sysdeps/sparc/sparc64/multiarch/addmul_1.S
new file mode 100644
index 000000000..a1659e40e
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/addmul_1.S
@@ -0,0 +1,56 @@
+/* Multiple versions of addmul_1
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__mpn_addmul_1)
+ .type __mpn_addmul_1, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_VIS3, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_addmul_1_vis3), %o1
+ xor %o1, %gdop_lox10(__mpn_addmul_1_vis3), %o1
+# else
+ set __mpn_addmul_1_vis3, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_addmul_1_generic), %o1
+ xor %o1, %gdop_lox10(__mpn_addmul_1_generic), %o1
+# else
+ set __mpn_addmul_1_vis3, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__mpn_addmul_1)
+
+#define __mpn_addmul_1 __mpn_addmul_1_generic
+#include "../addmul_1.S"
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S b/libc/sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S
new file mode 100644
index 000000000..61fbe27a4
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S
@@ -0,0 +1,73 @@
+! SPARC v9 64-bit VIS3 __mpn_mul_1 -- Multiply a limb vector with a single
+! limb and store the product in a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %o0
+#define s1_ptr %o1
+#define sz %o2
+#define s2_limb %o3
+#define carry %o5
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ENTRY(__mpn_mul_1_vis3)
+ subcc sz, 1, sz
+ be .Lfinal_limb
+ clr carry
+
+.Lloop:
+ ldx [s1_ptr + 0x00], tmp1
+ ldx [s1_ptr + 0x08], tmp4
+ mulx tmp1, s2_limb, tmp3
+ add s1_ptr, 0x10, s1_ptr
+ umulxhi tmp1, s2_limb, tmp2
+ sub sz, 2, sz
+ mulx tmp4, s2_limb, tmp1
+ add res_ptr, 0x10, res_ptr
+ umulxhi tmp4, s2_limb, tmp4
+ addcc carry, tmp3, tmp3
+ stx tmp3, [res_ptr - 0x10]
+ addxc %g0, tmp2, carry
+ addcc carry, tmp1, tmp1
+ addxc %g0, tmp4, carry
+ brgz sz, .Lloop
+ stx tmp1, [res_ptr - 0x08]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ ldx [s1_ptr + 0x00], tmp1
+ mulx tmp1, s2_limb, tmp3
+ umulxhi tmp1, s2_limb, tmp2
+ addcc carry, tmp3, tmp3
+ addxc %g0, tmp2, carry
+ stx tmp3, [res_ptr + 0x00]
+
+.Lfinish:
+ retl
+ mov carry, %o0
+END(__mpn_mul_1_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/mul_1.S b/libc/sysdeps/sparc/sparc64/multiarch/mul_1.S
new file mode 100644
index 000000000..25f51bf81
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/mul_1.S
@@ -0,0 +1,56 @@
+/* Multiple versions of mul_1
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__mpn_mul_1)
+ .type __mpn_mul_1, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_VIS3, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_mul_1_vis3), %o1
+ xor %o1, %gdop_lox10(__mpn_mul_1_vis3), %o1
+# else
+ set __mpn_mul_1_vis3, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_mul_1_generic), %o1
+ xor %o1, %gdop_lox10(__mpn_mul_1_generic), %o1
+# else
+ set __mpn_mul_1_vis3, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__mpn_mul_1)
+
+#define __mpn_mul_1 __mpn_mul_1_generic
+#include "../mul_1.S"
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S b/libc/sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S
new file mode 100644
index 000000000..4e9a786d3
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S
@@ -0,0 +1,71 @@
+! SPARC v9 64-bit VIS3 __mpn_sub_n -- Subtract two limb vectors of the same length > 0
+! and store difference in a third limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %o0
+#define s1_ptr %o1
+#define s2_ptr %o2
+#define sz %o3
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ENTRY(__mpn_sub_n_vis3)
+ subcc sz, 1, sz
+ be .Lfinal_limb
+ cmp %g0, 1
+
+.Lloop:
+ ldx [s2_ptr + 0x00], tmp1
+ add s2_ptr, 0x10, s2_ptr
+ ldx [s1_ptr + 0x00], tmp2
+ add s1_ptr, 0x10, s1_ptr
+ ldx [s2_ptr - 0x08], tmp3
+ add res_ptr, 0x10, res_ptr
+ ldx [s1_ptr - 0x08], tmp4
+ sub sz, 2, sz
+ xnor tmp1, %g0, tmp1
+ addxccc tmp1, tmp2, tmp1
+ stx tmp1, [res_ptr - 0x10]
+ xnor tmp3, %g0, tmp3
+ addxccc tmp3, tmp4, tmp3
+ brgz sz, .Lloop
+ stx tmp3, [res_ptr - 0x08]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ ldx [s2_ptr + 0x00], tmp1
+ ldx [s1_ptr + 0x00], tmp2
+ xnor tmp1, %g0, tmp1
+ addxccc tmp1, tmp2, tmp1
+ stx tmp1, [res_ptr + 0x00]
+
+.Lfinish:
+ clr %o0
+ retl
+ movcc %xcc, 1, %o0
+END(__mpn_sub_n_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/sub_n.S b/libc/sysdeps/sparc/sparc64/multiarch/sub_n.S
new file mode 100644
index 000000000..5e15bea10
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/sub_n.S
@@ -0,0 +1,56 @@
+/* Multiple versions of sub_n
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__mpn_sub_n)
+ .type __mpn_sub_n, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_VIS3, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_sub_n_vis3), %o1
+ xor %o1, %gdop_lox10(__mpn_sub_n_vis3), %o1
+# else
+ set __mpn_sub_n_vis3, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_sub_n_generic), %o1
+ xor %o1, %gdop_lox10(__mpn_sub_n_generic), %o1
+# else
+ set __mpn_sub_n_vis3, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__mpn_sub_n)
+
+#define __mpn_sub_n __mpn_sub_n_generic
+#include "../sub_n.S"
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S b/libc/sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S
new file mode 100644
index 000000000..8f10f918a
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S
@@ -0,0 +1,87 @@
+! SPARC v9 64-bit VIS3 __mpn_submul_1 -- Multiply a limb vector with a
+! limb and subtract the result from a second limb vector.
+!
+! Copyright (C) 2013 Free Software Foundation, Inc.
+! This file is part of the GNU C Library.
+! Contributed by David S. Miller <davem@davemloft.net>
+!
+! 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/>.
+
+#include <sysdep.h>
+
+#define res_ptr %i0
+#define s1_ptr %i1
+#define sz %i2
+#define s2_limb %i3
+#define carry %o5
+#define tmp1 %g1
+#define tmp2 %g2
+#define tmp3 %g3
+#define tmp4 %o4
+#define tmp5 %l0
+#define tmp6 %l1
+#define tmp7 %l2
+#define tmp8 %l3
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ENTRY(__mpn_submul_1_vis3)
+ save %sp, -176, %sp
+ subcc sz, 1, sz
+ be .Lfinal_limb
+ clr carry
+
+.Lloop:
+ ldx [s1_ptr + 0x00], tmp1
+ ldx [res_ptr + 0x00], tmp3
+ ldx [s1_ptr + 0x08], tmp2
+ ldx [res_ptr + 0x08], tmp4
+ mulx tmp1, s2_limb, tmp5
+ add s1_ptr, 0x10, s1_ptr
+ umulxhi tmp1, s2_limb, tmp6
+ add res_ptr, 0x10, res_ptr
+ mulx tmp2, s2_limb, tmp7
+ sub sz, 2, sz
+ umulxhi tmp2, s2_limb, tmp8
+ addcc carry, tmp5, tmp5
+ addxc %g0, tmp6, carry
+ subcc tmp3, tmp5, tmp5
+ addxc %g0, carry, carry
+ stx tmp5, [res_ptr - 0x10]
+ addcc carry, tmp7, tmp7
+ addxc %g0, tmp8, carry
+ subcc tmp4, tmp7, tmp7
+ addxc %g0, carry, carry
+ brgz sz, .Lloop
+ stx tmp7, [res_ptr - 0x08]
+
+ brlz,pt sz, .Lfinish
+ nop
+
+.Lfinal_limb:
+ ldx [s1_ptr + 0x00], tmp1
+ ldx [res_ptr + 0x00], tmp3
+ mulx tmp1, s2_limb, tmp5
+ umulxhi tmp1, s2_limb, tmp6
+ addcc carry, tmp5, tmp5
+ addxc %g0, tmp6, carry
+ subcc tmp3, tmp5, tmp5
+ addxc %g0, carry, carry
+ stx tmp5, [res_ptr + 0x00]
+
+.Lfinish:
+ jmpl %i7 + 8, %g0
+ restore carry, 0, %o0
+END(__mpn_submul_1_vis3)
diff --git a/libc/sysdeps/sparc/sparc64/multiarch/submul_1.S b/libc/sysdeps/sparc/sparc64/multiarch/submul_1.S
new file mode 100644
index 000000000..68552e9af
--- /dev/null
+++ b/libc/sysdeps/sparc/sparc64/multiarch/submul_1.S
@@ -0,0 +1,56 @@
+/* Multiple versions of submul_1
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ 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/>. */
+
+#include <sysdep.h>
+
+ENTRY(__mpn_submul_1)
+ .type __mpn_submul_1, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_VIS3, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_submul_1_vis3), %o1
+ xor %o1, %gdop_lox10(__mpn_submul_1_vis3), %o1
+# else
+ set __mpn_submul_1_vis3, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__mpn_submul_1_generic), %o1
+ xor %o1, %gdop_lox10(__mpn_submul_1_generic), %o1
+# else
+ set __mpn_submul_1_vis3, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__mpn_submul_1)
+
+#define __mpn_submul_1 __mpn_submul_1_generic
+#include "../submul_1.S"
diff --git a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
index a8bb09075..b5929bd29 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -296,6 +296,13 @@ struct f_owner_ex
# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+/* Flags for fallocate. */
+# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
+ even if offset + len is
+ greater than file size. */
+# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */
+
+
/* File handle structure. */
struct file_handle
{
diff --git a/libc/sysdeps/unix/sysv/linux/bits/socket.h b/libc/sysdeps/unix/sysv/linux/bits/socket.h
index 25b115e50..eadd7d932 100644
--- a/libc/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/libc/sysdeps/unix/sysv/linux/bits/socket.h
@@ -207,6 +207,8 @@ enum
#define MSG_MORE MSG_MORE
MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/
#define MSG_WAITFORONE MSG_WAITFORONE
+ MSG_FASTOPEN = 0x20000000, /* Send data in TCP SYN. */
+#define MSG_FASTOPEN MSG_FASTOPEN
MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
descriptor received through
diff --git a/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h
index 0a876dfa6..737ca0e65 100644
--- a/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h
+++ b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h
@@ -55,3 +55,5 @@ check_may_shrink_heap (void)
return may_shrink_heap;
}
+
+#define HAVE_MREMAP 1
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Versions b/libc/sysdeps/unix/sysv/linux/powerpc/Versions
index 1ef53b9e9..396a4236c 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/Versions
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -3,5 +3,6 @@ libc {
__vdso_get_tbfreq;
__vdso_clock_gettime;
__vdso_clock_getres;
+ __vdso_getcpu;
}
}
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
index 6f79841ce..545fda462 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
@@ -30,6 +30,8 @@ extern void *__vdso_clock_getres;
extern void *__vdso_get_tbfreq;
+extern void *__vdso_getcpu;
+
#endif
#endif /* _LIBC_VDSO_H */
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
index 616342aec..5e88b83b5 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -41,7 +41,8 @@ __get_clockfreq (void)
/* If we can use the vDSO to obtain the timebase even better. */
#ifdef SHARED
INTERNAL_SYSCALL_DECL (err);
- timebase_freq = INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, 0);
+ timebase_freq =
+ INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, hp_timing_t, 0);
if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
&& INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
#endif
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c
index 5202e7d2f..204c0c60a 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c
@@ -27,6 +27,7 @@ void *__vdso_gettimeofday attribute_hidden;
void *__vdso_clock_gettime;
void *__vdso_clock_getres;
void *__vdso_get_tbfreq;
+void *__vdso_getcpu;
static inline void
@@ -40,7 +41,9 @@ _libc_vdso_platform_setup (void)
__vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
- __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615);
+ __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
+
+ __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
}
# define VDSO_SETUP _libc_vdso_platform_setup
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index e047bf7bd..250f4fc8c 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -60,7 +60,8 @@
\
if (__vdso_##name != NULL) \
{ \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
+ sc_ret = \
+ INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
goto out; \
if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
@@ -90,7 +91,8 @@
\
if (__vdso_##name != NULL) \
{ \
- v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ v_ret = \
+ INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \
if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
|| INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
goto out; \
@@ -104,12 +106,12 @@
INTERNAL_SYSCALL (name, err, nr, ##args)
# endif
-# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
({ \
- long int sc_ret = ENOSYS; \
+ type sc_ret = ENOSYS; \
\
if (__vdso_##name != NULL) \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \
else \
err = 1 << 28; \
sc_ret; \
@@ -126,7 +128,7 @@
function call, with the exception of LR (which is needed for the
"sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
an error return status). */
-# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
({ \
register void *r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \
@@ -139,18 +141,18 @@
register long int r10 __asm__ ("r10"); \
register long int r11 __asm__ ("r11"); \
register long int r12 __asm__ ("r12"); \
+ register type rval __asm__ ("r3"); \
LOADARGS_##nr (funcptr, args); \
__asm__ __volatile__ \
("mtctr %0\n\t" \
"bctrl\n\t" \
"mfcr %0" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
- "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
- : ASM_INPUT_##nr \
- : "cr0", "ctr", "lr", "memory"); \
+ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \
+ "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \
+ : : "cr0", "ctr", "lr", "memory"); \
err = (long int) r0; \
- (int) r3; \
+ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \
+ rval; \
})
# undef INLINE_SYSCALL
@@ -191,7 +193,7 @@
register long int r10 __asm__ ("r10"); \
register long int r11 __asm__ ("r11"); \
register long int r12 __asm__ ("r12"); \
- LOADARGS_##nr(name, args); \
+ LOADARGS_##nr(name, args); \
__asm__ __volatile__ \
("sc \n\t" \
"mfcr %0" \
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 1f0c3a225..6ebab742c 100644
--- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -75,7 +75,8 @@
\
if (__vdso_##name != NULL) \
{ \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
+ sc_ret = \
+ INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
goto out; \
if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
@@ -105,7 +106,8 @@
\
if (__vdso_##name != NULL) \
{ \
- v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ v_ret = \
+ INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \
if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
|| INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
goto out; \
@@ -121,12 +123,12 @@
/* This version is for internal uses when there is no desire
to set errno */
-#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
+#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
({ \
- long int sc_ret = ENOSYS; \
+ type sc_ret = ENOSYS; \
\
if (__vdso_##name != NULL) \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \
else \
err = 1 << 28; \
sc_ret; \
@@ -142,7 +144,7 @@
gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
the negation of the return value in the kernel gets reverted. */
-#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
({ \
register void *r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \
@@ -151,20 +153,19 @@
register long int r6 __asm__ ("r6"); \
register long int r7 __asm__ ("r7"); \
register long int r8 __asm__ ("r8"); \
+ register type rval __asm__ ("r3"); \
LOADARGS_##nr (funcptr, args); \
__asm__ __volatile__ \
("mtctr %0\n\t" \
"bctrl\n\t" \
"mfcr %0\n\t" \
"0:" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), \
- "=&r" (r6), "=&r" (r7), "=&r" (r8) \
- : ASM_INPUT_##nr \
- : "r9", "r10", "r11", "r12", \
- "cr0", "ctr", "lr", "memory"); \
- err = (long int) r0; \
- r3; \
+ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \
+ "+r" (r7), "+r" (r8) \
+ : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \
+ err = (long int) r0; \
+ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \
+ rval; \
})
#undef INLINE_SYSCALL
diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
new file mode 100644
index 000000000..617e6f121
--- /dev/null
+++ b/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2013 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/>. */
+
+#include <sched.h>
+#include <sysdep.h>
+#include <bits/libc-vdso.h>
+
+
+int
+sched_getcpu (void)
+{
+ unsigned int cpu;
+ int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
+
+ return r == -1 ? r : cpu;
+}
diff --git a/libc/sysdeps/unix/sysv/linux/scsi/sg.h b/libc/sysdeps/unix/sysv/linux/scsi/sg.h
index 9cad76ebf..68f57f29f 100644
--- a/libc/sysdeps/unix/sysv/linux/scsi/sg.h
+++ b/libc/sysdeps/unix/sysv/linux/scsi/sg.h
@@ -26,6 +26,8 @@
#define _SCSI_SG_H 1
#include <features.h>
+#define __need_size_t
+#include <stddef.h>
/* New interface introduced in the 3.x SG drivers follows */
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
index 757d0472b..e59f96abc 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
@@ -56,6 +56,6 @@ struct ipc_perm
unsigned short int __pad1;
#endif
unsigned short int __seq; /* Sequence number. */
- unsigned long long int __unused1;
- unsigned long long int __unused2;
+ __extension__ unsigned long long int __unused1;
+ __extension__ unsigned long long int __unused2;
};
diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/unix/sysv/linux/multiarch/Implies b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies
index a380d8a73..a380d8a73 100644
--- a/libc/sysdeps/sparc/sparc32/sparcv9/fpu/unix/sysv/linux/multiarch/Implies
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
index 74c729166..1a3d4b54a 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
@@ -217,7 +217,7 @@ typedef struct fpu
typedef struct fpu
{
union { /* FPU floating point regs */
- unsigned long long fpu_regs[32]; /* 32 singles */
+ __extension__ unsigned long long fpu_regs[32]; /* 32 singles */
double fpu_dregs[16]; /* 16 doubles */
} fpu_fr;
struct fq *fpu_q; /* ptr to array of FQ entries */
diff --git a/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h b/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h
index 76eaf9f9d..a1f1b2697 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -21,10 +21,6 @@
#include <features.h>
-/* If the compiler does not know long long it is out of luck. We are
- not going to hack weird hacks to support the dev_t representation
- they need. */
-#ifdef __GLIBC_HAVE_LONG_LONG
__BEGIN_DECLS
__extension__
@@ -38,7 +34,7 @@ extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
__THROW __attribute_const__;
-# ifdef __USE_EXTERN_INLINES
+#ifdef __USE_EXTERN_INLINES
__extension__ __extern_inline __attribute_const__ unsigned int
__NTH (gnu_dev_major (unsigned long long int __dev))
{
@@ -58,13 +54,12 @@ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
| (((unsigned long long int) (__minor & ~0xff)) << 12)
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
-# endif
+#endif
__END_DECLS
/* Access the functions with their traditional names. */
-# define major(dev) gnu_dev_major (dev)
-# define minor(dev) gnu_dev_minor (dev)
-# define makedev(maj, min) gnu_dev_makedev (maj, min)
-#endif
+#define major(dev) gnu_dev_major (dev)
+#define minor(dev) gnu_dev_minor (dev)
+#define makedev(maj, min) gnu_dev_makedev (maj, min)
#endif /* sys/sysmacros.h */
diff --git a/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h b/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h
index 0fe1e3f5f..27b37b30e 100644
--- a/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h
+++ b/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h
@@ -64,15 +64,19 @@
#else /* __WORDSIZE == 32 */
-/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
- and all platforms support LFS. */
-# define _POSIX_V7_ILP32_OFF32 1
+/* We have 32-bit wide `int', `long int' and pointers and all platforms
+ support LFS. -mx32 has 64-bit wide `off_t'. */
# define _POSIX_V7_ILP32_OFFBIG 1
-# define _POSIX_V6_ILP32_OFF32 1
-# define _POSIX_V6_ILP32_OFFBIG 1
-# define _XBS5_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG 1
# define _XBS5_ILP32_OFFBIG 1
+# ifndef __x86_64__
+/* -m32 has 32-bit wide `off_t'. */
+# define _POSIX_V7_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFF32 1
+# define _XBS5_ILP32_OFF32 1
+# endif
+
/* We optionally provide an environment with the above size but an 64-bit
side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */
@@ -89,8 +93,13 @@
#endif /* __WORDSIZE == 32 */
#define __ILP32_OFF32_CFLAGS "-m32"
-#define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
#define __ILP32_OFF32_LDFLAGS "-m32"
-#define __ILP32_OFFBIG_LDFLAGS "-m32"
+#if defined __x86_64__ && defined __ILP32__
+# define __ILP32_OFFBIG_CFLAGS "-mx32"
+# define __ILP32_OFFBIG_LDFLAGS "-mx32"
+#else
+# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+# define __ILP32_OFFBIG_LDFLAGS "-m32"
+#endif
#define __LP64_OFF64_CFLAGS "-m64"
#define __LP64_OFF64_LDFLAGS "-m64"
diff --git a/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h b/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h
index dddbced57..ec318ad93 100644
--- a/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h
+++ b/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h
@@ -36,7 +36,7 @@ __BEGIN_DECLS
/* Type for a general-purpose register. */
#ifdef __x86_64__
-typedef unsigned long long elf_greg_t;
+__extension__ typedef unsigned long long elf_greg_t;
#else
typedef unsigned long elf_greg_t;
#endif
diff --git a/libc/sysdeps/x86/bits/byteswap.h b/libc/sysdeps/x86/bits/byteswap.h
index 0f96ba302..9e2effc1a 100644
--- a/libc/sysdeps/x86/bits/byteswap.h
+++ b/libc/sysdeps/x86/bits/byteswap.h
@@ -134,7 +134,7 @@ __bswap_64 (__uint64_t __bsx)
} \
__r.__ll; }))
# endif
-#elif __GLIBC_HAVE_LONG_LONG
+#else
# define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
diff --git a/libc/sysdeps/x86/bits/setjmp.h b/libc/sysdeps/x86/bits/setjmp.h
index 8a7e5dcc9..7c666e20d 100644
--- a/libc/sysdeps/x86/bits/setjmp.h
+++ b/libc/sysdeps/x86/bits/setjmp.h
@@ -30,7 +30,7 @@
# if __WORDSIZE == 64
typedef long int __jmp_buf[8];
# elif defined __x86_64__
-typedef long long int __jmp_buf[8];
+__extension__ typedef long long int __jmp_buf[8];
# else
typedef int __jmp_buf[6];
# endif
diff --git a/libc/sysdeps/x86/fpu/bits/mathinline.h b/libc/sysdeps/x86/fpu/bits/mathinline.h
index 838c13cd8..fed64149f 100644
--- a/libc/sysdeps/x86/fpu/bits/mathinline.h
+++ b/libc/sysdeps/x86/fpu/bits/mathinline.h
@@ -198,6 +198,7 @@ __NTH (lrint (double __x))
}
# endif
# ifdef __x86_64__
+__extension__
__MATH_INLINE long long int
__NTH (llrintf (float __x))
{
@@ -209,6 +210,7 @@ __NTH (llrintf (float __x))
__asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
return __res;
}
+__extension__
__MATH_INLINE long long int
__NTH (llrint (double __x))
{
@@ -896,16 +898,19 @@ __NTH (lrintl (long double __x))
("fistpll %0" \
: "=m" (__llrintres) : "t" (__x) : "st"); \
return __llrintres
+__extension__
__MATH_INLINE long long int
__NTH (llrintf (float __x))
{
__llrint_code;
}
+__extension__
__MATH_INLINE long long int
__NTH (llrint (double __x))
{
__llrint_code;
}
+__extension__
__MATH_INLINE long long int
__NTH (llrintl (long double __x))
{
diff --git a/libc/sysdeps/x86_64/dl-machine.h b/libc/sysdeps/x86_64/dl-machine.h
index 660f1aa1e..4768c6954 100644
--- a/libc/sysdeps/x86_64/dl-machine.h
+++ b/libc/sysdeps/x86_64/dl-machine.h
@@ -286,6 +286,21 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
switch (r_type)
{
+# ifndef RTLD_BOOTSTRAP
+# ifdef __ILP32__
+ case R_X86_64_SIZE64:
+ /* Set to symbol size plus addend. */
+ *(Elf64_Addr *) (uintptr_t) reloc_addr
+ = (Elf64_Addr) sym->st_size + reloc->r_addend;
+ break;
+
+ case R_X86_64_SIZE32:
+# else
+ case R_X86_64_SIZE64:
+# endif
+ /* Set to symbol size plus addend. */
+ value = sym->st_size;
+# endif
case R_X86_64_GLOB_DAT:
case R_X86_64_JUMP_SLOT:
*reloc_addr = value + reloc->r_addend;
@@ -394,6 +409,11 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
relocation updates the whole 64-bit entry. */
*(Elf64_Addr *) reloc_addr = (Elf64_Addr) value + reloc->r_addend;
break;
+# ifndef __ILP32__
+ case R_X86_64_SIZE32:
+ /* Set to symbol size plus addend. */
+ value = sym->st_size;
+# endif
case R_X86_64_32:
value += reloc->r_addend;
*(unsigned int *) reloc_addr = value;
diff --git a/libc/sysdeps/x86_64/fpu/libm-test-ulps b/libc/sysdeps/x86_64/fpu/libm-test-ulps
index 95b6aec81..63c6aed2a 100644
--- a/libc/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/libc/sysdeps/x86_64/fpu/libm-test-ulps
@@ -244,6 +244,12 @@ ifloat: 1
Test "Imaginary part of: cacos (-0 - 1.5 i) == pi/2 + 1.194763217287109304111930828519090523536 i":
double: 1
idouble: 1
+Test "Real part of: cacos (-1.0 + 0x1p50 i) == 1.570796326794897507409741391764983781004 - 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
+Test "Real part of: cacos (-1.0 - 0x1p50 i) == 1.570796326794897507409741391764983781004 + 3.535050620855721078027883819436759661753e1 i":
+float: 1
+ifloat: 1
Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
@@ -254,6 +260,9 @@ ldouble: 1
Test "Imaginary part of: cacos (-1.5 - 0 i) == pi + 0.9624236501192068949955178268487368462704 i":
ildouble: 1
ldouble: 1
+Test "Real part of: cacos (-2 - 3 i) == 2.1414491111159960199416055713254211 + 1.9833870299165354323470769028940395 i":
+float: 1
+ifloat: 1
Test "Real part of: cacos (0.5 + +0 i) == 1.047197551196597746154214461093167628066 - 0 i":
double: 1
idouble: 1
@@ -272,6 +281,12 @@ float: 1
ifloat: 1
ildouble: 2
ldouble: 2
+Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 - 7.107906849659093345062145442726115449315e2 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 - 8.973081118419833726837456344608533993585e1 i":
+double: 1
+idouble: 1
Test "Imaginary part of: cacos (1.5 + +0 i) == +0 - 0.9624236501192068949955178268487368462704 i":
double: 1
float: 1
diff --git a/libc/wcsmbs/wchar.h b/libc/wcsmbs/wchar.h
index 75e2dea6a..e91558683 100644
--- a/libc/wcsmbs/wchar.h
+++ b/libc/wcsmbs/wchar.h
@@ -475,7 +475,7 @@ extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
__THROW;
__END_NAMESPACE_STD
-#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
+#ifdef __USE_ISOC99
__BEGIN_NAMESPACE_C99
/* Convert initial portion of wide string NPTR to `long long int'
representation. */
@@ -491,9 +491,9 @@ extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base) __THROW;
__END_NAMESPACE_C99
-#endif /* ISO C99 or GCC and GNU. */
+#endif /* ISO C99. */
-#if defined __GNUC__ && defined __USE_GNU
+#ifdef __USE_GNU
/* Convert initial portion of wide string NPTR to `long long int'
representation. */
__extension__
@@ -507,7 +507,7 @@ __extension__
extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base) __THROW;
-#endif /* GCC and use GNU. */
+#endif /* Use GNU. */
#ifdef __USE_GNU
/* The concept of one static locale per category is not very well